Commit 69c03969cb70c97e1aeeaf5c4cb196b323f359c9

Authored by 娄高锋
2 parents 5eb19a0c 7888e606

Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into

pudong
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -239,7 +239,6 @@ public class GpsServiceImpl implements GpsService {
239 239 long serviceState;
240 240 ArrivalEntity arrival;
241 241 Set<String> lineSet=new HashSet();
242   - String firstLineCode="";
243 242 List<Map<String,Object>> lineSwitch=new ArrayList<>();
244 243  
245 244 List<Map> gpsNotValidList=new ArrayList();
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -568,7 +568,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
568 568  
569 569 //公司 和 分公司名称
570 570 t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm()));
571   - t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getGsBm() + "_" + t.getFgsBm()));
  571 + t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm()+ "_" + t.getGsBm() ));
572 572  
573 573 //t.setScheduleDateStr(schDate);
574 574 t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr()));
... ...
src/main/resources/application-dev.properties
... ... @@ -8,9 +8,10 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
8 8 spring.jpa.database= MYSQL
9 9 spring.jpa.show-sql= true
10 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11   -spring.datasource.url= jdbc:mysql://127.0.0.1/pd_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.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 13 spring.datasource.username= root
13   -spring.datasource.password=
  14 +spring.datasource.password= root
14 15 #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false
15 16 #spring.datasource.username= root
16 17 #spring.datasource.password= root
... ...
src/main/resources/fatso/package.json
1   -{
2   - "name": "fatso",
3   - "version": "1.0.0",
4   - "description": "子页面js检查、合并、压缩等处理",
5   - "main": "start.js",
6   - "scripts": {
7   - "test": "echo \"Error: no test specified\" && exit 1"
8   - },
9   - "author": "panzhaov5",
10   - "license": "ISC",
11   - "dependencies": {
12   - "cheerio": "^0.20.0",
13   - "clean-css": "^4.0.12",
14   - "colors": "^1.3.3",
15   - "eventproxy": "^0.3.4",
16   - "uglify-js": "^2.6.2"
17   - }
18   -}
  1 +{
  2 + "name": "fatso",
  3 + "version": "1.0.0",
  4 + "description": "子页面js检查、合并、压缩等处理",
  5 + "main": "start.js",
  6 + "scripts": {
  7 + "test": "echo \"Error: no test specified\" && exit 1"
  8 + },
  9 + "author": "panzhaov5",
  10 + "license": "ISC",
  11 + "dependencies": {
  12 + "cheerio": "^0.20.0",
  13 + "clean-css": "^4.0.12",
  14 + "colors": "^1.3.3",
  15 + "eventproxy": "^0.3.4",
  16 + "uglify-js": "^2.6.2"
  17 + }
  18 +}
... ...
src/main/resources/static/pages/base/timesmodel/js/v2_2/main_v2_2.js
1   -/**
2   - * 主类(v2_2版本)。
3   - */
4   -var Main_v2_2 = function() {
5   -
6   - var _paramObj; // 参数对象
7   -
8   - return {
9   - /**
10   - * 使用发车间隔策略生成时刻表。
11   - * @param paramObj 参数对象
12   - * @param lpArray 路牌数组
13   - * @constructor
14   - */
15   - BXPplaceClassesTime03 : function(paramObj, lpArray) {
16   - // 参数对象
17   - _paramObj = paramObj;
18   -
19   - // // 测试行驶时间
20   - // var _fcsj = paramObj.toTimeObj("16:20");
21   - // var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, _fcsj, paramObj); // 使用策略计算班次行驶时间
22   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj);
23   - //
24   -
25   - // // 测试停站时间
26   - // var _fcsj = paramObj.toTimeObj("05:30");
27   - // var _layovertime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
28   - // _fcsj, false, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj);
29   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",停站layover时间=" + _layovertime);
30   - //
31   - // var schedule = {};
32   -
33   - // // 测试间隔时间
34   - // var _fcsj = paramObj.toTimeObj("07:30");
35   - // var _headway = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(true, _fcsj, _paramObj);
36   - // console.log("发车时间=" + _fcsj.format("HH:mm") + ",发车间隔=" + _headway);
37   -
38   - // 1、初始化行车计划
39   - var schedule = new InternalScheduleObj_v2_2(paramObj, lpArray);
40   - // 2、生成班次(从第2圈开始)
41   - schedule.fnCreateBclistWithMasterBc(2, 20);
42   - // 3、调整发车间隔
43   - schedule.fnAdjustHeadway();
44   - // 4、计算吃饭班次
45   - schedule.fnCalcuEatBc();
46   - // // 6、计算末班车
47   - // schedule.fnCalcuLastBc();
48   - // 7、重新设置停站时间
49   - schedule.fnReSetLayoverTime();
50   - // 8、补进出场例保班次
51   - schedule.fnCalcuOtherBc();
52   -
53   - //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
54   - // TODO:班型再议
55   - return {
56   - 'json':schedule.fnToGanttBcArray(),'bxrcgs':null,
57   - 'aInternalLpObj': schedule.fnGetLpArray()
58   - };
59   - },
60   -
61   - //----------------------------------- 导入导出配置 -----------------------------------//
62   -
63   - /**
64   - * 导出时刻表配置。
65   - * @param fnGetGanttBc 获取gantt班次方法
66   - */
67   - exportExcelConfig: function(fnGetGanttBc) {
68   - var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc);
69   -
70   - $('.exportAddXls').off('click');
71   - $('.exportAddXlsx').off('click');
72   -
73   - $('.exportAddXls').on('click', function() {
74   -
75   - var aInfos = {
76   - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
77   - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
78   - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
79   - };
80   -
81   - console.log(aInfos);
82   -
83   - $(".exportAdd").addClass("disabled");
84   - $(".exportAddSpan").html("正在导出...");
85   -
86   - // 提交
87   - $.ajax({
88   - type: 'POST',
89   - url: "/tidc/exportDTDFile/xls",
90   - dataType: 'binary',
91   - contentType: "application/json",
92   - data: JSON.stringify(aInfos),
93   - success: function(data){
94   - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
95   -
96   - $(".exportAdd").removeClass("disabled");
97   - $(".exportAddSpan").html(" 导出数据");
98   - },
99   - error: function(xhr, type){
100   - alert('错误:TODO');
101   -
102   - $(".exportAdd").removeClass("disabled");
103   - $(".exportAddSpan").html(" 导出数据");
104   - }
105   - });
106   - });
107   -
108   - $('.exportAddXlsx').on('click', function() {
109   - var aInfos = {
110   - "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
111   - "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
112   - "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
113   - };
114   -
115   - console.log(aInfos);
116   -
117   - $(".exportAdd").addClass("disabled");
118   - $(".exportAddSpan").html("正在导出...");
119   -
120   - // 提交
121   - $.ajax({
122   - type: 'POST',
123   - url: "/tidc/exportDTDFile/xlsx",
124   - dataType: 'binary',
125   - contentType: "application/json",
126   - data: JSON.stringify(aInfos),
127   - success: function(data){
128   - oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
129   -
130   - $(".exportAdd").removeClass("disabled");
131   - $(".exportAddSpan").html(" 导出数据");
132   - },
133   - error: function(xhr, type){
134   - alert('错误:TODO');
135   -
136   - $(".exportAdd").removeClass("disabled");
137   - $(".exportAddSpan").html(" 导出数据");
138   - }
139   - });
140   - });
141   - }
142   -
143   -
144   - }
  1 +/**
  2 + * 主类(v2_2版本)。
  3 + */
  4 +var Main_v2_2 = function() {
  5 +
  6 + var _paramObj; // 参数对象
  7 +
  8 + return {
  9 + /**
  10 + * 使用发车间隔策略生成时刻表。
  11 + * @param paramObj 参数对象
  12 + * @param lpArray 路牌数组
  13 + * @constructor
  14 + */
  15 + BXPplaceClassesTime03 : function(paramObj, lpArray) {
  16 + // 参数对象
  17 + _paramObj = paramObj;
  18 +
  19 + // // 测试行驶时间
  20 + // var _fcsj = paramObj.toTimeObj("16:20");
  21 + // var _bcsj = StrategyUtils_v2_2.sFn("CALCU_RUNTIME")(false, _fcsj, paramObj); // 使用策略计算班次行驶时间
  22 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",行驶时间=" + _bcsj);
  23 + //
  24 +
  25 + // // 测试停站时间
  26 + // var _fcsj = paramObj.toTimeObj("05:30");
  27 + // var _layovertime = StrategyUtils_v2_2.sFn("CALCU_LAYOVER_TIME")(
  28 + // _fcsj, false, StrategyUtils_v2_2.sFn("CALCU_RUNTIME"), paramObj);
  29 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",停站layover时间=" + _layovertime);
  30 + //
  31 + // var schedule = {};
  32 +
  33 + // // 测试间隔时间
  34 + // var _fcsj = paramObj.toTimeObj("07:30");
  35 + // var _headway = StrategyUtils_v2_2.sFn("CALCU_HEADWAY_2")(true, _fcsj, _paramObj);
  36 + // console.log("发车时间=" + _fcsj.format("HH:mm") + ",发车间隔=" + _headway);
  37 +
  38 + // 1、初始化行车计划
  39 + var schedule = new InternalScheduleObj_v2_2(paramObj, lpArray);
  40 + // 2、生成班次(从第2圈开始)
  41 + schedule.fnCreateBclistWithMasterBc(2, 20);
  42 + // 3、调整发车间隔
  43 + schedule.fnAdjustHeadway();
  44 + // 4、计算吃饭班次
  45 + schedule.fnCalcuEatBc();
  46 + // // 6、计算末班车
  47 + // schedule.fnCalcuLastBc();
  48 + // 7、重新设置停站时间
  49 + schedule.fnReSetLayoverTime();
  50 + // 8、补进出场例保班次
  51 + schedule.fnCalcuOtherBc();
  52 +
  53 + //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
  54 + // TODO:班型再议
  55 + return {
  56 + 'json':schedule.fnToGanttBcArray(),'bxrcgs':null,
  57 + 'aInternalLpObj': schedule.fnGetLpArray()
  58 + };
  59 + },
  60 +
  61 + //----------------------------------- 导入导出配置 -----------------------------------//
  62 +
  63 + /**
  64 + * 导出时刻表配置。
  65 + * @param fnGetGanttBc 获取gantt班次方法
  66 + */
  67 + exportExcelConfig: function(fnGetGanttBc) {
  68 + var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc);
  69 +
  70 + $('.exportAddXls').off('click');
  71 + $('.exportAddXlsx').off('click');
  72 +
  73 + $('.exportAddXls').on('click', function() {
  74 +
  75 + var aInfos = {
  76 + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
  77 + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
  78 + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
  79 + };
  80 +
  81 + console.log(aInfos);
  82 +
  83 + $(".exportAdd").addClass("disabled");
  84 + $(".exportAddSpan").html("正在导出...");
  85 +
  86 + // 提交
  87 + $.ajax({
  88 + type: 'POST',
  89 + url: "/tidc/exportDTDFile/xls",
  90 + dataType: 'binary',
  91 + contentType: "application/json",
  92 + data: JSON.stringify(aInfos),
  93 + success: function(data){
  94 + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
  95 +
  96 + $(".exportAdd").removeClass("disabled");
  97 + $(".exportAddSpan").html(" 导出数据");
  98 + },
  99 + error: function(xhr, type){
  100 + alert('错误:TODO');
  101 +
  102 + $(".exportAdd").removeClass("disabled");
  103 + $(".exportAddSpan").html(" 导出数据");
  104 + }
  105 + });
  106 + });
  107 +
  108 + $('.exportAddXlsx').on('click', function() {
  109 + var aInfos = {
  110 + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
  111 + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
  112 + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
  113 + };
  114 +
  115 + console.log(aInfos);
  116 +
  117 + $(".exportAdd").addClass("disabled");
  118 + $(".exportAddSpan").html("正在导出...");
  119 +
  120 + // 提交
  121 + $.ajax({
  122 + type: 'POST',
  123 + url: "/tidc/exportDTDFile/xlsx",
  124 + dataType: 'binary',
  125 + contentType: "application/json",
  126 + data: JSON.stringify(aInfos),
  127 + success: function(data){
  128 + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
  129 +
  130 + $(".exportAdd").removeClass("disabled");
  131 + $(".exportAddSpan").html(" 导出数据");
  132 + },
  133 + error: function(xhr, type){
  134 + alert('错误:TODO');
  135 +
  136 + $(".exportAdd").removeClass("disabled");
  137 + $(".exportAddSpan").html(" 导出数据");
  138 + }
  139 + });
  140 + });
  141 + }
  142 +
  143 +
  144 + }
145 145 }();
146 146 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/user/authorize.html
1   -<!DOCTYPE html>
2   -<html lang="zh-cn">
3   -
4   -<head>
5   - <meta charset="UTF-8">
6   - <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
7   - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
8   - <link rel="stylesheet" href="/assets/plugins/ztree_v3/css/zTreeStyle/zTreeStyle.css" />
9   - <style>
10   - html,body{
11   - height: 100%;
12   - }
13   - .ct_page{
14   - padding: 25px 15px;
15   - height: 100%;
16   - height: calc(100% - 50px);
17   - }
18   -
19   - .ct_cont{
20   - height: calc(100% - 41px);
21   - }
22   -
23   - .ct_cont>div>div.uk-card{
24   - height: 99%;
25   - }
26   -
27   - form .uk-inline{
28   - width: calc(100% - 4px);
29   - margin-left: 2px;
30   - }
31   -
32   - .ct-card-body{
33   - overflow: auto;
34   - padding: 1px 1px 0 2px;
35   - height: calc(100% - 54px);
36   - position: relative;
37   - margin-top: -12px;
38   - }
39   -
40   - .ct_li_desc{
41   - color: #a8a8a8;
42   - font-size: 13px;
43   - }
44   -
45   - .ct-card-body .uk-list-large{
46   - font-size: 14px;
47   - }
48   -
49   - .ct-card-body .uk-list-large>li{
50   - cursor: default;
51   - padding-left: 20px;
52   - margin-top: 2px !important;
53   - padding-top: 17px !important;
54   - position: relative;
55   - }
56   -
57   - .ct-card-body .uk-list-large>li:hover{
58   - background: #edecec;
59   - }
60   -
61   - .ct-card-body .uk-list-large>li.active{
62   - background: #1e87f0 !important;
63   - color: white;
64   - }
65   -
66   - .ct-card-body .uk-list-large>li.active>span.role-code{
67   - color: #ffffff;
68   - }
69   -
70   - .ct-card-body .uk-list-large.role-list>li:hover{
71   - background: #fff494;
72   - }
73   -
74   - .ct-card-body .uk-list-large>li.active .ct_li_desc{
75   - color: #e6e6e6;
76   - }
77   -
78   - .ct-card-body .uk-list-large>li>span.uk-badge{
79   - position: absolute;
80   - top: 17px;
81   - right: 25px;
82   - }
83   -
84   - .ct-card-body .uk-list-large>li>span.role-code{
85   - padding: 4px 6px;
86   - color: #a8a8a8;
87   - margin-left: 5px;
88   - }
89   -
90   - .top_title{
91   - padding: 9px 0 5px 15px;
92   - border-bottom: 1px solid #ededed;
93   - border-left: 5px solid #FFC107;
94   - }
95   -
96   - .top_title>.desc{
97   - font-size: 13px;
98   - color: grey;
99   - margin-top: 3px;
100   - }
101   -
102   - .left_menu_list{
103   - overflow: auto;
104   - position: relative;
105   - }
106   -
107   - .left_menu_list .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{
108   - opacity: 0.6 !important;
109   - padding: 0 !important;
110   - }
111   -
112   - ._company{
113   - margin: 15px 0px;
114   - }
115   - ._company>h5{
116   - margin-bottom: 10px;
117   - font-size: 15px;
118   - color: #6b6b6b;
119   - text-indent: 12px;
120   - }
121   - ._company>._fgs>label{
122   - padding: 3px 12px 3px 10px;
123   - display: inline-block;
124   - border: 1px solid gainsboro;
125   - border-radius: 2px;
126   - margin: 5px;
127   - font-size: 14px;
128   - }
129   - ._company>._fgs>label.active{
130   - background: #1e87f0;
131   - color: #fff;
132   - }
133   - ._company .uk-checkbox:checked:focus,
134   - .line_checkbox_list .uk-checkbox:checked:focus{
135   - background-color: #1e87f0 !important;
136   - }
137   - .save_icon{
138   - position: absolute;
139   - right: 2px;
140   - background: #bec4c9;
141   - font-size: 12px;
142   - padding: 2px 15px;
143   - color: #fff;
144   - box-shadow: 0 5px 15px rgba(0,0,0,0.08);
145   - cursor: pointer;
146   - }
147   - .save_icon:hover{
148   - background: #FFC107;
149   - }
150   - .data_auth_list{
151   - position: relative;
152   - }
153   - #user_authorize_wrap .top_title{
154   - border-left: 5px solid #cacac8;
155   - }
156   - .xd_line_list{
157   - height: 37%;
158   - padding: 7px;
159   - border-bottom: 1px solid #f2f2f2;
160   - overflow: auto;
161   - position: relative;
162   - }
163   - .xd_line_list>h5{
164   - color: #858585;
165   - margin: 5px 5px 5px 0;
166   - font-size: 14px;
167   - }
168   - .sub_lines{
169   - padding-left: 15px;
170   - }
171   - .sub_lines>span.line_btn {
172   - background: #00BCD4;
173   - color: #fff;
174   - padding: 4px 9px;
175   - display: inline-block;
176   - min-width: 68px;
177   - text-align: center;
178   - margin: 5px 2px;
179   - box-shadow: 0 5px 9px rgba(0,0,0,0.08);
180   - cursor: pointer;
181   - font-size: 14px;
182   - font-family: 微软雅黑;
183   - }
184   -
185   - .sub_lines>span.line_btn.destroy{
186   - background: #ff5c5c;
187   - }
188   -
189   - .sub_lines>span.line_btn.destroy:hover{
190   - background: #ff7373;
191   - }
192   -
193   - .sub_lines>span.line_btn:hover{
194   - background: #2dd7ed;
195   - }
196   - .add_line_icon{
197   - cursor: pointer;
198   - padding: 2px 5px;
199   - border-radius: 5px;
200   - display: inline-block;
201   - }
202   - .add_line_icon>i{
203   - vertical-align: top;
204   - margin-top: 3px;
205   - }
206   - .add_line_icon:hover{
207   - background: #ededed;
208   - }
209   - .ct_pattern_form{
210   - display: inline-block;
211   - }
212   - .xd_menu_grid{
213   - padding: 25px 25px 0 25px;
214   - height: calc(63% - 91px);
215   - }
216   - .xd_menu_grid .uk-list{
217   - border: 1px solid #ededed;
218   - height: calc(100% - 70px);
219   - overflow: auto;
220   - position: relative;
221   - }
222   -
223   - .xd_menu_grid .uk-list>li{
224   - margin: 5px 0 !important;
225   - padding: 10px 0 0 10px !important;
226   - font-size: 14px;
227   - }
228   - .top_tools{
229   - position: absolute;
230   - top: 15px;
231   - right: 25px;
232   - }
233   - .ct_field {
234   - display: inline-block;
235   - width: 240px;
236   - }
237   - .ct_field>select,.ct_field>input{
238   - width: calc(100% - 60px);
239   - }
240   - .line_checkbox_list{
241   - margin-top: 15px;
242   - }
243   - .line_checkbox_list>.btn{
244   - padding: 5px 7px;
245   - border-radius: 2px;
246   - display: inline-block;
247   - margin: 4px 9px;
248   - font-size: 14px;
249   - font-family: 微软雅黑;
250   - border: 1px solid #d9d9d9;
251   - width: 100px;
252   - overflow: hidden;
253   - text-overflow: ellipsis;
254   - white-space: nowrap;
255   - }
256   - .line_checkbox_list>.btn>input{
257   - margin-right: 5px;
258   - }
259   - .line_checkbox_list>.btn.active{
260   - background: #1e87f0;
261   - color: #fff;
262   - }
263   -
264   - .line_checkbox_list>.btn.destroy,
265   - .line_checkbox_list>.btn.destroy>input{
266   - border-color: #ff9595;
267   - color: #ff5c5c;
268   - }
269   -
270   - .line_checkbox_list>.btn.destroy.active{
271   - background: #ff5c5c;
272   - color: #fff;
273   - }
274   -
275   - .line_checkbox_list>.btn.destroy.active>input{
276   - background-color: #ff5c5c !important;
277   - border-color: #ff5c5c !important;
278   - }
279   -
280   - #role_authorize_wrap .ztree *{
281   - font-size: 14px;
282   - }
283   - #role_authorize_wrap .ztree li{
284   - line-height: 21px;
285   - }
286   - .loading{
287   - height: 100%;
288   - text-align: center;
289   - }
290   - .loading .uk-spinner{
291   - margin-top: 200px;
292   - }
293   - .loading circle{
294   - stroke: red;
295   - }
296   -
297   - #select_line_modal .uk-checkbox:checked {
298   - background-color: #1e87f0;
299   - }
300   - </style>
301   -</head>
302   -
303   -<body>
304   -<div class="loading">
305   - <div uk-spinner></div>
306   -</div>
307   -<div class="ct_page" style="display: none;">
308   - <h2 class="uk-heading-line uk-heading-bullet"><span>用户授权管理</span></h2>
309   - <div class="ct_cont uk-grid-small uk-child-width-expand" uk-grid>
310   - <div class="role_list uk-width-1-4 ">
311   - <div class="uk-card uk-card-default">
312   - <form>
313   - <div class="uk-margin">
314   - <div class="uk-inline" >
315   - <!--<span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span>-->
316   - <!--<input class="uk-input role_search_input" type="text" placeholder="搜索角色">-->
317   - </div>
318   - </div>
319   - </form>
320   -
321   - <div class="ct-card-body" >
322   - <ul class="uk-list uk-list-large uk-list-divider role-list">
323   - </ul>
324   - </div>
325   - </div>
326   - </div>
327   - <div class="user_list uk-width-1-5 ">
328   - <div class="uk-card uk-card-default">
329   - <form>
330   - <div class="uk-margin">
331   - <div class="uk-inline" >
332   - <!--<span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span>-->
333   - <!--<input class="uk-input user_search_input" type="text" placeholder="搜索用户">-->
334   - </div>
335   - </div>
336   - </form>
337   -
338   - <div class="ct-card-body">
339   - <ul class="uk-list uk-list-large user-list">
340   - </ul>
341   - </div>
342   - </div>
343   - </div>
344   - <div class="auth_cont ">
345   - <div class="uk-card uk-card-default authorize_right_cont">
346   -
347   - </div>
348   - </div>
349   - </div>
350   -</div>
351   -
352   -<script id="authorize-role-list-temp" type="text/html">
353   - {{each list as r i}}
354   - <li data-id="{{r.id}}" data-name="{{r.roleName}}" data-code="{{r.codeUp}}">{{r.roleName}}
355   - <span class="role-code">{{r.codeName}}</span>
356   - <div class="ct_li_desc">{{r.createDateStr}}</div>
357   - <span class="uk-badge">{{r.count}}</span>
358   - </li>
359   - {{/each}}
360   -</script>
361   -<script id="authorize-user-list-temp" type="text/html">
362   - {{each list as u i}}
363   - <li class="uk-animation-fade uk-animation-fast" data-name="{{u.name}}" data-code="{{u.userNameUp}}" data-id="{{u.id}}">{{u.name}}<span class="role-code">{{u.userName}}</span></li>
364   - {{/each}}
365   -</script>
366   -<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
367   -<script src="/assets/js/common.js"></script>
368   -<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
369   -<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
370   -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
371   -<!-- EventProxy -->
372   -<script src="/assets/js/eventproxy.js"></script>
373   -<!-- art-template 模版引擎 -->
374   -<script src="/assets/plugins/template.js"></script>
375   -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
376   -<script src="/assets/plugins/ztree_v3/js/jquery.ztree.core.min.js"></script>
377   -<script src="/assets/plugins/ztree_v3/js/jquery.ztree.excheck.min.js"></script>
378   -<script>
379   - var storage = window.localStorage;
380   -
381   - if (typeof String.prototype.startsWith != 'function') {
382   - String.prototype.startsWith = function (prefix){
383   - return this.slice(0, prefix.length) === prefix;
384   - };
385   - }
386   - var roles,users,role_users,modules,companyData,lineArray;
387   -
388   - var ep = EventProxy.create('query_roles', 'query_users', 'query_modules', 'query_company', 'query_line', function (rs, us, ms, cs, lines) {
389   - roles = rs;
390   - users = us;
391   - modules = ms;
392   - companyData = cs;
393   - lineArray=lines;
394   - role_users = {};
395   - debugger
396   - for(var i=0,r;r=roles[i++];){
397   - r.count=0;
398   - role_users[r.id]=[];
399   - r.createDateStr=moment(r.createDate).format('YYYY-MM-DD HH:ss');
400   - r.codeUp=r.codeName.toUpperCase();
401   - for(var j=0,u;u=users[j++];){
402   - if(u.roles.indexOf(r.id)!=-1){
403   - r.count++;
404   - role_users[r.id].push(u);
405   - }
406   - }
407   - }
408   - //渲染角色list
409   - render_role_list(roles);
410   - //渲染用户list
411   - render_user_list(users);
412   -
413   - $('.loading').remove();
414   - $('.ct_page').show();
415   - });
416   -
417   - //角色点击
418   - $('ul.role-list').on('click', 'li', roleClickHanlder);
419   - //用户点击
420   - $('ul.user-list').on('click', 'li', userClickHanlder);
421   -
422   -
423   - function roleClickHanlder() {
424   - if($(this).hasClass('active') && $('ul.user-list>li.active').length==0)
425   - return;
426   -
427   - reset_dom();
428   - $('ul.role-list>li.active').removeClass('active');
429   - $(this).addClass('active');
430   - //重新渲染用户list
431   - var id = $(this).data('id');
432   - render_user_list(role_users[id]);
433   - //加载角色授权页面
434   - $('.authorize_right_cont').load('/pages/permission/authorize_all/role_auth.html', function () {
435   - $('#role_authorize_wrap', this).trigger('init', {role: get_role(id), modules: modules, companyData: companyData});
436   - });
437   - }
438   -
439   - function userClickHanlder() {
440   - if($(this).hasClass('active'))
441   - return;
442   -
443   - reset_dom();
444   - $('ul.user-list>li.active').removeClass('active');
445   - $(this).addClass('active');
446   -
447   - //加载用户授权页面
448   - var id = $(this).data('id');
449   - $('.authorize_right_cont').load('/pages/permission/authorize_all/user_auth.html', function () {
450   - $('#user_authorize_wrap', this).trigger('init', {user: get_user(id),lineArray:lineArray, companyData:companyData});
451   - });
452   - }
453   -
454   - //refresh-user
455   - $('.authorize_right_cont').on('refresh-user', function () {
456   - $('ul.user-list>li.active').removeClass('active').trigger('click');
457   - });
458   -
459   - function reset_dom() {
460   - $('#select_line_modal').remove();
461   - }
462   -
463   - //滚动条
464   - $('.ct_page .uk-card .ct-card-body').perfectScrollbar({suppressScrollX: true});
465   -
466   - //query all role
467   - var paramsRole = {};
468   - paramsRole['codeName'] = 'ROLE_ADMIN';
469   - var userId=storage.getItem("editUser");
470   - $get('/user',{id_eq:userId}, function (rs) {
471   - debugger
472   - //if (rs)
473   - ep.emit('query_roles', rs.content[0].roles);
474   - });
475   -
476   -
477   - //query all user
478   - var paramsUser = {};
479   - paramsRole['name'] = 'name';
480   - $.get('/user/all_distinct',paramsUser, function (rs) {
481   - var userA={};
482   - for(var i=0,u;u=rs[i++];){
483   - if (u.id==userId){
484   - discard_field(u);
485   - u.userNameUp=u.userName.toUpperCase();
486   - u.lastLoginDateStr=moment(u.lastLoginDate).format('YYYY-MM-DD HH:ss');
487   - userA[0]=u;
488   - }
489   - }
490   - ep.emit('query_users', userA);
491   - });
492   -
493   - //query all modules
494   - $.get('/module/all_distinct', function (rs) {
495   - ep.emit('query_modules', rs);
496   - });
497   -
498   - //query all company data
499   - $.get('/business/all', function (rs) {
500   - ep.emit('query_company', rs);
501   - });
502   -
503   - //query all line
504   - $.get('/line/all', {'remove_ne': 1}, function (rs) {
505   - ep.emit('query_line', rs);
506   - });
507   -
508   - function discard_field(u) {
509   - var array = [];
510   - $.each(u.roles, function () {
511   - array.push(this.id);
512   - });
513   - u.roles = array;
514   - }
515   -
516   - function render_role_list(list) {
517   - var htmlStr = template('authorize-role-list-temp', {list: list});
518   - $('ul.role-list').html(htmlStr);
519   - up_scroll();
520   - }
521   -
522   -
523   - function render_user_list(list) {
524   - var htmlStr = template('authorize-user-list-temp', {list: list});
525   - $('ul.user-list').html(htmlStr);
526   - up_scroll();
527   - }
528   -
529   - function reset_role_list(){
530   - var actives = $('ul.role-list>li.active');
531   - if(actives.length > 0){
532   - $('ul.role-list>li.active').removeClass('active');
533   - render_user_list(users);
534   - $('.authorize_right_cont').empty();
535   - }
536   - }
537   -
538   - function up_scroll() {
539   - $('.ct_page .uk-card .ct-card-body').perfectScrollbar('update');
540   - }
541   -
542   -
543   -
544   - function get_role(id) {
545   - for(var i=0,r;r=roles[i++];){
546   - if(r.id==id)
547   - return r;
548   - }
549   - return null;
550   - }
551   -
552   - function get_user(id) {
553   - for(var i=0,u;u=users[i++];){
554   - if(u.id==id)
555   - return u;
556   - }
557   - return null;
558   - }
559   -
560   - $(document).on('submit', 'form', function () {
561   - return false;
562   - });
563   -
564   - function convert_buss_data(rs) {
565   - var baseCode;
566   - //找到跟节点
567   - $.each(rs, function () {
568   - if(this.upCode == 0){
569   - baseCode=this.businessCode;
570   - return false;
571   - }
572   - });
573   - if(!baseCode){
574   - alert('大爷找不到根节点,数据有问题吧!!!');
575   - return;
576   - }
577   - //提取二级节点
578   - var secondMap={};
579   - $.each(rs, function () {
580   - if(this.upCode==baseCode){
581   - secondMap[this.businessCode] = {
582   - name: this.businessName,
583   - childs: []
584   - };
585   - }
586   - });
587   - //分公司节点
588   - $.each(rs, function () {
589   - if(secondMap[this.upCode])
590   - secondMap[this.upCode].childs.push(this);
591   - });
592   -
593   - //排序
594   - for(var sid in secondMap){
595   - secondMap[sid].childs.sort(naturalSort);
596   - }
597   -
598   - return secondMap;
599   - }
600   -
601   - var naturalSort=function (a, b) {
602   - return a.businessName.localeCompare(b.businessName);
603   - };
604   -
605   - var groupBy = function (list, field) {
606   - var rs = {},
607   - key;
608   - $.each(list, function () {
609   - key = this[field];
610   - if (!rs[key])
611   - rs[key] = [];
612   -
613   - rs[key].push(this);
614   - });
615   -
616   - return rs;
617   - };
618   -</script>
619   -</body>
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
  7 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  8 + <link rel="stylesheet" href="/assets/plugins/ztree_v3/css/zTreeStyle/zTreeStyle.css" />
  9 + <style>
  10 + html,body{
  11 + height: 100%;
  12 + }
  13 + .ct_page{
  14 + padding: 25px 15px;
  15 + height: 100%;
  16 + height: calc(100% - 50px);
  17 + }
  18 +
  19 + .ct_cont{
  20 + height: calc(100% - 41px);
  21 + }
  22 +
  23 + .ct_cont>div>div.uk-card{
  24 + height: 99%;
  25 + }
  26 +
  27 + form .uk-inline{
  28 + width: calc(100% - 4px);
  29 + margin-left: 2px;
  30 + }
  31 +
  32 + .ct-card-body{
  33 + overflow: auto;
  34 + padding: 1px 1px 0 2px;
  35 + height: calc(100% - 54px);
  36 + position: relative;
  37 + margin-top: -12px;
  38 + }
  39 +
  40 + .ct_li_desc{
  41 + color: #a8a8a8;
  42 + font-size: 13px;
  43 + }
  44 +
  45 + .ct-card-body .uk-list-large{
  46 + font-size: 14px;
  47 + }
  48 +
  49 + .ct-card-body .uk-list-large>li{
  50 + cursor: default;
  51 + padding-left: 20px;
  52 + margin-top: 2px !important;
  53 + padding-top: 17px !important;
  54 + position: relative;
  55 + }
  56 +
  57 + .ct-card-body .uk-list-large>li:hover{
  58 + background: #edecec;
  59 + }
  60 +
  61 + .ct-card-body .uk-list-large>li.active{
  62 + background: #1e87f0 !important;
  63 + color: white;
  64 + }
  65 +
  66 + .ct-card-body .uk-list-large>li.active>span.role-code{
  67 + color: #ffffff;
  68 + }
  69 +
  70 + .ct-card-body .uk-list-large.role-list>li:hover{
  71 + background: #fff494;
  72 + }
  73 +
  74 + .ct-card-body .uk-list-large>li.active .ct_li_desc{
  75 + color: #e6e6e6;
  76 + }
  77 +
  78 + .ct-card-body .uk-list-large>li>span.uk-badge{
  79 + position: absolute;
  80 + top: 17px;
  81 + right: 25px;
  82 + }
  83 +
  84 + .ct-card-body .uk-list-large>li>span.role-code{
  85 + padding: 4px 6px;
  86 + color: #a8a8a8;
  87 + margin-left: 5px;
  88 + }
  89 +
  90 + .top_title{
  91 + padding: 9px 0 5px 15px;
  92 + border-bottom: 1px solid #ededed;
  93 + border-left: 5px solid #FFC107;
  94 + }
  95 +
  96 + .top_title>.desc{
  97 + font-size: 13px;
  98 + color: grey;
  99 + margin-top: 3px;
  100 + }
  101 +
  102 + .left_menu_list{
  103 + overflow: auto;
  104 + position: relative;
  105 + }
  106 +
  107 + .left_menu_list .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{
  108 + opacity: 0.6 !important;
  109 + padding: 0 !important;
  110 + }
  111 +
  112 + ._company{
  113 + margin: 15px 0px;
  114 + }
  115 + ._company>h5{
  116 + margin-bottom: 10px;
  117 + font-size: 15px;
  118 + color: #6b6b6b;
  119 + text-indent: 12px;
  120 + }
  121 + ._company>._fgs>label{
  122 + padding: 3px 12px 3px 10px;
  123 + display: inline-block;
  124 + border: 1px solid gainsboro;
  125 + border-radius: 2px;
  126 + margin: 5px;
  127 + font-size: 14px;
  128 + }
  129 + ._company>._fgs>label.active{
  130 + background: #1e87f0;
  131 + color: #fff;
  132 + }
  133 + ._company .uk-checkbox:checked:focus,
  134 + .line_checkbox_list .uk-checkbox:checked:focus{
  135 + background-color: #1e87f0 !important;
  136 + }
  137 + .save_icon{
  138 + position: absolute;
  139 + right: 2px;
  140 + background: #bec4c9;
  141 + font-size: 12px;
  142 + padding: 2px 15px;
  143 + color: #fff;
  144 + box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  145 + cursor: pointer;
  146 + }
  147 + .save_icon:hover{
  148 + background: #FFC107;
  149 + }
  150 + .data_auth_list{
  151 + position: relative;
  152 + }
  153 + #user_authorize_wrap .top_title{
  154 + border-left: 5px solid #cacac8;
  155 + }
  156 + .xd_line_list{
  157 + height: 37%;
  158 + padding: 7px;
  159 + border-bottom: 1px solid #f2f2f2;
  160 + overflow: auto;
  161 + position: relative;
  162 + }
  163 + .xd_line_list>h5{
  164 + color: #858585;
  165 + margin: 5px 5px 5px 0;
  166 + font-size: 14px;
  167 + }
  168 + .sub_lines{
  169 + padding-left: 15px;
  170 + }
  171 + .sub_lines>span.line_btn {
  172 + background: #00BCD4;
  173 + color: #fff;
  174 + padding: 4px 9px;
  175 + display: inline-block;
  176 + min-width: 68px;
  177 + text-align: center;
  178 + margin: 5px 2px;
  179 + box-shadow: 0 5px 9px rgba(0,0,0,0.08);
  180 + cursor: pointer;
  181 + font-size: 14px;
  182 + font-family: 微软雅黑;
  183 + }
  184 +
  185 + .sub_lines>span.line_btn.destroy{
  186 + background: #ff5c5c;
  187 + }
  188 +
  189 + .sub_lines>span.line_btn.destroy:hover{
  190 + background: #ff7373;
  191 + }
  192 +
  193 + .sub_lines>span.line_btn:hover{
  194 + background: #2dd7ed;
  195 + }
  196 + .add_line_icon{
  197 + cursor: pointer;
  198 + padding: 2px 5px;
  199 + border-radius: 5px;
  200 + display: inline-block;
  201 + }
  202 + .add_line_icon>i{
  203 + vertical-align: top;
  204 + margin-top: 3px;
  205 + }
  206 + .add_line_icon:hover{
  207 + background: #ededed;
  208 + }
  209 + .ct_pattern_form{
  210 + display: inline-block;
  211 + }
  212 + .xd_menu_grid{
  213 + padding: 25px 25px 0 25px;
  214 + height: calc(63% - 91px);
  215 + }
  216 + .xd_menu_grid .uk-list{
  217 + border: 1px solid #ededed;
  218 + height: calc(100% - 70px);
  219 + overflow: auto;
  220 + position: relative;
  221 + }
  222 +
  223 + .xd_menu_grid .uk-list>li{
  224 + margin: 5px 0 !important;
  225 + padding: 10px 0 0 10px !important;
  226 + font-size: 14px;
  227 + }
  228 + .top_tools{
  229 + position: absolute;
  230 + top: 15px;
  231 + right: 25px;
  232 + }
  233 + .ct_field {
  234 + display: inline-block;
  235 + width: 240px;
  236 + }
  237 + .ct_field>select,.ct_field>input{
  238 + width: calc(100% - 60px);
  239 + }
  240 + .line_checkbox_list{
  241 + margin-top: 15px;
  242 + }
  243 + .line_checkbox_list>.btn{
  244 + padding: 5px 7px;
  245 + border-radius: 2px;
  246 + display: inline-block;
  247 + margin: 4px 9px;
  248 + font-size: 14px;
  249 + font-family: 微软雅黑;
  250 + border: 1px solid #d9d9d9;
  251 + width: 100px;
  252 + overflow: hidden;
  253 + text-overflow: ellipsis;
  254 + white-space: nowrap;
  255 + }
  256 + .line_checkbox_list>.btn>input{
  257 + margin-right: 5px;
  258 + }
  259 + .line_checkbox_list>.btn.active{
  260 + background: #1e87f0;
  261 + color: #fff;
  262 + }
  263 +
  264 + .line_checkbox_list>.btn.destroy,
  265 + .line_checkbox_list>.btn.destroy>input{
  266 + border-color: #ff9595;
  267 + color: #ff5c5c;
  268 + }
  269 +
  270 + .line_checkbox_list>.btn.destroy.active{
  271 + background: #ff5c5c;
  272 + color: #fff;
  273 + }
  274 +
  275 + .line_checkbox_list>.btn.destroy.active>input{
  276 + background-color: #ff5c5c !important;
  277 + border-color: #ff5c5c !important;
  278 + }
  279 +
  280 + #role_authorize_wrap .ztree *{
  281 + font-size: 14px;
  282 + }
  283 + #role_authorize_wrap .ztree li{
  284 + line-height: 21px;
  285 + }
  286 + .loading{
  287 + height: 100%;
  288 + text-align: center;
  289 + }
  290 + .loading .uk-spinner{
  291 + margin-top: 200px;
  292 + }
  293 + .loading circle{
  294 + stroke: red;
  295 + }
  296 +
  297 + #select_line_modal .uk-checkbox:checked {
  298 + background-color: #1e87f0;
  299 + }
  300 + </style>
  301 +</head>
  302 +
  303 +<body>
  304 +<div class="loading">
  305 + <div uk-spinner></div>
  306 +</div>
  307 +<div class="ct_page" style="display: none;">
  308 + <h2 class="uk-heading-line uk-heading-bullet"><span>用户授权管理</span></h2>
  309 + <div class="ct_cont uk-grid-small uk-child-width-expand" uk-grid>
  310 + <div class="role_list uk-width-1-4 ">
  311 + <div class="uk-card uk-card-default">
  312 + <form>
  313 + <div class="uk-margin">
  314 + <div class="uk-inline" >
  315 + </div>
  316 + </div>
  317 + </form>
  318 +
  319 + <div class="ct-card-body" >
  320 + <ul class="uk-list uk-list-large uk-list-divider role-list">
  321 + </ul>
  322 + </div>
  323 + </div>
  324 + </div>
  325 + <div class="user_list uk-width-1-5 ">
  326 + <div class="uk-card uk-card-default">
  327 + <form>
  328 + <div class="uk-margin">
  329 + <div class="uk-inline" >
  330 + </div>
  331 + </div>
  332 + </form>
  333 +
  334 + <div class="ct-card-body">
  335 + <ul class="uk-list uk-list-large user-list">
  336 + </ul>
  337 + </div>
  338 + </div>
  339 + </div>
  340 + <div class="auth_cont ">
  341 + <div class="uk-card uk-card-default authorize_right_cont">
  342 +
  343 + </div>
  344 + </div>
  345 + </div>
  346 +</div>
  347 +
  348 +<script id="authorize-role-list-temp1" type="text/html">
  349 + {{each list as r i}}
  350 + <li data-id="{{r.id}}" data-name="{{r.roleName}}" data-code="{{r.codeUp}}">{{r.roleName}}
  351 + <span class="role-code">{{r.codeName}}</span>
  352 + <div class="ct_li_desc">{{r.createDateStr}}</div>
  353 + <span class="uk-badge">{{r.count}}</span>
  354 + </li>
  355 + {{/each}}
  356 +</script>
  357 +<script id="authorize-user-list-temp1" type="text/html">
  358 + {{each list as u i}}
  359 + <li class="uk-animation-fade uk-animation-fast" data-name="{{u.name}}" data-code="{{u.userNameUp}}" data-id="{{u.id}}">{{u.name}}<span class="role-code">{{u.userName}}</span></li>
  360 + {{/each}}
  361 +</script>
  362 +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
  363 +<script src="/assets/js/common.js"></script>
  364 +<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
  365 +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
  366 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  367 +<!-- EventProxy -->
  368 +<script src="/assets/js/eventproxy.js"></script>
  369 +<!-- art-template 模版引擎 -->
  370 +<script src="/assets/plugins/template.js"></script>
  371 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  372 +<script src="/assets/plugins/ztree_v3/js/jquery.ztree.core.min.js"></script>
  373 +<script src="/assets/plugins/ztree_v3/js/jquery.ztree.excheck.min.js"></script>
  374 +<script>
  375 + var storage = window.localStorage;
  376 +
  377 + if (typeof String.prototype.startsWith != 'function') {
  378 + String.prototype.startsWith = function (prefix){
  379 + return this.slice(0, prefix.length) === prefix;
  380 + };
  381 + }
  382 + var roles,users,role_users,modules,companyData,lineArray;
  383 +
  384 + var ep = EventProxy.create('query_roles', 'query_users', 'query_modules', 'query_company', 'query_line', function (rs, us, ms, cs, lines) {
  385 + roles = rs;
  386 + users = us;
  387 + modules = ms;
  388 + companyData = cs;
  389 + lineArray=lines;
  390 + role_users = {};
  391 + debugger
  392 + for(var i=0,r;r=roles[i++];){
  393 + r.count=0;
  394 + role_users[r.id]=[];
  395 + r.createDateStr=moment(r.createDate).format('YYYY-MM-DD HH:ss');
  396 + r.codeUp=r.codeName.toUpperCase();
  397 + for(var j=0,u;u=users[j++];){
  398 + if(u.roles.indexOf(r.id)!=-1){
  399 + r.count++;
  400 + role_users[r.id].push(u);
  401 + }
  402 + }
  403 + }
  404 + //渲染角色list
  405 + render_role_list(roles);
  406 + //渲染用户list
  407 + render_user_list(users);
  408 +
  409 + $('.loading').remove();
  410 + $('.ct_page').show();
  411 + });
  412 +
  413 + //角色点击
  414 + $('ul.role-list').on('click', 'li', roleClickHanlder);
  415 + //用户点击
  416 + $('ul.user-list').on('click', 'li', userClickHanlder);
  417 +
  418 +
  419 + function roleClickHanlder() {
  420 + if($(this).hasClass('active') && $('ul.user-list>li.active').length==0)
  421 + return;
  422 +
  423 + reset_dom();
  424 + $('ul.role-list>li.active').removeClass('active');
  425 + $(this).addClass('active');
  426 + //重新渲染用户list
  427 + var id = $(this).data('id');
  428 + render_user_list(role_users[id]);
  429 + //加载角色授权页面
  430 + $('.authorize_right_cont').load('/pages/permission/authorize_all/role_auth.html', function () {
  431 + $('#role_authorize_wrap', this).trigger('init', {role: get_role(id), modules: modules, companyData: companyData});
  432 + });
  433 + }
  434 +
  435 + function userClickHanlder() {
  436 + if($(this).hasClass('active'))
  437 + return;
  438 +
  439 + reset_dom();
  440 + $('ul.user-list>li.active').removeClass('active');
  441 + $(this).addClass('active');
  442 +
  443 + //加载用户授权页面
  444 + var id = $(this).data('id');
  445 + $('.authorize_right_cont').load('/pages/permission/authorize_all/user_auth.html', function () {
  446 + $('#user_authorize_wrap', this).trigger('init', {user: get_user(id),lineArray:lineArray, companyData:companyData});
  447 + });
  448 + }
  449 +
  450 + //refresh-user
  451 + $('.authorize_right_cont').on('refresh-user', function () {
  452 + $('ul.user-list>li.active').removeClass('active').trigger('click');
  453 + });
  454 +
  455 + function reset_dom() {
  456 + $('#select_line_modal').remove();
  457 + }
  458 +
  459 + //滚动条
  460 + $('.ct_page .uk-card .ct-card-body').perfectScrollbar({suppressScrollX: true});
  461 +
  462 + //query all role
  463 + var paramsRole = {};
  464 + paramsRole['codeName'] = 'ROLE_ADMIN';
  465 + var userId=storage.getItem("editUser");
  466 + $get('/user',{id_eq:userId}, function (rs) {
  467 + debugger
  468 + //if (rs)
  469 + ep.emit('query_roles', rs.content[0].roles);
  470 + });
  471 +
  472 +
  473 + //query all user
  474 + var paramsUser = {};
  475 + paramsRole['name'] = 'name';
  476 + $.get('/user/all_distinct',paramsUser, function (rs) {
  477 + var userA={};
  478 + for(var i=0,u;u=rs[i++];){
  479 + if (u.id==userId){
  480 + discard_field(u);
  481 + u.userNameUp=u.userName.toUpperCase();
  482 + u.lastLoginDateStr=moment(u.lastLoginDate).format('YYYY-MM-DD HH:ss');
  483 + userA[0]=u;
  484 + }
  485 + }
  486 + ep.emit('query_users', userA);
  487 + });
  488 +
  489 + //query all modules
  490 + $.get('/module/all_distinct', function (rs) {
  491 + ep.emit('query_modules', rs);
  492 + });
  493 +
  494 + //query all company data
  495 + $.get('/business/all', function (rs) {
  496 + ep.emit('query_company', rs);
  497 + });
  498 +
  499 + //query all line
  500 + $.get('/line/all', {'remove_ne': 1}, function (rs) {
  501 + ep.emit('query_line', rs);
  502 + });
  503 +
  504 + function discard_field(u) {
  505 + var array = [];
  506 + $.each(u.roles, function () {
  507 + array.push(this.id);
  508 + });
  509 + u.roles = array;
  510 + }
  511 +
  512 + function render_role_list(list) {
  513 + var htmlStr = template('authorize-role-list-temp1', {list: list});
  514 + $('ul.role-list').html(htmlStr);
  515 + up_scroll();
  516 + }
  517 +
  518 +
  519 + function render_user_list(list) {
  520 + var htmlStr = template('authorize-user-list-temp1', {list: list});
  521 + $('ul.user-list').html(htmlStr);
  522 + up_scroll();
  523 + }
  524 +
  525 + function reset_role_list(){
  526 + var actives = $('ul.role-list>li.active');
  527 + if(actives.length > 0){
  528 + $('ul.role-list>li.active').removeClass('active');
  529 + render_user_list(users);
  530 + $('.authorize_right_cont').empty();
  531 + }
  532 + }
  533 +
  534 + function up_scroll() {
  535 + $('.ct_page .uk-card .ct-card-body').perfectScrollbar('update');
  536 + }
  537 +
  538 +
  539 +
  540 + function get_role(id) {
  541 + for(var i=0,r;r=roles[i++];){
  542 + if(r.id==id)
  543 + return r;
  544 + }
  545 + return null;
  546 + }
  547 +
  548 + function get_user(id) {
  549 + for(var i=0,u;u=users[i++];){
  550 + if(u.id==id)
  551 + return u;
  552 + }
  553 + return null;
  554 + }
  555 +
  556 + $(document).on('submit', 'form', function () {
  557 + return false;
  558 + });
  559 +
  560 + function convert_buss_data(rs) {
  561 + var baseCode;
  562 + //找到跟节点
  563 + $.each(rs, function () {
  564 + if(this.upCode == 0){
  565 + baseCode=this.businessCode;
  566 + return false;
  567 + }
  568 + });
  569 + if(!baseCode){
  570 + alert('大爷找不到根节点,数据有问题吧!!!');
  571 + return;
  572 + }
  573 + //提取二级节点
  574 + var secondMap={};
  575 + $.each(rs, function () {
  576 + if(this.upCode==baseCode){
  577 + secondMap[this.businessCode] = {
  578 + name: this.businessName,
  579 + childs: []
  580 + };
  581 + }
  582 + });
  583 + //分公司节点
  584 + $.each(rs, function () {
  585 + if(secondMap[this.upCode])
  586 + secondMap[this.upCode].childs.push(this);
  587 + });
  588 +
  589 + //排序
  590 + for(var sid in secondMap){
  591 + secondMap[sid].childs.sort(naturalSort);
  592 + }
  593 +
  594 + return secondMap;
  595 + }
  596 +
  597 + var naturalSort=function (a, b) {
  598 + return a.businessName.localeCompare(b.businessName);
  599 + };
  600 +
  601 + var groupBy = function (list, field) {
  602 + var rs = {},
  603 + key;
  604 + $.each(list, function () {
  605 + key = this[field];
  606 + if (!rs[key])
  607 + rs[key] = [];
  608 +
  609 + rs[key].push(this);
  610 + });
  611 +
  612 + return rs;
  613 + };
  614 +</script>
  615 +</body>
620 616 </html>
621 617 \ No newline at end of file
... ...
src/main/resources/static/pages/report/inoutstation/js/Blob.js
1   -/* Blob.js
2   - * A Blob implementation.
3   - * 2014-07-24
4   - *
5   - * By Eli Grey, http://eligrey.com
6   - * By Devin Samarin, https://github.com/dsamarin
7   - * License: X11/MIT
8   - * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md
9   - */
10   -
11   -/*global self, unescape */
12   -/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
13   - plusplus: true */
14   -
15   -/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
16   -
17   -(function (view) {
18   - "use strict";
19   -
20   - view.URL = view.URL || view.webkitURL;
21   -
22   - if (view.Blob && view.URL) {
23   - try {
24   - new Blob;
25   - return;
26   - } catch (e) {}
27   - }
28   -
29   - // Internally we use a BlobBuilder implementation to base Blob off of
30   - // in order to support older browsers that only have BlobBuilder
31   - var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
32   - var
33   - get_class = function(object) {
34   - return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
35   - }
36   - , FakeBlobBuilder = function BlobBuilder() {
37   - this.data = [];
38   - }
39   - , FakeBlob = function Blob(data, type, encoding) {
40   - this.data = data;
41   - this.size = data.length;
42   - this.type = type;
43   - this.encoding = encoding;
44   - }
45   - , FBB_proto = FakeBlobBuilder.prototype
46   - , FB_proto = FakeBlob.prototype
47   - , FileReaderSync = view.FileReaderSync
48   - , FileException = function(type) {
49   - this.code = this[this.name = type];
50   - }
51   - , file_ex_codes = (
52   - "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
53   - + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
54   - ).split(" ")
55   - , file_ex_code = file_ex_codes.length
56   - , real_URL = view.URL || view.webkitURL || view
57   - , real_create_object_URL = real_URL.createObjectURL
58   - , real_revoke_object_URL = real_URL.revokeObjectURL
59   - , URL = real_URL
60   - , btoa = view.btoa
61   - , atob = view.atob
62   -
63   - , ArrayBuffer = view.ArrayBuffer
64   - , Uint8Array = view.Uint8Array
65   -
66   - , origin = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/
67   - ;
68   - FakeBlob.fake = FB_proto.fake = true;
69   - while (file_ex_code--) {
70   - FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
71   - }
72   - // Polyfill URL
73   - if (!real_URL.createObjectURL) {
74   - URL = view.URL = function(uri) {
75   - var
76   - uri_info = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
77   - , uri_origin
78   - ;
79   - uri_info.href = uri;
80   - if (!("origin" in uri_info)) {
81   - if (uri_info.protocol.toLowerCase() === "data:") {
82   - uri_info.origin = null;
83   - } else {
84   - uri_origin = uri.match(origin);
85   - uri_info.origin = uri_origin && uri_origin[1];
86   - }
87   - }
88   - return uri_info;
89   - };
90   - }
91   - URL.createObjectURL = function(blob) {
92   - var
93   - type = blob.type
94   - , data_URI_header
95   - ;
96   - if (type === null) {
97   - type = "application/octet-stream";
98   - }
99   - if (blob instanceof FakeBlob) {
100   - data_URI_header = "data:" + type;
101   - if (blob.encoding === "base64") {
102   - return data_URI_header + ";base64," + blob.data;
103   - } else if (blob.encoding === "URI") {
104   - return data_URI_header + "," + decodeURIComponent(blob.data);
105   - } if (btoa) {
106   - return data_URI_header + ";base64," + btoa(blob.data);
107   - } else {
108   - return data_URI_header + "," + encodeURIComponent(blob.data);
109   - }
110   - } else if (real_create_object_URL) {
111   - return real_create_object_URL.call(real_URL, blob);
112   - }
113   - };
114   - URL.revokeObjectURL = function(object_URL) {
115   - if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
116   - real_revoke_object_URL.call(real_URL, object_URL);
117   - }
118   - };
119   - FBB_proto.append = function(data/*, endings*/) {
120   - var bb = this.data;
121   - // decode data to a binary string
122   - if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
123   - var
124   - str = ""
125   - , buf = new Uint8Array(data)
126   - , i = 0
127   - , buf_len = buf.length
128   - ;
129   - for (; i < buf_len; i++) {
130   - str += String.fromCharCode(buf[i]);
131   - }
132   - bb.push(str);
133   - } else if (get_class(data) === "Blob" || get_class(data) === "File") {
134   - if (FileReaderSync) {
135   - var fr = new FileReaderSync;
136   - bb.push(fr.readAsBinaryString(data));
137   - } else {
138   - // async FileReader won't work as BlobBuilder is sync
139   - throw new FileException("NOT_READABLE_ERR");
140   - }
141   - } else if (data instanceof FakeBlob) {
142   - if (data.encoding === "base64" && atob) {
143   - bb.push(atob(data.data));
144   - } else if (data.encoding === "URI") {
145   - bb.push(decodeURIComponent(data.data));
146   - } else if (data.encoding === "raw") {
147   - bb.push(data.data);
148   - }
149   - } else {
150   - if (typeof data !== "string") {
151   - data += ""; // convert unsupported types to strings
152   - }
153   - // decode UTF-16 to binary string
154   - bb.push(unescape(encodeURIComponent(data)));
155   - }
156   - };
157   - FBB_proto.getBlob = function(type) {
158   - if (!arguments.length) {
159   - type = null;
160   - }
161   - return new FakeBlob(this.data.join(""), type, "raw");
162   - };
163   - FBB_proto.toString = function() {
164   - return "[object BlobBuilder]";
165   - };
166   - FB_proto.slice = function(start, end, type) {
167   - var args = arguments.length;
168   - if (args < 3) {
169   - type = null;
170   - }
171   - return new FakeBlob(
172   - this.data.slice(start, args > 1 ? end : this.data.length)
173   - , type
174   - , this.encoding
175   - );
176   - };
177   - FB_proto.toString = function() {
178   - return "[object Blob]";
179   - };
180   - FB_proto.close = function() {
181   - this.size = 0;
182   - delete this.data;
183   - };
184   - return FakeBlobBuilder;
185   - }(view));
186   -
187   - view.Blob = function(blobParts, options) {
188   - var type = options ? (options.type || "") : "";
189   - var builder = new BlobBuilder();
190   - if (blobParts) {
191   - for (var i = 0, len = blobParts.length; i < len; i++) {
192   - builder.append(blobParts[i]);
193   - }
194   - }
195   - return builder.getBlob(type);
196   - };
197   -}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
  1 +/* Blob.js
  2 + * A Blob implementation.
  3 + * 2014-07-24
  4 + *
  5 + * By Eli Grey, http://eligrey.com
  6 + * By Devin Samarin, https://github.com/dsamarin
  7 + * License: X11/MIT
  8 + * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md
  9 + */
  10 +
  11 +/*global self, unescape */
  12 +/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
  13 + plusplus: true */
  14 +
  15 +/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
  16 +
  17 +(function (view) {
  18 + "use strict";
  19 +
  20 + view.URL = view.URL || view.webkitURL;
  21 +
  22 + if (view.Blob && view.URL) {
  23 + try {
  24 + new Blob;
  25 + return;
  26 + } catch (e) {}
  27 + }
  28 +
  29 + // Internally we use a BlobBuilder implementation to base Blob off of
  30 + // in order to support older browsers that only have BlobBuilder
  31 + var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
  32 + var
  33 + get_class = function(object) {
  34 + return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
  35 + }
  36 + , FakeBlobBuilder = function BlobBuilder() {
  37 + this.data = [];
  38 + }
  39 + , FakeBlob = function Blob(data, type, encoding) {
  40 + this.data = data;
  41 + this.size = data.length;
  42 + this.type = type;
  43 + this.encoding = encoding;
  44 + }
  45 + , FBB_proto = FakeBlobBuilder.prototype
  46 + , FB_proto = FakeBlob.prototype
  47 + , FileReaderSync = view.FileReaderSync
  48 + , FileException = function(type) {
  49 + this.code = this[this.name = type];
  50 + }
  51 + , file_ex_codes = (
  52 + "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
  53 + + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
  54 + ).split(" ")
  55 + , file_ex_code = file_ex_codes.length
  56 + , real_URL = view.URL || view.webkitURL || view
  57 + , real_create_object_URL = real_URL.createObjectURL
  58 + , real_revoke_object_URL = real_URL.revokeObjectURL
  59 + , URL = real_URL
  60 + , btoa = view.btoa
  61 + , atob = view.atob
  62 +
  63 + , ArrayBuffer = view.ArrayBuffer
  64 + , Uint8Array = view.Uint8Array
  65 +
  66 + , origin = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/
  67 + ;
  68 + FakeBlob.fake = FB_proto.fake = true;
  69 + while (file_ex_code--) {
  70 + FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
  71 + }
  72 + // Polyfill URL
  73 + if (!real_URL.createObjectURL) {
  74 + URL = view.URL = function(uri) {
  75 + var
  76 + uri_info = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
  77 + , uri_origin
  78 + ;
  79 + uri_info.href = uri;
  80 + if (!("origin" in uri_info)) {
  81 + if (uri_info.protocol.toLowerCase() === "data:") {
  82 + uri_info.origin = null;
  83 + } else {
  84 + uri_origin = uri.match(origin);
  85 + uri_info.origin = uri_origin && uri_origin[1];
  86 + }
  87 + }
  88 + return uri_info;
  89 + };
  90 + }
  91 + URL.createObjectURL = function(blob) {
  92 + var
  93 + type = blob.type
  94 + , data_URI_header
  95 + ;
  96 + if (type === null) {
  97 + type = "application/octet-stream";
  98 + }
  99 + if (blob instanceof FakeBlob) {
  100 + data_URI_header = "data:" + type;
  101 + if (blob.encoding === "base64") {
  102 + return data_URI_header + ";base64," + blob.data;
  103 + } else if (blob.encoding === "URI") {
  104 + return data_URI_header + "," + decodeURIComponent(blob.data);
  105 + } if (btoa) {
  106 + return data_URI_header + ";base64," + btoa(blob.data);
  107 + } else {
  108 + return data_URI_header + "," + encodeURIComponent(blob.data);
  109 + }
  110 + } else if (real_create_object_URL) {
  111 + return real_create_object_URL.call(real_URL, blob);
  112 + }
  113 + };
  114 + URL.revokeObjectURL = function(object_URL) {
  115 + if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
  116 + real_revoke_object_URL.call(real_URL, object_URL);
  117 + }
  118 + };
  119 + FBB_proto.append = function(data/*, endings*/) {
  120 + var bb = this.data;
  121 + // decode data to a binary string
  122 + if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
  123 + var
  124 + str = ""
  125 + , buf = new Uint8Array(data)
  126 + , i = 0
  127 + , buf_len = buf.length
  128 + ;
  129 + for (; i < buf_len; i++) {
  130 + str += String.fromCharCode(buf[i]);
  131 + }
  132 + bb.push(str);
  133 + } else if (get_class(data) === "Blob" || get_class(data) === "File") {
  134 + if (FileReaderSync) {
  135 + var fr = new FileReaderSync;
  136 + bb.push(fr.readAsBinaryString(data));
  137 + } else {
  138 + // async FileReader won't work as BlobBuilder is sync
  139 + throw new FileException("NOT_READABLE_ERR");
  140 + }
  141 + } else if (data instanceof FakeBlob) {
  142 + if (data.encoding === "base64" && atob) {
  143 + bb.push(atob(data.data));
  144 + } else if (data.encoding === "URI") {
  145 + bb.push(decodeURIComponent(data.data));
  146 + } else if (data.encoding === "raw") {
  147 + bb.push(data.data);
  148 + }
  149 + } else {
  150 + if (typeof data !== "string") {
  151 + data += ""; // convert unsupported types to strings
  152 + }
  153 + // decode UTF-16 to binary string
  154 + bb.push(unescape(encodeURIComponent(data)));
  155 + }
  156 + };
  157 + FBB_proto.getBlob = function(type) {
  158 + if (!arguments.length) {
  159 + type = null;
  160 + }
  161 + return new FakeBlob(this.data.join(""), type, "raw");
  162 + };
  163 + FBB_proto.toString = function() {
  164 + return "[object BlobBuilder]";
  165 + };
  166 + FB_proto.slice = function(start, end, type) {
  167 + var args = arguments.length;
  168 + if (args < 3) {
  169 + type = null;
  170 + }
  171 + return new FakeBlob(
  172 + this.data.slice(start, args > 1 ? end : this.data.length)
  173 + , type
  174 + , this.encoding
  175 + );
  176 + };
  177 + FB_proto.toString = function() {
  178 + return "[object Blob]";
  179 + };
  180 + FB_proto.close = function() {
  181 + this.size = 0;
  182 + delete this.data;
  183 + };
  184 + return FakeBlobBuilder;
  185 + }(view));
  186 +
  187 + view.Blob = function(blobParts, options) {
  188 + var type = options ? (options.type || "") : "";
  189 + var builder = new BlobBuilder();
  190 + if (blobParts) {
  191 + for (var i = 0, len = blobParts.length; i < len; i++) {
  192 + builder.append(blobParts[i]);
  193 + }
  194 + }
  195 + return builder.getBlob(type);
  196 + };
  197 +}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
... ...
src/main/resources/static/pages/report/inoutstation/js/FileSaver.js
1   -/* FileSaver.js
2   - * A saveAs() FileSaver implementation.
3   - * 2014-08-29
4   - *
5   - * By Eli Grey, http://eligrey.com
6   - * License: X11/MIT
7   - * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
8   - */
9   -
10   -/*global self */
11   -/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
12   -
13   -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
14   -
15   -var saveAs = saveAs
16   - // IE 10+ (native saveAs)
17   - || (typeof navigator !== "undefined" &&
18   - navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
19   - // Everyone else
20   - || (function(view) {
21   - "use strict";
22   - // IE <10 is explicitly unsupported
23   - if (typeof navigator !== "undefined" &&
24   - /MSIE [1-9]\./.test(navigator.userAgent)) {
25   - return;
26   - }
27   - var
28   - doc = view.document
29   - // only get URL when necessary in case Blob.js hasn't overridden it yet
30   - , get_URL = function() {
31   - return view.URL || view.webkitURL || view;
32   - }
33   - , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
34   - , can_use_save_link = "download" in save_link
35   - , click = function(node) {
36   - var event = doc.createEvent("MouseEvents");
37   - event.initMouseEvent(
38   - "click", true, false, view, 0, 0, 0, 0, 0
39   - , false, false, false, false, 0, null
40   - );
41   - node.dispatchEvent(event);
42   - }
43   - , webkit_req_fs = view.webkitRequestFileSystem
44   - , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
45   - , throw_outside = function(ex) {
46   - (view.setImmediate || view.setTimeout)(function() {
47   - throw ex;
48   - }, 0);
49   - }
50   - , force_saveable_type = "application/octet-stream"
51   - , fs_min_size = 0
52   - // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 for
53   - // the reasoning behind the timeout and revocation flow
54   - , arbitrary_revoke_timeout = 10
55   - , revoke = function(file) {
56   - var revoker = function() {
57   - if (typeof file === "string") { // file is an object URL
58   - get_URL().revokeObjectURL(file);
59   - } else { // file is a File
60   - file.remove();
61   - }
62   - };
63   - if (view.chrome) {
64   - revoker();
65   - } else {
66   - setTimeout(revoker, arbitrary_revoke_timeout);
67   - }
68   - }
69   - , dispatch = function(filesaver, event_types, event) {
70   - event_types = [].concat(event_types);
71   - var i = event_types.length;
72   - while (i--) {
73   - var listener = filesaver["on" + event_types[i]];
74   - if (typeof listener === "function") {
75   - try {
76   - listener.call(filesaver, event || filesaver);
77   - } catch (ex) {
78   - throw_outside(ex);
79   - }
80   - }
81   - }
82   - }
83   - , FileSaver = function(blob, name) {
84   - // First try a.download, then web filesystem, then object URLs
85   - var
86   - filesaver = this
87   - , type = blob.type
88   - , blob_changed = false
89   - , object_url
90   - , target_view
91   - , dispatch_all = function() {
92   - dispatch(filesaver, "writestart progress write writeend".split(" "));
93   - }
94   - // on any filesys errors revert to saving with object URLs
95   - , fs_error = function() {
96   - // don't create more object URLs than needed
97   - if (blob_changed || !object_url) {
98   - object_url = get_URL().createObjectURL(blob);
99   - }
100   - if (target_view) {
101   - target_view.location.href = object_url;
102   - } else {
103   - var new_tab = view.open(object_url, "_blank");
104   - if (new_tab == undefined && typeof safari !== "undefined") {
105   - //Apple do not allow window.open, see http://bit.ly/1kZffRI
106   - view.location.href = object_url
107   - }
108   - }
109   - filesaver.readyState = filesaver.DONE;
110   - dispatch_all();
111   - revoke(object_url);
112   - }
113   - , abortable = function(func) {
114   - return function() {
115   - if (filesaver.readyState !== filesaver.DONE) {
116   - return func.apply(this, arguments);
117   - }
118   - };
119   - }
120   - , create_if_not_found = {create: true, exclusive: false}
121   - , slice
122   - ;
123   - filesaver.readyState = filesaver.INIT;
124   - if (!name) {
125   - name = "download";
126   - }
127   - if (can_use_save_link) {
128   - object_url = get_URL().createObjectURL(blob);
129   - save_link.href = object_url;
130   - save_link.download = name;
131   - click(save_link);
132   - filesaver.readyState = filesaver.DONE;
133   - dispatch_all();
134   - revoke(object_url);
135   - return;
136   - }
137   - // Object and web filesystem URLs have a problem saving in Google Chrome when
138   - // viewed in a tab, so I force save with application/octet-stream
139   - // http://code.google.com/p/chromium/issues/detail?id=91158
140   - // Update: Google errantly closed 91158, I submitted it again:
141   - // https://code.google.com/p/chromium/issues/detail?id=389642
142   - if (view.chrome && type && type !== force_saveable_type) {
143   - slice = blob.slice || blob.webkitSlice;
144   - blob = slice.call(blob, 0, blob.size, force_saveable_type);
145   - blob_changed = true;
146   - }
147   - // Since I can't be sure that the guessed media type will trigger a download
148   - // in WebKit, I append .download to the filename.
149   - // https://bugs.webkit.org/show_bug.cgi?id=65440
150   - if (webkit_req_fs && name !== "download") {
151   - name += ".download";
152   - }
153   - if (type === force_saveable_type || webkit_req_fs) {
154   - target_view = view;
155   - }
156   - if (!req_fs) {
157   - fs_error();
158   - return;
159   - }
160   - fs_min_size += blob.size;
161   - req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
162   - fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
163   - var save = function() {
164   - dir.getFile(name, create_if_not_found, abortable(function(file) {
165   - file.createWriter(abortable(function(writer) {
166   - writer.onwriteend = function(event) {
167   - target_view.location.href = file.toURL();
168   - filesaver.readyState = filesaver.DONE;
169   - dispatch(filesaver, "writeend", event);
170   - revoke(file);
171   - };
172   - writer.onerror = function() {
173   - var error = writer.error;
174   - if (error.code !== error.ABORT_ERR) {
175   - fs_error();
176   - }
177   - };
178   - "writestart progress write abort".split(" ").forEach(function(event) {
179   - writer["on" + event] = filesaver["on" + event];
180   - });
181   - writer.write(blob);
182   - filesaver.abort = function() {
183   - writer.abort();
184   - filesaver.readyState = filesaver.DONE;
185   - };
186   - filesaver.readyState = filesaver.WRITING;
187   - }), fs_error);
188   - }), fs_error);
189   - };
190   - dir.getFile(name, {create: false}, abortable(function(file) {
191   - // delete file if it already exists
192   - file.remove();
193   - save();
194   - }), abortable(function(ex) {
195   - if (ex.code === ex.NOT_FOUND_ERR) {
196   - save();
197   - } else {
198   - fs_error();
199   - }
200   - }));
201   - }), fs_error);
202   - }), fs_error);
203   - }
204   - , FS_proto = FileSaver.prototype
205   - , saveAs = function(blob, name) {
206   - return new FileSaver(blob, name);
207   - }
208   - ;
209   - FS_proto.abort = function() {
210   - var filesaver = this;
211   - filesaver.readyState = filesaver.DONE;
212   - dispatch(filesaver, "abort");
213   - };
214   - FS_proto.readyState = FS_proto.INIT = 0;
215   - FS_proto.WRITING = 1;
216   - FS_proto.DONE = 2;
217   -
218   - FS_proto.error =
219   - FS_proto.onwritestart =
220   - FS_proto.onprogress =
221   - FS_proto.onwrite =
222   - FS_proto.onabort =
223   - FS_proto.onerror =
224   - FS_proto.onwriteend =
225   - null;
226   -
227   - return saveAs;
228   -}(
229   - typeof self !== "undefined" && self
230   - || typeof window !== "undefined" && window
231   - || this.content
232   -));
233   -// `self` is undefined in Firefox for Android content script context
234   -// while `this` is nsIContentFrameMessageManager
235   -// with an attribute `content` that corresponds to the window
236   -
237   -if (typeof module !== "undefined" && module !== null) {
238   - module.exports = saveAs;
239   -} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
240   - define([], function() {
241   - return saveAs;
242   - });
243   -}
  1 +/* FileSaver.js
  2 + * A saveAs() FileSaver implementation.
  3 + * 2014-08-29
  4 + *
  5 + * By Eli Grey, http://eligrey.com
  6 + * License: X11/MIT
  7 + * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
  8 + */
  9 +
  10 +/*global self */
  11 +/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
  12 +
  13 +/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
  14 +
  15 +var saveAs = saveAs
  16 + // IE 10+ (native saveAs)
  17 + || (typeof navigator !== "undefined" &&
  18 + navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
  19 + // Everyone else
  20 + || (function(view) {
  21 + "use strict";
  22 + // IE <10 is explicitly unsupported
  23 + if (typeof navigator !== "undefined" &&
  24 + /MSIE [1-9]\./.test(navigator.userAgent)) {
  25 + return;
  26 + }
  27 + var
  28 + doc = view.document
  29 + // only get URL when necessary in case Blob.js hasn't overridden it yet
  30 + , get_URL = function() {
  31 + return view.URL || view.webkitURL || view;
  32 + }
  33 + , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
  34 + , can_use_save_link = "download" in save_link
  35 + , click = function(node) {
  36 + var event = doc.createEvent("MouseEvents");
  37 + event.initMouseEvent(
  38 + "click", true, false, view, 0, 0, 0, 0, 0
  39 + , false, false, false, false, 0, null
  40 + );
  41 + node.dispatchEvent(event);
  42 + }
  43 + , webkit_req_fs = view.webkitRequestFileSystem
  44 + , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
  45 + , throw_outside = function(ex) {
  46 + (view.setImmediate || view.setTimeout)(function() {
  47 + throw ex;
  48 + }, 0);
  49 + }
  50 + , force_saveable_type = "application/octet-stream"
  51 + , fs_min_size = 0
  52 + // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 for
  53 + // the reasoning behind the timeout and revocation flow
  54 + , arbitrary_revoke_timeout = 10
  55 + , revoke = function(file) {
  56 + var revoker = function() {
  57 + if (typeof file === "string") { // file is an object URL
  58 + get_URL().revokeObjectURL(file);
  59 + } else { // file is a File
  60 + file.remove();
  61 + }
  62 + };
  63 + if (view.chrome) {
  64 + revoker();
  65 + } else {
  66 + setTimeout(revoker, arbitrary_revoke_timeout);
  67 + }
  68 + }
  69 + , dispatch = function(filesaver, event_types, event) {
  70 + event_types = [].concat(event_types);
  71 + var i = event_types.length;
  72 + while (i--) {
  73 + var listener = filesaver["on" + event_types[i]];
  74 + if (typeof listener === "function") {
  75 + try {
  76 + listener.call(filesaver, event || filesaver);
  77 + } catch (ex) {
  78 + throw_outside(ex);
  79 + }
  80 + }
  81 + }
  82 + }
  83 + , FileSaver = function(blob, name) {
  84 + // First try a.download, then web filesystem, then object URLs
  85 + var
  86 + filesaver = this
  87 + , type = blob.type
  88 + , blob_changed = false
  89 + , object_url
  90 + , target_view
  91 + , dispatch_all = function() {
  92 + dispatch(filesaver, "writestart progress write writeend".split(" "));
  93 + }
  94 + // on any filesys errors revert to saving with object URLs
  95 + , fs_error = function() {
  96 + // don't create more object URLs than needed
  97 + if (blob_changed || !object_url) {
  98 + object_url = get_URL().createObjectURL(blob);
  99 + }
  100 + if (target_view) {
  101 + target_view.location.href = object_url;
  102 + } else {
  103 + var new_tab = view.open(object_url, "_blank");
  104 + if (new_tab == undefined && typeof safari !== "undefined") {
  105 + //Apple do not allow window.open, see http://bit.ly/1kZffRI
  106 + view.location.href = object_url
  107 + }
  108 + }
  109 + filesaver.readyState = filesaver.DONE;
  110 + dispatch_all();
  111 + revoke(object_url);
  112 + }
  113 + , abortable = function(func) {
  114 + return function() {
  115 + if (filesaver.readyState !== filesaver.DONE) {
  116 + return func.apply(this, arguments);
  117 + }
  118 + };
  119 + }
  120 + , create_if_not_found = {create: true, exclusive: false}
  121 + , slice
  122 + ;
  123 + filesaver.readyState = filesaver.INIT;
  124 + if (!name) {
  125 + name = "download";
  126 + }
  127 + if (can_use_save_link) {
  128 + object_url = get_URL().createObjectURL(blob);
  129 + save_link.href = object_url;
  130 + save_link.download = name;
  131 + click(save_link);
  132 + filesaver.readyState = filesaver.DONE;
  133 + dispatch_all();
  134 + revoke(object_url);
  135 + return;
  136 + }
  137 + // Object and web filesystem URLs have a problem saving in Google Chrome when
  138 + // viewed in a tab, so I force save with application/octet-stream
  139 + // http://code.google.com/p/chromium/issues/detail?id=91158
  140 + // Update: Google errantly closed 91158, I submitted it again:
  141 + // https://code.google.com/p/chromium/issues/detail?id=389642
  142 + if (view.chrome && type && type !== force_saveable_type) {
  143 + slice = blob.slice || blob.webkitSlice;
  144 + blob = slice.call(blob, 0, blob.size, force_saveable_type);
  145 + blob_changed = true;
  146 + }
  147 + // Since I can't be sure that the guessed media type will trigger a download
  148 + // in WebKit, I append .download to the filename.
  149 + // https://bugs.webkit.org/show_bug.cgi?id=65440
  150 + if (webkit_req_fs && name !== "download") {
  151 + name += ".download";
  152 + }
  153 + if (type === force_saveable_type || webkit_req_fs) {
  154 + target_view = view;
  155 + }
  156 + if (!req_fs) {
  157 + fs_error();
  158 + return;
  159 + }
  160 + fs_min_size += blob.size;
  161 + req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
  162 + fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
  163 + var save = function() {
  164 + dir.getFile(name, create_if_not_found, abortable(function(file) {
  165 + file.createWriter(abortable(function(writer) {
  166 + writer.onwriteend = function(event) {
  167 + target_view.location.href = file.toURL();
  168 + filesaver.readyState = filesaver.DONE;
  169 + dispatch(filesaver, "writeend", event);
  170 + revoke(file);
  171 + };
  172 + writer.onerror = function() {
  173 + var error = writer.error;
  174 + if (error.code !== error.ABORT_ERR) {
  175 + fs_error();
  176 + }
  177 + };
  178 + "writestart progress write abort".split(" ").forEach(function(event) {
  179 + writer["on" + event] = filesaver["on" + event];
  180 + });
  181 + writer.write(blob);
  182 + filesaver.abort = function() {
  183 + writer.abort();
  184 + filesaver.readyState = filesaver.DONE;
  185 + };
  186 + filesaver.readyState = filesaver.WRITING;
  187 + }), fs_error);
  188 + }), fs_error);
  189 + };
  190 + dir.getFile(name, {create: false}, abortable(function(file) {
  191 + // delete file if it already exists
  192 + file.remove();
  193 + save();
  194 + }), abortable(function(ex) {
  195 + if (ex.code === ex.NOT_FOUND_ERR) {
  196 + save();
  197 + } else {
  198 + fs_error();
  199 + }
  200 + }));
  201 + }), fs_error);
  202 + }), fs_error);
  203 + }
  204 + , FS_proto = FileSaver.prototype
  205 + , saveAs = function(blob, name) {
  206 + return new FileSaver(blob, name);
  207 + }
  208 + ;
  209 + FS_proto.abort = function() {
  210 + var filesaver = this;
  211 + filesaver.readyState = filesaver.DONE;
  212 + dispatch(filesaver, "abort");
  213 + };
  214 + FS_proto.readyState = FS_proto.INIT = 0;
  215 + FS_proto.WRITING = 1;
  216 + FS_proto.DONE = 2;
  217 +
  218 + FS_proto.error =
  219 + FS_proto.onwritestart =
  220 + FS_proto.onprogress =
  221 + FS_proto.onwrite =
  222 + FS_proto.onabort =
  223 + FS_proto.onerror =
  224 + FS_proto.onwriteend =
  225 + null;
  226 +
  227 + return saveAs;
  228 +}(
  229 + typeof self !== "undefined" && self
  230 + || typeof window !== "undefined" && window
  231 + || this.content
  232 +));
  233 +// `self` is undefined in Firefox for Android content script context
  234 +// while `this` is nsIContentFrameMessageManager
  235 +// with an attribute `content` that corresponds to the window
  236 +
  237 +if (typeof module !== "undefined" && module !== null) {
  238 + module.exports = saveAs;
  239 +} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
  240 + define([], function() {
  241 + return saveAs;
  242 + });
  243 +}
... ...
src/main/resources/static/pages/report/inoutstation/js/tableExport.js
1   -
2   -
3   -(function(view){
4   - "use strict";
5   - var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
6   - var fromCharCode = String.fromCharCode;
7   - var INVALID_CHARACTER_ERR = ( function() {
8   - // fabricate a suitable error object
9   - try {
10   - document.createElement('$');
11   - } catch (error) {
12   - return error;
13   - }
14   - }());
15   -
16   - // encoder
17   - var btoa = function(string) {
18   - var a, b, b1, b2, b3, b4, c, i = 0, len = string.length, max = Math.max, result = '';
19   -
20   - while (i < len) {
21   - a = string.charCodeAt(i++) || 0;
22   - b = string.charCodeAt(i++) || 0;
23   - c = string.charCodeAt(i++) || 0;
24   -
25   - if (max(a, b, c) > 0xFF) {
26   - throw INVALID_CHARACTER_ERR;
27   - }
28   -
29   - b1 = (a >> 2) & 0x3F;
30   - b2 = ((a & 0x3) << 4) | ((b >> 4) & 0xF);
31   - b3 = ((b & 0xF) << 2) | ((c >> 6) & 0x3);
32   - b4 = c & 0x3F;
33   -
34   - if (!b) {
35   - b3 = b4 = 64;
36   - } else if (!c) {
37   - b4 = 64;
38   - }
39   - result += characters.charAt(b1) + characters.charAt(b2) + characters.charAt(b3) + characters.charAt(b4);
40   - }
41   - return result;
42   - };
43   -
44   - //获取dom文本
45   - var getText = function( el ){
46   - var s = el.textContent || el.innerText;
47   - return s == null ? "" : s.replace( /^\s*(.*?)\s+$/, "$1");
48   - };
49   - view.tableExport = function(tableId, filename, type){
50   - var doc = view.document,
51   - table = doc.getElementById(tableId),
52   - charSet = doc.characterSet
53   -
54   - var uri = {
55   - json: 'application/json;charset='+charSet,
56   - txt: 'csv/txt;charset='+charSet,
57   - csv: 'csv/txt;charset='+charSet,
58   - doc: 'application/vnd.ms-doc',
59   - excel: 'application/vnd.ms-excel'
60   - };
61   -
62   - var base64 = function(s) {
63   - return btoa(unescape(encodeURIComponent(s)));
64   - };
65   - var template = function(s, c) {
66   - return s.replace(/{(\w+)}/g, function(m, p) {
67   - return c[p];
68   - });
69   - };
70   -
71   - var get_blob = function() {
72   - return view.Blob;
73   - }
74   -
75   - var fixCSVField = function(value) {
76   - var fixedValue = value;
77   - var addQuotes = (value.indexOf(',') !== -1) || (value.indexOf('\r') !== -1) || (value.indexOf('\n') !== -1);
78   - var replaceDoubleQuotes = (value.indexOf('"') !== -1);
79   -
80   - if (replaceDoubleQuotes) {
81   - fixedValue = fixedValue.replace(/"/g, '""');
82   - }
83   - if (addQuotes || replaceDoubleQuotes) {
84   - fixedValue = '"' + fixedValue + '"';
85   - }
86   - return fixedValue;
87   - };
88   -
89   - var saveData = function(data){
90   - var BB = get_blob();
91   - saveAs(new BB([data], {type: uri[type]}), filename + "."+type);
92   - };
93   -
94   - var toCSV = function(){
95   - var data = "\ufeff";
96   - for (var i = 0, row; row = table.rows[i]; i++) {
97   - for (var j = 0, col; col = row.cells[j]; j++) {
98   - data = data + (j ? ',' : '') + fixCSVField(getText(col));
99   - }
100   - data = data + "\r\n";
101   - }
102   - saveData(data);
103   - };
104   -
105   - var toJson = function(){
106   - var jsonHeaderArray = [];
107   -
108   - if(table.tHead){
109   - for(var i =0,col; col = table.tHead.rows[0].cells[i]; i++){
110   - jsonHeaderArray.push(getText(col));
111   - }
112   - }
113   -
114   - var jsonArray = [];
115   - if(table.tBodies){
116   - for(var j=0,tbody; tbody = table.tBodies[j]; j++){
117   - for(var k =0, rowb; rowb= tbody.rows[k]; k++){
118   - var len = jsonArray.length;
119   - jsonArray[len] = [];
120   - for (var g = 0, colb; colb = rowb.cells[g]; g++) {
121   - jsonArray[len].push(getText(colb));
122   - }
123   - }
124   - }
125   - }
126   -
127   - var jsonExportArray = {
128   - header: jsonHeaderArray,
129   - data: jsonArray
130   - };
131   - saveData(JSON.stringify(jsonExportArray));
132   - };
133   -
134   - var toOffice = function(){
135   - var tmpl = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:'+type+'" xmlns="http://www.w3.org/TR/REC-html40">';
136   - tmpl += '<head><meta charset="'+charSet+'" /><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>';
137   - tmpl += '{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->';
138   - tmpl += '</head><body><table>{table}</table></body></html>';
139   - var office = '',
140   - maph = [['<thead><tr>', '</tr></thead>'], ['<tbody><tr>', '</tr></tbody>'], ['<tr>', '</tr>']],
141   - mapb = [['<th>', '</th>'],['<td>', '</td>']],
142   - flag = +!table.tHead,
143   - com = 1 - flag;
144   -
145   - for(var i=0, row; row = table.rows[i]; i++){
146   - flag = i > com ? 2 : flag;
147   - office += maph[flag][0];
148   - for(var j =0, col; col = row.cells[j]; j++){
149   - office += mapb[+!!flag][0]+ getText(col) +mapb[+!!flag][1];
150   - }
151   - office += maph[flag][1];
152   - flag++;
153   - }
154   - saveData(template(tmpl, {worksheet: 'Worksheet', table: office}));
155   - };
156   -
157   - var typeMap = {
158   - json : toJson,
159   - txt: toCSV,
160   - csv: toCSV,
161   - doc: toOffice,
162   - docx: toOffice,
163   - xls: toOffice,
164   - xlsx: toOffice
165   - };
166   -
167   - typeMap[type]();
168   - };
169   -
  1 +
  2 +
  3 +(function(view){
  4 + "use strict";
  5 + var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  6 + var fromCharCode = String.fromCharCode;
  7 + var INVALID_CHARACTER_ERR = ( function() {
  8 + // fabricate a suitable error object
  9 + try {
  10 + document.createElement('$');
  11 + } catch (error) {
  12 + return error;
  13 + }
  14 + }());
  15 +
  16 + // encoder
  17 + var btoa = function(string) {
  18 + var a, b, b1, b2, b3, b4, c, i = 0, len = string.length, max = Math.max, result = '';
  19 +
  20 + while (i < len) {
  21 + a = string.charCodeAt(i++) || 0;
  22 + b = string.charCodeAt(i++) || 0;
  23 + c = string.charCodeAt(i++) || 0;
  24 +
  25 + if (max(a, b, c) > 0xFF) {
  26 + throw INVALID_CHARACTER_ERR;
  27 + }
  28 +
  29 + b1 = (a >> 2) & 0x3F;
  30 + b2 = ((a & 0x3) << 4) | ((b >> 4) & 0xF);
  31 + b3 = ((b & 0xF) << 2) | ((c >> 6) & 0x3);
  32 + b4 = c & 0x3F;
  33 +
  34 + if (!b) {
  35 + b3 = b4 = 64;
  36 + } else if (!c) {
  37 + b4 = 64;
  38 + }
  39 + result += characters.charAt(b1) + characters.charAt(b2) + characters.charAt(b3) + characters.charAt(b4);
  40 + }
  41 + return result;
  42 + };
  43 +
  44 + //获取dom文本
  45 + var getText = function( el ){
  46 + var s = el.textContent || el.innerText;
  47 + return s == null ? "" : s.replace( /^\s*(.*?)\s+$/, "$1");
  48 + };
  49 + view.tableExport = function(tableId, filename, type){
  50 + var doc = view.document,
  51 + table = doc.getElementById(tableId),
  52 + charSet = doc.characterSet
  53 +
  54 + var uri = {
  55 + json: 'application/json;charset='+charSet,
  56 + txt: 'csv/txt;charset='+charSet,
  57 + csv: 'csv/txt;charset='+charSet,
  58 + doc: 'application/vnd.ms-doc',
  59 + excel: 'application/vnd.ms-excel'
  60 + };
  61 +
  62 + var base64 = function(s) {
  63 + return btoa(unescape(encodeURIComponent(s)));
  64 + };
  65 + var template = function(s, c) {
  66 + return s.replace(/{(\w+)}/g, function(m, p) {
  67 + return c[p];
  68 + });
  69 + };
  70 +
  71 + var get_blob = function() {
  72 + return view.Blob;
  73 + }
  74 +
  75 + var fixCSVField = function(value) {
  76 + var fixedValue = value;
  77 + var addQuotes = (value.indexOf(',') !== -1) || (value.indexOf('\r') !== -1) || (value.indexOf('\n') !== -1);
  78 + var replaceDoubleQuotes = (value.indexOf('"') !== -1);
  79 +
  80 + if (replaceDoubleQuotes) {
  81 + fixedValue = fixedValue.replace(/"/g, '""');
  82 + }
  83 + if (addQuotes || replaceDoubleQuotes) {
  84 + fixedValue = '"' + fixedValue + '"';
  85 + }
  86 + return fixedValue;
  87 + };
  88 +
  89 + var saveData = function(data){
  90 + var BB = get_blob();
  91 + saveAs(new BB([data], {type: uri[type]}), filename + "."+type);
  92 + };
  93 +
  94 + var toCSV = function(){
  95 + var data = "\ufeff";
  96 + for (var i = 0, row; row = table.rows[i]; i++) {
  97 + for (var j = 0, col; col = row.cells[j]; j++) {
  98 + data = data + (j ? ',' : '') + fixCSVField(getText(col));
  99 + }
  100 + data = data + "\r\n";
  101 + }
  102 + saveData(data);
  103 + };
  104 +
  105 + var toJson = function(){
  106 + var jsonHeaderArray = [];
  107 +
  108 + if(table.tHead){
  109 + for(var i =0,col; col = table.tHead.rows[0].cells[i]; i++){
  110 + jsonHeaderArray.push(getText(col));
  111 + }
  112 + }
  113 +
  114 + var jsonArray = [];
  115 + if(table.tBodies){
  116 + for(var j=0,tbody; tbody = table.tBodies[j]; j++){
  117 + for(var k =0, rowb; rowb= tbody.rows[k]; k++){
  118 + var len = jsonArray.length;
  119 + jsonArray[len] = [];
  120 + for (var g = 0, colb; colb = rowb.cells[g]; g++) {
  121 + jsonArray[len].push(getText(colb));
  122 + }
  123 + }
  124 + }
  125 + }
  126 +
  127 + var jsonExportArray = {
  128 + header: jsonHeaderArray,
  129 + data: jsonArray
  130 + };
  131 + saveData(JSON.stringify(jsonExportArray));
  132 + };
  133 +
  134 + var toOffice = function(){
  135 + var tmpl = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:'+type+'" xmlns="http://www.w3.org/TR/REC-html40">';
  136 + tmpl += '<head><meta charset="'+charSet+'" /><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>';
  137 + tmpl += '{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->';
  138 + tmpl += '</head><body><table>{table}</table></body></html>';
  139 + var office = '',
  140 + maph = [['<thead><tr>', '</tr></thead>'], ['<tbody><tr>', '</tr></tbody>'], ['<tr>', '</tr>']],
  141 + mapb = [['<th>', '</th>'],['<td>', '</td>']],
  142 + flag = +!table.tHead,
  143 + com = 1 - flag;
  144 +
  145 + for(var i=0, row; row = table.rows[i]; i++){
  146 + flag = i > com ? 2 : flag;
  147 + office += maph[flag][0];
  148 + for(var j =0, col; col = row.cells[j]; j++){
  149 + office += mapb[+!!flag][0]+ getText(col) +mapb[+!!flag][1];
  150 + }
  151 + office += maph[flag][1];
  152 + flag++;
  153 + }
  154 + saveData(template(tmpl, {worksheet: 'Worksheet', table: office}));
  155 + };
  156 +
  157 + var typeMap = {
  158 + json : toJson,
  159 + txt: toCSV,
  160 + csv: toCSV,
  161 + doc: toOffice,
  162 + docx: toOffice,
  163 + xls: toOffice,
  164 + xlsx: toOffice
  165 + };
  166 +
  167 + typeMap[type]();
  168 + };
  169 +
170 170 })(window);
171 171 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreView.js
1   -/**
2   - * saTimetablePreview指令,时刻表预览模式视图。
3   - */
4   -angular.module("ScheduleApp").directive(
5   - "saTimetable2",
6   - [
7   - '$timeout',
8   - function($timeout) {
9   - return {
10   - restrict : 'E',
11   - templateUrl : '/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html',
12   - scope : { // 独立作用域
13   - // 使用外部数据源,内部重新组合显示
14   - ds : "=ngModel"
15   - },
16   - controllerAs : "$saTimeTablePreviewCtrl",
17   - bindToController: true,
18   - controller : function() {
19   - var self = this;
20   -
21   - // 内部班次时刻模型
22   - self.internalBcModel = {
23   - up_qdz_name : "", // 上行起点站名字
24   - down_qdz_name : "", // 下行起点站名字
25   - up_bc_list_asc : [], // 上行班次列表(按照发车时间升序)
26   - down_bc_list_asc : [] // 下行班次列表(按照发车时间升序)
27   - };
28   -
29   - // 内部各个路牌block车次链模型
30   - self.internalLpBlockModel = {
31   - // key:路牌名字
32   - // value: 数组(按照发车时间排序)
33   - // value 数据内对象 {fcsj:发车时间,isUp:是否上行,fcno:发车顺序号,index:对应的班次列表索引}
34   - };
35   -
36   - // TODO:
37   - },
38   -
39   - /**,
40   - * compile阶段,angular还没有编译模版,根据需要可以修改模版dom
41   - * @param tElem
42   - * @param tAttrs
43   - * @returns {{pre: Function, post: Function}}
44   - */
45   - compile : function(tElem, tAttrs) {
46   - // 获取属性
47   - var $attr_name = tAttrs["name"]; // 控件的名字
48   - if (!$attr_name) {
49   - throw new Error("saTimeTablePreview指令 name属性required");
50   - }
51   -
52   - // 内部controlAs名字
53   - var ctrlAs = "$saTimeTablePreviewCtrl";
54   -
55   - // TODO:
56   -
57   - //------------------ 内部方法 --------------------//
58   - var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀
59   - var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式
60   - /**
61   - * 将时间包装成日期,方便计算。
62   - * @param timeStr 时间格式,如 06:30
63   - * @returns moment对象
64   - */
65   - var _fun_WrapTime = function(timeStr) {
66   - return moment(
67   - date_wrap_prefix + timeStr,
68   - date_wrap_format
69   - );
70   - };
71   -
72   - /**
73   - * 点击班次html元素(dl),触发班次移动,如下:
74   - * 1、点击上行班次,下一个下行班次在下行班次列表中移到中间位置
75   - * 2、点击下行班次,下一个上行班次在上行班次列表中移到中间位置
76   - * @param ctrl 内部控制器
77   - * @param index 班次索引
78   - * @param isUp 是否上行
79   - * @private
80   - */
81   - var _fun_bcDDViewMove = function(ctrl, index, isUp) {
82   - // 获取当前点击班次对象
83   - var oBc;
84   - if (isUp) {
85   - oBc = ctrl.internalBcModel.up_bc_list_asc[index];
86   - } else {
87   - oBc = ctrl.internalBcModel.down_bc_list_asc[index];
88   - }
89   -
90   - // 找出车次链中的下一个班次索引,没有就undefined
91   - var nextIndex = undefined;
92   - var nextBlockBc = undefined;
93   - var currentBlockBcIndex = undefined;
94   - angular.forEach(ctrl.internalLpBlockModel[oBc.lpName], function(data, i) {
95   - if (data.fcsj == oBc.fcsj) {
96   - currentBlockBcIndex = i;
97   - }
98   - });
99   - if (currentBlockBcIndex != undefined &&
100   - currentBlockBcIndex < (ctrl.internalLpBlockModel[oBc.lpName].length - 1)) {
101   - nextBlockBc = ctrl.internalLpBlockModel[oBc.lpName][currentBlockBcIndex + 1];
102   - nextIndex = nextBlockBc.index;
103   - }
104   - // 先删除click标记,再添加
105   - angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data) {
106   - delete data["isClick"];
107   - });
108   - angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data) {
109   - delete data["isClick"];
110   - });
111   - oBc.isClick = true;
112   - if (nextIndex) {
113   - if (nextBlockBc.isUp) {
114   - ctrl.internalBcModel.up_bc_list_asc[nextIndex].isClick = true;
115   - } else {
116   - ctrl.internalBcModel.down_bc_list_asc[nextIndex].isClick = true;
117   - }
118   - }
119   -
120   - // 移动,同方向不移动
121   - var clientHeight = angular.element("#temp").height() - 34;
122   - if (nextBlockBc && isUp != nextBlockBc.isUp) {
123   - if (isUp) { // 移动下行
124   - angular.element(".ttpv_table_scrollbar:eq(1)").animate(
125   - {scrollTop : nextIndex * 30 - clientHeight / 2}, 400);
126   - } else { // 移动上行
127   - angular.element(".ttpv_table_scrollbar:eq(0)").animate(
128   - {scrollTop : nextIndex * 30 - clientHeight / 2}, 400);
129   - }
130   - }
131   -
132   - };
133   -
134   - /**
135   - * 刷新内部数据。
136   - * @param ctrl 内部控制器对象($saTimeTablePreviewCtrl)
137   - * @private
138   - */
139   - var _fun_refreshInternalModel = function(ctrl) {
140   - // 初始化内部数据
141   - ctrl.internalBcModel = {
142   - up_qdz_name : "", // 上行起点站名字
143   - up_zdz_name : "", // 上行终点站名字
144   - down_qdz_name : "", // 下行起点站名字
145   - down_zdz_name : "", // 下行终点站名字
146   - up_bc_list_asc : [], // 上行班次列表(按照发车时间升序)
147   - down_bc_list_asc : [] // 下行班次列表(按照发车时间升序)
148   - };
149   - ctrl.internalLpBlockModel = {
150   -
151   - };
152   -
153   - // ngModel传入的数据
154   - var dataSource = ctrl.ds.bcList;
155   -
156   - // 构造上下行班次列表,并确定上下行的首发站点
157   - angular.forEach(dataSource, function(bcObj) {
158   - var _internalBcObj = {};
159   - // 构造内部班次对象
160   - _internalBcObj.lpName = bcObj.lp.lpName; // 路牌
161   - _internalBcObj.fcsj = bcObj.fcsj; // 发车时间
162   - _internalBcObj.ddsj = _fun_WrapTime(bcObj.fcsj).add(bcObj.bcsj, "m").format("HH:mm");
163   - _internalBcObj.qdzName = bcObj.qdzName; // 起点站名字
164   - _internalBcObj.zdzName = bcObj.zdzName; // 终点站名字
165   - _internalBcObj.bcType = bcObj.bcType; // 班次类型
166   - _internalBcObj.isTs = bcObj.isTS; // 是否停驶
167   - _internalBcObj.isFb = bcObj.isFB; // 是否分班
168   - _internalBcObj.remark = bcObj.remark; // 备注
169   - _internalBcObj._fcno = bcObj.fcno; // 发车顺序号
170   -
171   - if (bcObj.xlDir == "0") { // 上行
172   - ctrl.internalBcModel.up_bc_list_asc.push(_internalBcObj);
173   - // 确定起点站
174   - if (ctrl.internalBcModel.up_qdz_name == "") {
175   - if (bcObj.bcType == "normal") {
176   - ctrl.internalBcModel.up_qdz_name = bcObj.qdzName;
177   - }
178   - }
179   - // 确定终点站
180   - if (ctrl.internalBcModel.up_zdz_name == "") {
181   - if (bcObj.bcType == "normal") {
182   - ctrl.internalBcModel.up_zdz_name = bcObj.zdzName;
183   - }
184   - }
185   - }
186   - if (bcObj.xlDir == "1") { // 下行
187   - ctrl.internalBcModel.down_bc_list_asc.push(_internalBcObj);
188   - // 确定起点站
189   - if (ctrl.internalBcModel.down_qdz_name == "") {
190   - if (bcObj.bcType == "normal") {
191   - ctrl.internalBcModel.down_qdz_name = bcObj.qdzName;
192   - }
193   - }
194   - // 确定终点站
195   - if (ctrl.internalBcModel.down_zdz_name == "") {
196   - if (bcObj.bcType == "normal") {
197   - ctrl.internalBcModel.down_zdz_name = bcObj.zdzName;
198   - }
199   - }
200   - }
201   -
202   - });
203   -
204   - // 发车时间升序排序上行班次
205   - ctrl.internalBcModel.up_bc_list_asc.sort(function(a, b) {
206   - var a_wrapTime = _fun_WrapTime(a.fcsj);
207   - var b_wrapTime = _fun_WrapTime(b.fcsj);
208   -
209   - // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定
210   - // TODO:以后要配合首班车的发车时间判定
211   - if (a.fcsj.indexOf("00:") == 0 ||
212   - a.fcsj.indexOf("01:") == 0 ||
213   - a.fcsj.indexOf("02:") == 0) {
214   - a_wrapTime.add(1, "day");
215   - }
216   - if (b.fcsj.indexOf("00:") == 0 ||
217   - b.fcsj.indexOf("01:") == 0 ||
218   - b.fcsj.indexOf("02:") == 0) {
219   - b_wrapTime.add(1, "day");
220   - }
221   -
222   - if (a_wrapTime.isBefore(b_wrapTime)) {
223   - return -1;
224   - } else if (a_wrapTime.isAfter(b_wrapTime)) {
225   - return 1;
226   - } else {
227   - return 0;
228   - }
229   -
230   - });
231   - // 发车时间升序排序下行班次
232   - ctrl.internalBcModel.down_bc_list_asc.sort(function(a, b) {
233   - var a_wrapTime = _fun_WrapTime(a.fcsj);
234   - var b_wrapTime = _fun_WrapTime(b.fcsj);
235   -
236   - // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定
237   - // TODO:以后要配合首班车的发车时间判定
238   - if (a.fcsj.indexOf("00:") == 0 ||
239   - a.fcsj.indexOf("01:") == 0 ||
240   - a.fcsj.indexOf("02:") == 0) {
241   - a_wrapTime.add(1, "day");
242   - }
243   - if (b.fcsj.indexOf("00:") == 0 ||
244   - b.fcsj.indexOf("01:") == 0 ||
245   - b.fcsj.indexOf("02:") == 0) {
246   - b_wrapTime.add(1, "day");
247   - }
248   -
249   - if (a_wrapTime.isBefore(b_wrapTime)) {
250   - return -1;
251   - } else if (a_wrapTime.isAfter(b_wrapTime)) {
252   - return 1;
253   - } else {
254   - return 0;
255   - }
256   - });
257   -
258   - // 构造路牌block车次链,按照发车顺序排序
259   - angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data, index) {
260   - if (!ctrl.internalLpBlockModel[data.lpName]) {
261   - ctrl.internalLpBlockModel[data.lpName] = [];
262   - }
263   - ctrl.internalLpBlockModel[data.lpName].push({
264   - fcsj : data.fcsj,
265   - isUp : true,
266   - fcno : data._fcno,
267   - index : index
268   - });
269   - });
270   - angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data, index) {
271   - if (!ctrl.internalLpBlockModel[data.lpName]) {
272   - ctrl.internalLpBlockModel[data.lpName] = [];
273   - }
274   - ctrl.internalLpBlockModel[data.lpName].push({
275   - fcsj : data.fcsj,
276   - isUp : false,
277   - fcno : data._fcno,
278   - index : index
279   - });
280   - });
281   - angular.forEach(ctrl.internalLpBlockModel, function(value, key) {
282   - value.sort(function (a, b) {
283   - if (a.fcno < b.fcno) {
284   - return -1;
285   - } else if (a.fcno > b.fcno) {
286   - return 1;
287   - } else {
288   - return 0;
289   - }
290   - });
291   - });
292   -
293   -
294   - };
295   -
296   - return {
297   - pre : function(scope, element, attr) {
298   - // TODO:
299   - },
300   - post : function(scope, element, attr) {
301   - // 班次html点击事件
302   - scope[ctrlAs].$$bcDD_Click = function(index, xlDir) {
303   - _fun_bcDDViewMove(scope[ctrlAs], index, xlDir);
304   - };
305   -
306   - // 监控ngModel绑定的外部数据源的刷新状态变化
307   - scope.$watch(
308   - function() {
309   - return scope[ctrlAs].ds.refreshInfos;
310   - },
311   - function(newValue, oldValue) {
312   - if (newValue === undefined && oldValue === undefined) {
313   - return;
314   - }
315   - console.log("saTimetable2 refresh");
316   - _fun_refreshInternalModel(scope[ctrlAs]);
317   - },
318   - true
319   - );
320   - }
321   - };
322   - }
323   - };
324   - }
325   - ]
  1 +/**
  2 + * saTimetablePreview指令,时刻表预览模式视图。
  3 + */
  4 +angular.module("ScheduleApp").directive(
  5 + "saTimetable2",
  6 + [
  7 + '$timeout',
  8 + function($timeout) {
  9 + return {
  10 + restrict : 'E',
  11 + templateUrl : '/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html',
  12 + scope : { // 独立作用域
  13 + // 使用外部数据源,内部重新组合显示
  14 + ds : "=ngModel"
  15 + },
  16 + controllerAs : "$saTimeTablePreviewCtrl",
  17 + bindToController: true,
  18 + controller : function() {
  19 + var self = this;
  20 +
  21 + // 内部班次时刻模型
  22 + self.internalBcModel = {
  23 + up_qdz_name : "", // 上行起点站名字
  24 + down_qdz_name : "", // 下行起点站名字
  25 + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序)
  26 + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序)
  27 + };
  28 +
  29 + // 内部各个路牌block车次链模型
  30 + self.internalLpBlockModel = {
  31 + // key:路牌名字
  32 + // value: 数组(按照发车时间排序)
  33 + // value 数据内对象 {fcsj:发车时间,isUp:是否上行,fcno:发车顺序号,index:对应的班次列表索引}
  34 + };
  35 +
  36 + // TODO:
  37 + },
  38 +
  39 + /**,
  40 + * compile阶段,angular还没有编译模版,根据需要可以修改模版dom
  41 + * @param tElem
  42 + * @param tAttrs
  43 + * @returns {{pre: Function, post: Function}}
  44 + */
  45 + compile : function(tElem, tAttrs) {
  46 + // 获取属性
  47 + var $attr_name = tAttrs["name"]; // 控件的名字
  48 + if (!$attr_name) {
  49 + throw new Error("saTimeTablePreview指令 name属性required");
  50 + }
  51 +
  52 + // 内部controlAs名字
  53 + var ctrlAs = "$saTimeTablePreviewCtrl";
  54 +
  55 + // TODO:
  56 +
  57 + //------------------ 内部方法 --------------------//
  58 + var date_wrap_prefix = "2000-01-01 "; // 包装日期的前缀
  59 + var date_wrap_format = "YYYY-MM-DD HH:mm"; // 日期格式
  60 + /**
  61 + * 将时间包装成日期,方便计算。
  62 + * @param timeStr 时间格式,如 06:30
  63 + * @returns moment对象
  64 + */
  65 + var _fun_WrapTime = function(timeStr) {
  66 + return moment(
  67 + date_wrap_prefix + timeStr,
  68 + date_wrap_format
  69 + );
  70 + };
  71 +
  72 + /**
  73 + * 点击班次html元素(dl),触发班次移动,如下:
  74 + * 1、点击上行班次,下一个下行班次在下行班次列表中移到中间位置
  75 + * 2、点击下行班次,下一个上行班次在上行班次列表中移到中间位置
  76 + * @param ctrl 内部控制器
  77 + * @param index 班次索引
  78 + * @param isUp 是否上行
  79 + * @private
  80 + */
  81 + var _fun_bcDDViewMove = function(ctrl, index, isUp) {
  82 + // 获取当前点击班次对象
  83 + var oBc;
  84 + if (isUp) {
  85 + oBc = ctrl.internalBcModel.up_bc_list_asc[index];
  86 + } else {
  87 + oBc = ctrl.internalBcModel.down_bc_list_asc[index];
  88 + }
  89 +
  90 + // 找出车次链中的下一个班次索引,没有就undefined
  91 + var nextIndex = undefined;
  92 + var nextBlockBc = undefined;
  93 + var currentBlockBcIndex = undefined;
  94 + angular.forEach(ctrl.internalLpBlockModel[oBc.lpName], function(data, i) {
  95 + if (data.fcsj == oBc.fcsj) {
  96 + currentBlockBcIndex = i;
  97 + }
  98 + });
  99 + if (currentBlockBcIndex != undefined &&
  100 + currentBlockBcIndex < (ctrl.internalLpBlockModel[oBc.lpName].length - 1)) {
  101 + nextBlockBc = ctrl.internalLpBlockModel[oBc.lpName][currentBlockBcIndex + 1];
  102 + nextIndex = nextBlockBc.index;
  103 + }
  104 + // 先删除click标记,再添加
  105 + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data) {
  106 + delete data["isClick"];
  107 + });
  108 + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data) {
  109 + delete data["isClick"];
  110 + });
  111 + oBc.isClick = true;
  112 + if (nextIndex) {
  113 + if (nextBlockBc.isUp) {
  114 + ctrl.internalBcModel.up_bc_list_asc[nextIndex].isClick = true;
  115 + } else {
  116 + ctrl.internalBcModel.down_bc_list_asc[nextIndex].isClick = true;
  117 + }
  118 + }
  119 +
  120 + // 移动,同方向不移动
  121 + var clientHeight = angular.element("#temp").height() - 34;
  122 + if (nextBlockBc && isUp != nextBlockBc.isUp) {
  123 + if (isUp) { // 移动下行
  124 + angular.element(".ttpv_table_scrollbar:eq(1)").animate(
  125 + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400);
  126 + } else { // 移动上行
  127 + angular.element(".ttpv_table_scrollbar:eq(0)").animate(
  128 + {scrollTop : nextIndex * 30 - clientHeight / 2}, 400);
  129 + }
  130 + }
  131 +
  132 + };
  133 +
  134 + /**
  135 + * 刷新内部数据。
  136 + * @param ctrl 内部控制器对象($saTimeTablePreviewCtrl)
  137 + * @private
  138 + */
  139 + var _fun_refreshInternalModel = function(ctrl) {
  140 + // 初始化内部数据
  141 + ctrl.internalBcModel = {
  142 + up_qdz_name : "", // 上行起点站名字
  143 + up_zdz_name : "", // 上行终点站名字
  144 + down_qdz_name : "", // 下行起点站名字
  145 + down_zdz_name : "", // 下行终点站名字
  146 + up_bc_list_asc : [], // 上行班次列表(按照发车时间升序)
  147 + down_bc_list_asc : [] // 下行班次列表(按照发车时间升序)
  148 + };
  149 + ctrl.internalLpBlockModel = {
  150 +
  151 + };
  152 +
  153 + // ngModel传入的数据
  154 + var dataSource = ctrl.ds.bcList;
  155 +
  156 + // 构造上下行班次列表,并确定上下行的首发站点
  157 + angular.forEach(dataSource, function(bcObj) {
  158 + var _internalBcObj = {};
  159 + // 构造内部班次对象
  160 + _internalBcObj.lpName = bcObj.lp.lpName; // 路牌
  161 + _internalBcObj.fcsj = bcObj.fcsj; // 发车时间
  162 + _internalBcObj.ddsj = _fun_WrapTime(bcObj.fcsj).add(bcObj.bcsj, "m").format("HH:mm");
  163 + _internalBcObj.qdzName = bcObj.qdzName; // 起点站名字
  164 + _internalBcObj.zdzName = bcObj.zdzName; // 终点站名字
  165 + _internalBcObj.bcType = bcObj.bcType; // 班次类型
  166 + _internalBcObj.isTs = bcObj.isTS; // 是否停驶
  167 + _internalBcObj.isFb = bcObj.isFB; // 是否分班
  168 + _internalBcObj.remark = bcObj.remark; // 备注
  169 + _internalBcObj._fcno = bcObj.fcno; // 发车顺序号
  170 +
  171 + if (bcObj.xlDir == "0") { // 上行
  172 + ctrl.internalBcModel.up_bc_list_asc.push(_internalBcObj);
  173 + // 确定起点站
  174 + if (ctrl.internalBcModel.up_qdz_name == "") {
  175 + if (bcObj.bcType == "normal") {
  176 + ctrl.internalBcModel.up_qdz_name = bcObj.qdzName;
  177 + }
  178 + }
  179 + // 确定终点站
  180 + if (ctrl.internalBcModel.up_zdz_name == "") {
  181 + if (bcObj.bcType == "normal") {
  182 + ctrl.internalBcModel.up_zdz_name = bcObj.zdzName;
  183 + }
  184 + }
  185 + }
  186 + if (bcObj.xlDir == "1") { // 下行
  187 + ctrl.internalBcModel.down_bc_list_asc.push(_internalBcObj);
  188 + // 确定起点站
  189 + if (ctrl.internalBcModel.down_qdz_name == "") {
  190 + if (bcObj.bcType == "normal") {
  191 + ctrl.internalBcModel.down_qdz_name = bcObj.qdzName;
  192 + }
  193 + }
  194 + // 确定终点站
  195 + if (ctrl.internalBcModel.down_zdz_name == "") {
  196 + if (bcObj.bcType == "normal") {
  197 + ctrl.internalBcModel.down_zdz_name = bcObj.zdzName;
  198 + }
  199 + }
  200 + }
  201 +
  202 + });
  203 +
  204 + // 发车时间升序排序上行班次
  205 + ctrl.internalBcModel.up_bc_list_asc.sort(function(a, b) {
  206 + var a_wrapTime = _fun_WrapTime(a.fcsj);
  207 + var b_wrapTime = _fun_WrapTime(b.fcsj);
  208 +
  209 + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定
  210 + // TODO:以后要配合首班车的发车时间判定
  211 + if (a.fcsj.indexOf("00:") == 0 ||
  212 + a.fcsj.indexOf("01:") == 0 ||
  213 + a.fcsj.indexOf("02:") == 0) {
  214 + a_wrapTime.add(1, "day");
  215 + }
  216 + if (b.fcsj.indexOf("00:") == 0 ||
  217 + b.fcsj.indexOf("01:") == 0 ||
  218 + b.fcsj.indexOf("02:") == 0) {
  219 + b_wrapTime.add(1, "day");
  220 + }
  221 +
  222 + if (a_wrapTime.isBefore(b_wrapTime)) {
  223 + return -1;
  224 + } else if (a_wrapTime.isAfter(b_wrapTime)) {
  225 + return 1;
  226 + } else {
  227 + return 0;
  228 + }
  229 +
  230 + });
  231 + // 发车时间升序排序下行班次
  232 + ctrl.internalBcModel.down_bc_list_asc.sort(function(a, b) {
  233 + var a_wrapTime = _fun_WrapTime(a.fcsj);
  234 + var b_wrapTime = _fun_WrapTime(b.fcsj);
  235 +
  236 + // 判定如果发车时间是以00,01,02,03开头的,说明是下一天凌晨的班次,需要加1天判定
  237 + // TODO:以后要配合首班车的发车时间判定
  238 + if (a.fcsj.indexOf("00:") == 0 ||
  239 + a.fcsj.indexOf("01:") == 0 ||
  240 + a.fcsj.indexOf("02:") == 0) {
  241 + a_wrapTime.add(1, "day");
  242 + }
  243 + if (b.fcsj.indexOf("00:") == 0 ||
  244 + b.fcsj.indexOf("01:") == 0 ||
  245 + b.fcsj.indexOf("02:") == 0) {
  246 + b_wrapTime.add(1, "day");
  247 + }
  248 +
  249 + if (a_wrapTime.isBefore(b_wrapTime)) {
  250 + return -1;
  251 + } else if (a_wrapTime.isAfter(b_wrapTime)) {
  252 + return 1;
  253 + } else {
  254 + return 0;
  255 + }
  256 + });
  257 +
  258 + // 构造路牌block车次链,按照发车顺序排序
  259 + angular.forEach(ctrl.internalBcModel.up_bc_list_asc, function(data, index) {
  260 + if (!ctrl.internalLpBlockModel[data.lpName]) {
  261 + ctrl.internalLpBlockModel[data.lpName] = [];
  262 + }
  263 + ctrl.internalLpBlockModel[data.lpName].push({
  264 + fcsj : data.fcsj,
  265 + isUp : true,
  266 + fcno : data._fcno,
  267 + index : index
  268 + });
  269 + });
  270 + angular.forEach(ctrl.internalBcModel.down_bc_list_asc, function(data, index) {
  271 + if (!ctrl.internalLpBlockModel[data.lpName]) {
  272 + ctrl.internalLpBlockModel[data.lpName] = [];
  273 + }
  274 + ctrl.internalLpBlockModel[data.lpName].push({
  275 + fcsj : data.fcsj,
  276 + isUp : false,
  277 + fcno : data._fcno,
  278 + index : index
  279 + });
  280 + });
  281 + angular.forEach(ctrl.internalLpBlockModel, function(value, key) {
  282 + value.sort(function (a, b) {
  283 + if (a.fcno < b.fcno) {
  284 + return -1;
  285 + } else if (a.fcno > b.fcno) {
  286 + return 1;
  287 + } else {
  288 + return 0;
  289 + }
  290 + });
  291 + });
  292 +
  293 +
  294 + };
  295 +
  296 + return {
  297 + pre : function(scope, element, attr) {
  298 + // TODO:
  299 + },
  300 + post : function(scope, element, attr) {
  301 + // 班次html点击事件
  302 + scope[ctrlAs].$$bcDD_Click = function(index, xlDir) {
  303 + _fun_bcDDViewMove(scope[ctrlAs], index, xlDir);
  304 + };
  305 +
  306 + // 监控ngModel绑定的外部数据源的刷新状态变化
  307 + scope.$watch(
  308 + function() {
  309 + return scope[ctrlAs].ds.refreshInfos;
  310 + },
  311 + function(newValue, oldValue) {
  312 + if (newValue === undefined && oldValue === undefined) {
  313 + return;
  314 + }
  315 + console.log("saTimetable2 refresh");
  316 + _fun_refreshInternalModel(scope[ctrlAs]);
  317 + },
  318 + true
  319 + );
  320 + }
  321 + };
  322 + }
  323 + };
  324 + }
  325 + ]
326 326 );
327 327 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/saTimeTablePreViewTemplate.html
1   -<style>
2   - .ttpv_detail {
3   - height: 100%;
4   - }
5   - .ttpv_detail .container-fluid {
6   - height: 100%;
7   - margin-left: 0;
8   - }
9   - .ttpv_detail .container-fluid>* {
10   - padding: 0;
11   - }
12   - .ttpv_detail .container-fluid.top-container {
13   - margin-top: 5px;
14   - padding: 0;
15   - }
16   -
17   - .ttpv_detail .detail-panel {
18   - padding: 0;
19   - height: 100%;
20   - border: 1px solid #ddd;
21   - background: #fafafa;
22   - border-radius: 10px !important;
23   - moz-user-select: -moz-none;
24   - -moz-user-select: none;
25   - -o-user-select: none;
26   - -khtml-user-select: none;
27   - -webkit-user-select: none;
28   - -ms-user-select: none;
29   - user-select: none;
30   - }
31   -
32   - .ttpv_detail .detail-panel .detail-wrap {
33   - height: calc(100% - 1px);
34   - padding: 0;
35   -
36   - font-size: 14px;
37   - color: #cccaca;
38   - }
39   -
40   - .ttpv_detail .detail-panel .detail-wrap .detail-title {
41   - margin: 7px 0 5px;
42   - text-indent: 5px;
43   - margin: 0;
44   - height: 31px;
45   - line-height: 31px;
46   - color: #2765A7;
47   - }
48   -
49   - .ttpv_detail .detail-panel .detail-wrap .detail-body {
50   - height: calc(100% - 37px);
51   - background: #fff;
52   - }
53   -
54   - .ttpv_detail .detail-panel .detail-wrap .detail-body .ttpv_table_wrap {
55   - width: 100%;
56   - height: 100%;
57   - border-left: 0;
58   - border-bottom: 0;
59   - overflow: auto;
60   - }
61   -
62   -</style>
63   -
64   -<style>
65   - /** 表格样式 */
66   - .ttpv_table {
67   - position: relative;
68   - padding-top: 34px;
69   - font-size: 13px;
70   - }
71   -
72   - .ttpv_table dl {
73   - display: block;
74   - /*width: 100%;*/
75   - margin: 0;
76   - /*border-bottom: 1px solid;*/
77   - cursor: default;
78   - }
79   - .ttpv_table dl {
80   - font-size: 0;
81   - white-space: nowrap;
82   - }
83   - .ttpv_table dl {
84   - transition: all .1s ease;
85   - }
86   -
87   - .ttpv_table dl dd, .ttpv_table dl dt {
88   - display: inline-block;
89   - white-space: nowrap;
90   - overflow: hidden;
91   - text-overflow: ellipsis;
92   - height: 100%;
93   - line-height: 34px;
94   - border-right: 1px solid;
95   - text-indent: 5px;
96   - }
97   - .ttpv_table dl dd, .ttpv_table dl dt {
98   - border-right-color: #dedede;
99   - font-size: 13px;
100   - /*border-bottom: 1px solid #dedede;*/
101   - border-top: 1px solid #dedede;
102   - text-align: center;
103   - }
104   -
105   - .ttpv_table > .ttpv_table_head {
106   - position: absolute;
107   - top: 0;
108   - height: 34px;
109   - background: #f5f5f5;
110   - /*width: 100%;*/
111   - line-height: 34px;
112   - z-index: 1;
113   - }
114   - .ttpv_table_head dl {
115   - border-bottom: 2px solid #96b9d7;
116   - color: #333333;
117   - height: 34px;
118   - background-color: #f5f5f5;
119   - }
120   - .ttpv_table_head dl dt {
121   - font-weight: normal;
122   - font-size: 12px;
123   - }
124   -
125   - .ttpv_table_head dl dt:nth-of-type(1) {
126   - width: 50px;
127   - height: 34px;
128   - }
129   - .ttpv_table_head dl dt:nth-of-type(2) {
130   - width: 55px;
131   - height: 34px;
132   - }
133   - .ttpv_table_head dl dt:nth-of-type(3) {
134   - width: 120px;
135   - height: 34px;
136   - }
137   - .ttpv_table_head dl dt:nth-of-type(4) {
138   - width: 100px;
139   - height: 34px;
140   - }
141   - .ttpv_table_head dl dt:nth-of-type(5) {
142   - width: 200px;
143   - height: 34px;
144   - }
145   -
146   - .ttpv_table > .ttpv_table_body {
147   - /*width: 100%;*/
148   - position: absolute;
149   - border-bottom: 1px solid #dedede;
150   - }
151   -
152   - .ttpv_table_body dd.ists {
153   - background: #105383 !important;
154   - color: white !important;
155   - }
156   - .ttpv_table_body dd.region {
157   - background: #686d7b !important;
158   - color: white !important;
159   - }
160   - .ttpv_table_body dd.isfb {
161   - background: #adff00 !important;
162   - color: #501a1a !important;
163   - }
164   -
165   - .ttpv_table_body dd.istsClick {
166   - background: linear-gradient(to right,#8baabf,#105383,#808086)!important;
167   - }
168   - .ttpv_table_body dd.regionClick {
169   - background: linear-gradient(to right,#8baabf,#686d7b,#a09997)!important;
170   - }
171   - .ttpv_table_body dd.isfbClick {
172   - background: linear-gradient(to right,#8baabf,#adff00,#a09997)!important;
173   - }
174   -
175   - .ttpv_table_body dl dd:nth-of-type(1) {
176   - width: 50px;
177   - height: 30px;
178   - }
179   - .ttpv_table_body dl dd:nth-of-type(2) {
180   - width: 55px;
181   - height: 30px;
182   - }
183   - .ttpv_table_body dl dd:nth-of-type(3) {
184   - width: 120px;
185   - height: 30px;
186   - text-align: left;
187   - }
188   - .ttpv_table_body dl dd:nth-of-type(4) {
189   - width: 100px;
190   - height: 30px;
191   - }
192   - .ttpv_table_body dl dd:nth-of-type(5) {
193   - width: 200px;
194   - height: 30px;
195   - }
196   -
197   - .ttpv_table_body dd:nth-of-type(1) {
198   - color: #2765A7;
199   - background: #eae8e8;
200   - /*border-bottom: 1px solid #b3b3b3;*/
201   - border-right: 1px solid #b3b3b3;
202   - text-indent: -3px;
203   - }
204   - .ttpv_table_body dd:nth-of-type(n + 2) {
205   - color: #2765A7;
206   - }
207   - .ttpv_table_body dl:hover {
208   - box-shadow: 0 0 4px #656c71;
209   - background: #f5fbff;
210   - }
211   - .ttpv_table_body dl:hover dd:nth-of-type(1) {
212   - background: #fafafa;
213   - background: linear-gradient(to right, #fafafa, #f5fbff);
214   - }
215   -
216   - .isClick {
217   - background: #8baabf!important;
218   - color: #fff!important;
219   - }
220   -
221   -</style>
222   -
223   -<style>
224   - /** 滚动条css样式 */
225   -
226   - .ttpv_table_scrollbar::-webkit-scrollbar {
227   - width: 18px;
228   - height: 18px;
229   - }
230   -
231   - .ttpv_table_scrollbar::-webkit-scrollbar-track, ::-webkit-scrollbar-thumb {
232   - border-radius: 999px;
233   - border: 5px solid transparent;
234   - }
235   -
236   - .ttpv_table_scrollbar::-webkit-scrollbar-track {
237   - box-shadow: 1px 1px 5px rgba(0, 0, 0, .2) inset;
238   - }
239   -
240   - .ttpv_table_scrollbar::-webkit-scrollbar-thumb {
241   - min-height: 20px;
242   - background-clip: content-box;
243   - box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset;
244   - }
245   -
246   - .ttpv_table_scrollbar::-webkit-scrollbar-corner {
247   - background: transparent;
248   - }
249   -</style>
250   -
251   -<div class="ttpv_detail">
252   - <div class="container-fluid top-container">
253   - <div class="col-md-12 container-fluid">
254   - <div class="col-md-6" style="height: 100%; padding-right: 3px;">
255   - <div class="detail-panel">
256   - <div class="detail-wrap" >
257   - <h3 class="detail-title">
258   - 上行:
259   - {{$saTimeTablePreviewCtrl.internalBcModel.up_qdz_name}}
260   - <i class="fa fa-angle-double-right" aria-hidden="true"></i>
261   - {{$saTimeTablePreviewCtrl.internalBcModel.up_zdz_name}}
262   - </h3>
263   - <div id="temp" class="detail-body">
264   - <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".upFixHead">
265   - <div class="ttpv_table">
266   - <div class="ttpv_table_head upFixHead">
267   - <dl>
268   - <dt>序号</dt>
269   - <dt>路牌</dt>
270   - <dt>发车时间</dt>
271   - <dt>到达时间</dt>
272   - <dt>备注</dt>
273   - </dl>
274   - </div>
275   - <div class="ttpv_table_body">
276   - <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.up_bc_list_asc track by $index"
277   - ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, true)">
278   - <dd>{{$index + 1}}</dd>
279   - <dd ng-class="{isClick : bc.isClick}">
280   - {{bc.lpName}}
281   - </dd>
282   - <dd ng-class="{
283   - ists: (bc.isTs && !bc.isClick),
284   - istsClick: (bc.isTs && bc.isClick),
285   - region: (bc.bcType == 'region' && !bc.isClick),
286   - regionClick : (bc.bcType == 'region' && bc.isClick),
287   - isfb: (bc.isFb && !bc.isClick),
288   - isfbClick : (bc.isFb && bc.isClick),
289   - isClick: bc.isClick}">
290   - {{bc.fcsj}}
291   - <span class="badge"
292   - style="border-radius: 2px !important; background-color: #f9a124;"
293   - ng-show="bc.bcType == 'out'">出场</span>
294   - <span class="badge"
295   - style="border-radius: 2px !important; background-color: #f9a124;"
296   - ng-show="bc.bcType == 'in'">进场</span>
297   - </dd>
298   - <dd ng-class="{isClick : bc.isClick}">
299   - {{bc.ddsj}}
300   - </dd>
301   - <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd>
302   - </dl>
303   - </div>
304   - </div>
305   - </div>
306   - </div>
307   - </div>
308   - </div>
309   - </div>
310   -
311   - <div class="col-md-6" style="height: 100%; padding-left: 3px;">
312   - <div class="detail-panel">
313   - <div class="detail-wrap" >
314   - <h3 class="detail-title">
315   - 下行:
316   - {{$saTimeTablePreviewCtrl.internalBcModel.down_qdz_name}}
317   - <i class="fa fa-angle-double-right" aria-hidden="true"></i>
318   - {{$saTimeTablePreviewCtrl.internalBcModel.down_zdz_name}}
319   - </h3>
320   - <div class="detail-body">
321   - <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".downFixHead">
322   - <div class="ttpv_table">
323   - <div class="ttpv_table_head downFixHead">
324   - <dl>
325   - <dt>序号</dt>
326   - <dt>路牌</dt>
327   - <dt>发车时间</dt>
328   - <dt>到达时间</dt>
329   - <dt>备注</dt>
330   - </dl>
331   - </div>
332   - <div class="ttpv_table_body">
333   - <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.down_bc_list_asc track by $index"
334   - ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, false)">
335   - <dd>{{$index + 1}}</dd>
336   - <dd ng-class="{isClick : bc.isClick}">
337   - {{bc.lpName}}
338   - </dd>
339   - <dd ng-class="{
340   - ists: (bc.isTs && !bc.isClick),
341   - istsClick: (bc.isTs && bc.isClick),
342   - region: (bc.bcType == 'region' && !bc.isClick),
343   - regionClick : (bc.bcType == 'region' && bc.isClick),
344   - isfb: (bc.isFb && !bc.isClick),
345   - isfbClick : (bc.isFb && bc.isClick),
346   - isClick: bc.isClick}">
347   - {{bc.fcsj}}
348   - <span class="badge"
349   - style="border-radius: 2px !important; background-color: #f9a124;"
350   - ng-show="bc.bcType == 'out'">出场</span>
351   - <span class="badge"
352   - style="border-radius: 2px !important; background-color: #f9a124;"
353   - ng-show="bc.bcType == 'in'">进场</span>
354   - </dd>
355   - <dd ng-class="{isClick : bc.isClick}">
356   - {{bc.ddsj}}
357   - </dd>
358   - <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd>
359   - </dl>
360   - </div>
361   - </div>
362   - </div>
363   - </div>
364   - </div>
365   - </div>
366   - </div>
367   -
368   - </div>
369   - </div>
370   -</div>
371   -
372   -
373   -
374   -
375   -
376   -
377   -
378   -
379   -
380   -
381   -
  1 +<style>
  2 + .ttpv_detail {
  3 + height: 100%;
  4 + }
  5 + .ttpv_detail .container-fluid {
  6 + height: 100%;
  7 + margin-left: 0;
  8 + }
  9 + .ttpv_detail .container-fluid>* {
  10 + padding: 0;
  11 + }
  12 + .ttpv_detail .container-fluid.top-container {
  13 + margin-top: 5px;
  14 + padding: 0;
  15 + }
  16 +
  17 + .ttpv_detail .detail-panel {
  18 + padding: 0;
  19 + height: 100%;
  20 + border: 1px solid #ddd;
  21 + background: #fafafa;
  22 + border-radius: 10px !important;
  23 + moz-user-select: -moz-none;
  24 + -moz-user-select: none;
  25 + -o-user-select: none;
  26 + -khtml-user-select: none;
  27 + -webkit-user-select: none;
  28 + -ms-user-select: none;
  29 + user-select: none;
  30 + }
  31 +
  32 + .ttpv_detail .detail-panel .detail-wrap {
  33 + height: calc(100% - 1px);
  34 + padding: 0;
  35 +
  36 + font-size: 14px;
  37 + color: #cccaca;
  38 + }
  39 +
  40 + .ttpv_detail .detail-panel .detail-wrap .detail-title {
  41 + margin: 7px 0 5px;
  42 + text-indent: 5px;
  43 + margin: 0;
  44 + height: 31px;
  45 + line-height: 31px;
  46 + color: #2765A7;
  47 + }
  48 +
  49 + .ttpv_detail .detail-panel .detail-wrap .detail-body {
  50 + height: calc(100% - 37px);
  51 + background: #fff;
  52 + }
  53 +
  54 + .ttpv_detail .detail-panel .detail-wrap .detail-body .ttpv_table_wrap {
  55 + width: 100%;
  56 + height: 100%;
  57 + border-left: 0;
  58 + border-bottom: 0;
  59 + overflow: auto;
  60 + }
  61 +
  62 +</style>
  63 +
  64 +<style>
  65 + /** 表格样式 */
  66 + .ttpv_table {
  67 + position: relative;
  68 + padding-top: 34px;
  69 + font-size: 13px;
  70 + }
  71 +
  72 + .ttpv_table dl {
  73 + display: block;
  74 + /*width: 100%;*/
  75 + margin: 0;
  76 + /*border-bottom: 1px solid;*/
  77 + cursor: default;
  78 + }
  79 + .ttpv_table dl {
  80 + font-size: 0;
  81 + white-space: nowrap;
  82 + }
  83 + .ttpv_table dl {
  84 + transition: all .1s ease;
  85 + }
  86 +
  87 + .ttpv_table dl dd, .ttpv_table dl dt {
  88 + display: inline-block;
  89 + white-space: nowrap;
  90 + overflow: hidden;
  91 + text-overflow: ellipsis;
  92 + height: 100%;
  93 + line-height: 34px;
  94 + border-right: 1px solid;
  95 + text-indent: 5px;
  96 + }
  97 + .ttpv_table dl dd, .ttpv_table dl dt {
  98 + border-right-color: #dedede;
  99 + font-size: 13px;
  100 + /*border-bottom: 1px solid #dedede;*/
  101 + border-top: 1px solid #dedede;
  102 + text-align: center;
  103 + }
  104 +
  105 + .ttpv_table > .ttpv_table_head {
  106 + position: absolute;
  107 + top: 0;
  108 + height: 34px;
  109 + background: #f5f5f5;
  110 + /*width: 100%;*/
  111 + line-height: 34px;
  112 + z-index: 1;
  113 + }
  114 + .ttpv_table_head dl {
  115 + border-bottom: 2px solid #96b9d7;
  116 + color: #333333;
  117 + height: 34px;
  118 + background-color: #f5f5f5;
  119 + }
  120 + .ttpv_table_head dl dt {
  121 + font-weight: normal;
  122 + font-size: 12px;
  123 + }
  124 +
  125 + .ttpv_table_head dl dt:nth-of-type(1) {
  126 + width: 50px;
  127 + height: 34px;
  128 + }
  129 + .ttpv_table_head dl dt:nth-of-type(2) {
  130 + width: 55px;
  131 + height: 34px;
  132 + }
  133 + .ttpv_table_head dl dt:nth-of-type(3) {
  134 + width: 120px;
  135 + height: 34px;
  136 + }
  137 + .ttpv_table_head dl dt:nth-of-type(4) {
  138 + width: 100px;
  139 + height: 34px;
  140 + }
  141 + .ttpv_table_head dl dt:nth-of-type(5) {
  142 + width: 200px;
  143 + height: 34px;
  144 + }
  145 +
  146 + .ttpv_table > .ttpv_table_body {
  147 + /*width: 100%;*/
  148 + position: absolute;
  149 + border-bottom: 1px solid #dedede;
  150 + }
  151 +
  152 + .ttpv_table_body dd.ists {
  153 + background: #105383 !important;
  154 + color: white !important;
  155 + }
  156 + .ttpv_table_body dd.region {
  157 + background: #686d7b !important;
  158 + color: white !important;
  159 + }
  160 + .ttpv_table_body dd.isfb {
  161 + background: #adff00 !important;
  162 + color: #501a1a !important;
  163 + }
  164 +
  165 + .ttpv_table_body dd.istsClick {
  166 + background: linear-gradient(to right,#8baabf,#105383,#808086)!important;
  167 + }
  168 + .ttpv_table_body dd.regionClick {
  169 + background: linear-gradient(to right,#8baabf,#686d7b,#a09997)!important;
  170 + }
  171 + .ttpv_table_body dd.isfbClick {
  172 + background: linear-gradient(to right,#8baabf,#adff00,#a09997)!important;
  173 + }
  174 +
  175 + .ttpv_table_body dl dd:nth-of-type(1) {
  176 + width: 50px;
  177 + height: 30px;
  178 + }
  179 + .ttpv_table_body dl dd:nth-of-type(2) {
  180 + width: 55px;
  181 + height: 30px;
  182 + }
  183 + .ttpv_table_body dl dd:nth-of-type(3) {
  184 + width: 120px;
  185 + height: 30px;
  186 + text-align: left;
  187 + }
  188 + .ttpv_table_body dl dd:nth-of-type(4) {
  189 + width: 100px;
  190 + height: 30px;
  191 + }
  192 + .ttpv_table_body dl dd:nth-of-type(5) {
  193 + width: 200px;
  194 + height: 30px;
  195 + }
  196 +
  197 + .ttpv_table_body dd:nth-of-type(1) {
  198 + color: #2765A7;
  199 + background: #eae8e8;
  200 + /*border-bottom: 1px solid #b3b3b3;*/
  201 + border-right: 1px solid #b3b3b3;
  202 + text-indent: -3px;
  203 + }
  204 + .ttpv_table_body dd:nth-of-type(n + 2) {
  205 + color: #2765A7;
  206 + }
  207 + .ttpv_table_body dl:hover {
  208 + box-shadow: 0 0 4px #656c71;
  209 + background: #f5fbff;
  210 + }
  211 + .ttpv_table_body dl:hover dd:nth-of-type(1) {
  212 + background: #fafafa;
  213 + background: linear-gradient(to right, #fafafa, #f5fbff);
  214 + }
  215 +
  216 + .isClick {
  217 + background: #8baabf!important;
  218 + color: #fff!important;
  219 + }
  220 +
  221 +</style>
  222 +
  223 +<style>
  224 + /** 滚动条css样式 */
  225 +
  226 + .ttpv_table_scrollbar::-webkit-scrollbar {
  227 + width: 18px;
  228 + height: 18px;
  229 + }
  230 +
  231 + .ttpv_table_scrollbar::-webkit-scrollbar-track, ::-webkit-scrollbar-thumb {
  232 + border-radius: 999px;
  233 + border: 5px solid transparent;
  234 + }
  235 +
  236 + .ttpv_table_scrollbar::-webkit-scrollbar-track {
  237 + box-shadow: 1px 1px 5px rgba(0, 0, 0, .2) inset;
  238 + }
  239 +
  240 + .ttpv_table_scrollbar::-webkit-scrollbar-thumb {
  241 + min-height: 20px;
  242 + background-clip: content-box;
  243 + box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset;
  244 + }
  245 +
  246 + .ttpv_table_scrollbar::-webkit-scrollbar-corner {
  247 + background: transparent;
  248 + }
  249 +</style>
  250 +
  251 +<div class="ttpv_detail">
  252 + <div class="container-fluid top-container">
  253 + <div class="col-md-12 container-fluid">
  254 + <div class="col-md-6" style="height: 100%; padding-right: 3px;">
  255 + <div class="detail-panel">
  256 + <div class="detail-wrap" >
  257 + <h3 class="detail-title">
  258 + 上行:
  259 + {{$saTimeTablePreviewCtrl.internalBcModel.up_qdz_name}}
  260 + <i class="fa fa-angle-double-right" aria-hidden="true"></i>
  261 + {{$saTimeTablePreviewCtrl.internalBcModel.up_zdz_name}}
  262 + </h3>
  263 + <div id="temp" class="detail-body">
  264 + <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".upFixHead">
  265 + <div class="ttpv_table">
  266 + <div class="ttpv_table_head upFixHead">
  267 + <dl>
  268 + <dt>序号</dt>
  269 + <dt>路牌</dt>
  270 + <dt>发车时间</dt>
  271 + <dt>到达时间</dt>
  272 + <dt>备注</dt>
  273 + </dl>
  274 + </div>
  275 + <div class="ttpv_table_body">
  276 + <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.up_bc_list_asc track by $index"
  277 + ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, true)">
  278 + <dd>{{$index + 1}}</dd>
  279 + <dd ng-class="{isClick : bc.isClick}">
  280 + {{bc.lpName}}
  281 + </dd>
  282 + <dd ng-class="{
  283 + ists: (bc.isTs && !bc.isClick),
  284 + istsClick: (bc.isTs && bc.isClick),
  285 + region: (bc.bcType == 'region' && !bc.isClick),
  286 + regionClick : (bc.bcType == 'region' && bc.isClick),
  287 + isfb: (bc.isFb && !bc.isClick),
  288 + isfbClick : (bc.isFb && bc.isClick),
  289 + isClick: bc.isClick}">
  290 + {{bc.fcsj}}
  291 + <span class="badge"
  292 + style="border-radius: 2px !important; background-color: #f9a124;"
  293 + ng-show="bc.bcType == 'out'">出场</span>
  294 + <span class="badge"
  295 + style="border-radius: 2px !important; background-color: #f9a124;"
  296 + ng-show="bc.bcType == 'in'">进场</span>
  297 + </dd>
  298 + <dd ng-class="{isClick : bc.isClick}">
  299 + {{bc.ddsj}}
  300 + </dd>
  301 + <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd>
  302 + </dl>
  303 + </div>
  304 + </div>
  305 + </div>
  306 + </div>
  307 + </div>
  308 + </div>
  309 + </div>
  310 +
  311 + <div class="col-md-6" style="height: 100%; padding-left: 3px;">
  312 + <div class="detail-panel">
  313 + <div class="detail-wrap" >
  314 + <h3 class="detail-title">
  315 + 下行:
  316 + {{$saTimeTablePreviewCtrl.internalBcModel.down_qdz_name}}
  317 + <i class="fa fa-angle-double-right" aria-hidden="true"></i>
  318 + {{$saTimeTablePreviewCtrl.internalBcModel.down_zdz_name}}
  319 + </h3>
  320 + <div class="detail-body">
  321 + <div class="ttpv_table_wrap ttpv_table_scrollbar" sa-tscrolly2 scrclass = ".downFixHead">
  322 + <div class="ttpv_table">
  323 + <div class="ttpv_table_head downFixHead">
  324 + <dl>
  325 + <dt>序号</dt>
  326 + <dt>路牌</dt>
  327 + <dt>发车时间</dt>
  328 + <dt>到达时间</dt>
  329 + <dt>备注</dt>
  330 + </dl>
  331 + </div>
  332 + <div class="ttpv_table_body">
  333 + <dl ng-repeat="bc in $saTimeTablePreviewCtrl.internalBcModel.down_bc_list_asc track by $index"
  334 + ng-click="$saTimeTablePreviewCtrl.$$bcDD_Click($index, false)">
  335 + <dd>{{$index + 1}}</dd>
  336 + <dd ng-class="{isClick : bc.isClick}">
  337 + {{bc.lpName}}
  338 + </dd>
  339 + <dd ng-class="{
  340 + ists: (bc.isTs && !bc.isClick),
  341 + istsClick: (bc.isTs && bc.isClick),
  342 + region: (bc.bcType == 'region' && !bc.isClick),
  343 + regionClick : (bc.bcType == 'region' && bc.isClick),
  344 + isfb: (bc.isFb && !bc.isClick),
  345 + isfbClick : (bc.isFb && bc.isClick),
  346 + isClick: bc.isClick}">
  347 + {{bc.fcsj}}
  348 + <span class="badge"
  349 + style="border-radius: 2px !important; background-color: #f9a124;"
  350 + ng-show="bc.bcType == 'out'">出场</span>
  351 + <span class="badge"
  352 + style="border-radius: 2px !important; background-color: #f9a124;"
  353 + ng-show="bc.bcType == 'in'">进场</span>
  354 + </dd>
  355 + <dd ng-class="{isClick : bc.isClick}">
  356 + {{bc.ddsj}}
  357 + </dd>
  358 + <dd ng-class="{isClick : bc.isClick}">{{bc.remark}}</dd>
  359 + </dl>
  360 + </div>
  361 + </div>
  362 + </div>
  363 + </div>
  364 + </div>
  365 + </div>
  366 + </div>
  367 +
  368 + </div>
  369 + </div>
  370 +</div>
  371 +
  372 +
  373 +
  374 +
  375 +
  376 +
  377 +
  378 +
  379 +
  380 +
  381 +
... ...