Commit 839dff249f85f3980f355c10c216a2dbb136644b

Authored by 徐烜
1 parent 27efa725

时刻表v2_2.3.2

将excel导出独立成类,放在main_v2_2_excel.js文件中
todo:excel类还有bug,放在v2_2.3.3版本更新
src/main/resources/static/index.html
@@ -630,9 +630,6 @@ @@ -630,9 +630,6 @@
630 <script 630 <script
631 src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" 631 src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"
632 data-exclude=1></script> 632 data-exclude=1></script>
633 -<!-- echarts4 误删 -->  
634 -<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script>  
635 -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>  
636 633
637 </body> 634 </body>
638 </html> 635 </html>
639 \ No newline at end of file 636 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/add.html
@@ -152,7 +152,7 @@ @@ -152,7 +152,7 @@
152 <input type="radio" class="icheck" name="baseRes" value=2 > 发车间隔分析(旧:一步调整) 152 <input type="radio" class="icheck" name="baseRes" value=2 > 发车间隔分析(旧:一步调整)
153 </label> 153 </label>
154 <label> 154 <label>
155 - <input type="radio" class="icheck" name="baseRes" value=3 checked> 发车间隔分析(新:增量调整-单向进场) 155 + <input type="radio" class="icheck" name="baseRes" value=3 checked> 发车间隔分析(新:增量调整-单向进场)
156 </label> 156 </label>
157 <label> 157 <label>
158 <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析 158 <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析
src/main/resources/static/pages/base/timesmodel/gantt.html
@@ -160,6 +160,11 @@ @@ -160,6 +160,11 @@
160 </div> 160 </div>
161 <!-- col-md-12 组件END --> 161 <!-- col-md-12 组件END -->
162 </div> 162 </div>
  163 +
  164 +
  165 +<!-- echarts4 误删 -->
  166 +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script>
  167 +
163 <!-- row 组件END --> 168 <!-- row 组件END -->
164 <script src="/pages/base/timesmodel/js/raty/lib/jquery.raty.js"></script> 169 <script src="/pages/base/timesmodel/js/raty/lib/jquery.raty.js"></script>
165 <script src="/pages/base/timesmodel/js/ContextJS/js/context.js"></script> 170 <script src="/pages/base/timesmodel/js/ContextJS/js/context.js"></script>
@@ -186,8 +191,8 @@ @@ -186,8 +191,8 @@
186 --> 191 -->
187 192
188 <script src="/pages/base/timesmodel/js/v2_2/InternalScheduleObj.js"></script> 193 <script src="/pages/base/timesmodel/js/v2_2/InternalScheduleObj.js"></script>
189 -<script src="/pages/base/timesmodel/js/v2_2/main_v2_2_excel.js"></script>  
190 <script src="/pages/base/timesmodel/js/v2_2/main_v2_2.js"></script> 194 <script src="/pages/base/timesmodel/js/v2_2/main_v2_2.js"></script>
  195 +<script src="/pages/base/timesmodel/js/v2_2/Main_v2_2_ExcelObj.js"></script>
191 <script src="/pages/base/timesmodel/js/v2_2/strategy/workhours/ModifyBcTripWHS1.js"></script> 196 <script src="/pages/base/timesmodel/js/v2_2/strategy/workhours/ModifyBcTripWHS1.js"></script>
192 <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS1.js"></script> 197 <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS1.js"></script>
193 <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS2.js"></script> 198 <script src="/pages/base/timesmodel/js/v2_2/strategy/headway/CalcuHeadwayS2.js"></script>
src/main/resources/static/pages/base/timesmodel/js/gantt.js
@@ -99,7 +99,6 @@ @@ -99,7 +99,6 @@
99 Main_v2.exportDataConfig(data.aInternalLpObj); 99 Main_v2.exportDataConfig(data.aInternalLpObj);
100 } else if (map.baseRes == '3') { // 主站停站使用v2_2版本 100 } else if (map.baseRes == '3') { // 主站停站使用v2_2版本
101 data = Main_v2_2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar); 101 data = Main_v2_2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar);
102 - Main_v2_2.exportDataConfig(data.aInternalLpObj);  
103 } 102 }
104 103
105 }else { 104 }else {
@@ -140,6 +139,11 @@ @@ -140,6 +139,11 @@
140 // graph.addHistory(); 139 // graph.addHistory();
141 // // 初始化右键菜单. 140 // // 初始化右键菜单.
142 // contextInit(graph); 141 // contextInit(graph);
  142 +
  143 + if (map.baseRes == '3') {
  144 + // 导入导出设置
  145 + Main_v2_2.exportExcelConfig($_GlobalGraph.getDataArray);
  146 + }
143 },500); 147 },500);
144 148
145 /** 149 /**
src/main/resources/static/pages/base/timesmodel/js/v2_2/Main_v2_2_ExcelObj.js 0 → 100644
  1 +/**
  2 + * v2_2版本时刻表excel对象。
  3 + */
  4 +var Main_v2_2_ExcelObj = (function() {
  5 + // html5导出下载文件方法
  6 + var _fnDownloadFile = function(data, mimeType, fileName) {
  7 + var success = false;
  8 + var blob = new Blob([data], { type: mimeType });
  9 + try {
  10 + if (navigator.msSaveBlob)
  11 + navigator.msSaveBlob(blob, fileName);
  12 + else {
  13 + // Try using other saveBlob implementations, if available
  14 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  15 + if (saveBlob === undefined) throw "Not supported";
  16 + saveBlob(blob, fileName);
  17 + }
  18 + success = true;
  19 + } catch (ex) {
  20 + console.log("saveBlob method failed with the following exception:");
  21 + console.log(ex);
  22 + }
  23 +
  24 + if (!success) {
  25 + // Get the blob url creator
  26 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  27 + if (urlCreator) {
  28 + // Try to use a download link
  29 + var link = document.createElement('a');
  30 + if ('download' in link) {
  31 + // Try to simulate a click
  32 + try {
  33 + // Prepare a blob URL
  34 + var url = urlCreator.createObjectURL(blob);
  35 + link.setAttribute('href', url);
  36 +
  37 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  38 + link.setAttribute("download", fileName);
  39 +
  40 + // Simulate clicking the download link
  41 + var event = document.createEvent('MouseEvents');
  42 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  43 + link.dispatchEvent(event);
  44 + success = true;
  45 +
  46 + } catch (ex) {
  47 + console.log("Download link method with simulated click failed with the following exception:");
  48 + console.log(ex);
  49 + }
  50 + }
  51 +
  52 + if (!success) {
  53 + // Fallback to window.location method
  54 + try {
  55 + // Prepare a blob URL
  56 + // Use application/octet-stream when using window.location to force download
  57 + var url = urlCreator.createObjectURL(blob);
  58 + window.location = url;
  59 + console.log("Download link method with window.location succeeded");
  60 + success = true;
  61 + } catch (ex) {
  62 + console.log("Download link method with window.location failed with the following exception:");
  63 + console.log(ex);
  64 + }
  65 + }
  66 + }
  67 + }
  68 +
  69 + if (!success) {
  70 + // Fallback to window.open method
  71 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  72 + window.open("", '_blank', '');
  73 + }
  74 + };
  75 +
  76 + // 计算导出参数sheet数据。
  77 + var _fnCalcuExportParam_sheet = function(_paramObj) {
  78 + return [
  79 + {'paramItem' : '上行首班时间', 'paramValue' : _paramObj.getUpFirstDTimeObj().format("HH:mm")},
  80 + {'paramItem' : '上行末班时间', 'paramValue' : _paramObj.getUpLastDtimeObj().format("HH:mm")},
  81 + {'paramItem' : '下行首班时间', 'paramValue' : _paramObj.getDownFirstDTimeObj().format("HH:mm")},
  82 + {'paramItem' : '下行末班时间', 'paramValue' : _paramObj.getDownLastDTimeObj().format("HH:mm")},
  83 + {'paramItem' : '早高峰开始时间', 'paramValue' : _paramObj.getMPeakStartTimeObj().format("HH:mm")},
  84 + {'paramItem' : '早高峰结束时间', 'paramValue' : _paramObj.getMPeakEndTimeObj().format("HH:mm")},
  85 + {'paramItem' : '晚高峰开始时间', 'paramValue' : _paramObj.getEPeakStartTimeObj().format("HH:mm")},
  86 + {'paramItem' : '晚高峰结束时间', 'paramValue' : _paramObj.getEPeakEndTimeObj().format("HH:mm")},
  87 + {'paramItem' : '上行进场时间', 'paramValue' : _paramObj.getUpInTime()},
  88 + {'paramItem' : '上行出场时间', 'paramValue' : _paramObj.getUpOutTime()},
  89 + {'paramItem' : '下行进场时间', 'paramValue' : _paramObj.getDownInTime()},
  90 + {'paramItem' : '下行出场时间', 'paramValue' : _paramObj.getDownOutTime()},
  91 + {'paramItem' : '早高峰上行时间', 'paramValue' : _paramObj.getUpMPeakTime()},
  92 + {'paramItem' : '早高峰下行时间', 'paramValue' : _paramObj.getDownMPeakTime()},
  93 + {'paramItem' : '晚高峰上行时间', 'paramValue' : _paramObj.getUpEPeakTime()},
  94 + {'paramItem' : '晚高峰下行时间', 'paramValue' : _paramObj.getDownEPeakTime()},
  95 + {'paramItem' : '低谷上行时间', 'paramValue' : _paramObj.getUpTroughTime()},
  96 + {'paramItem' : '低谷下行时间', 'paramValue' : _paramObj.getDownTroughTime()},
  97 + {'paramItem' : '线路规划类型', 'paramValue' : "双向"},
  98 + {'paramItem' : '吃饭地点', 'paramValue' : _paramObj.fnIsEat() ? (_paramObj.fnIsBothEat() ? "上下行" : (_paramObj.fnIsUpEat() ? "上行" : "下行")) : "不吃饭"},
  99 + {'paramItem' : '早晚例行保养', 'paramValue' : _paramObj.getLbTime()},
  100 + {'paramItem' : '停车场', 'paramValue' : _paramObj.getTccId()},
  101 + {'paramItem' : '工作餐午餐时间', 'paramValue' : _paramObj.fnGetLunchTime()},
  102 + {'paramItem' : '工作餐晚餐时间', 'paramValue' : _paramObj.fnGetDinnerTime()},
  103 + {'paramItem' : '早高峰发车间隔', 'paramValue' : "[" + _paramObj.getMPeakMinFcjx() + "," + _paramObj.getMPeakMaxFcjx() + "]"},
  104 + {'paramItem' : '晚高峰发车间隔', 'paramValue' : "[" + _paramObj.getEPeakMinFcjx() + "," + _paramObj.getEPeakMaxFcjx() + "]"},
  105 + {'paramItem' : '低谷发车间隔', 'paramValue' : "[" + _paramObj.getTroughMinFcjx() + "," + _paramObj.getTroughMaxFcjx() + "]"},
  106 + {'paramItem' : '建议加班路牌数', 'paramValue' : _paramObj.getJBLpes()},
  107 + {'paramItem' : '停站类型', 'paramValue' : _paramObj.isTwoWayStop() ? "双向停站" : (_paramObj.isUpOneWayStop() ? "上行主站" : "下行主站") },
  108 + {'paramItem' : '建议高峰配车数', 'paramValue' : _paramObj.getAdvicePeakClzs()}
  109 + ]
  110 + };
  111 +
  112 + // 计算班次统计数据sheet数据。
  113 + var _fnCalcuExportStatInfo_sheet = function(aBc, oParam) {
  114 + var countBc = 0, // 总班次
  115 + serviceBc = 0, // 营运班次
  116 + jcbc = 0, // 进场总班次.
  117 + ccbc = 0, // 出场总班次.
  118 + cfbc = 0, // 吃饭总班次.
  119 + zwlbbc = 0, // 早晚例保总班次.
  120 + countGs = 0.0, // 总工时
  121 + servicesj = 0, // 营运班次总时间
  122 + jcsj = 0.0, // 进场总时间.
  123 + ccsj = 0.0, // 出场总时间.
  124 + cfsj = 0.0, // 吃饭总时间.
  125 + zwlbsj = 0.0, // 早晚例保总时间.
  126 + ksBc = 0, // 空驶班次
  127 + serviceLc = 0.0, // 营运里程
  128 + ksLc = 0.0, // 空驶里程
  129 + avgTzjx = 0.0, // 平均停站间隙
  130 + gfServiceBc = 0, // 高峰营运班次
  131 + dgServiceBc = 0, // 低谷营运班次
  132 + gfAvgTzjx = 0.0, // 高峰平均停站间隙
  133 + dgAvgTzjx = 0.0; // 低谷平均停站间隙
  134 +
  135 + var i;
  136 + var oBc;
  137 + for (i = 0; i < aBc.length; i++) {
  138 + oBc = aBc[i];
  139 +
  140 + if (oBc.bcsj > 0) {
  141 + countBc = countBc + 1;
  142 + countGs = countGs + oBc.STOPTIME + oBc.bcsj;
  143 + if (oParam.isTroughBc(oParam.toTimeObj(oBc.fcsj))) {
  144 + if (oBc.bcType == "normal") {
  145 + dgServiceBc = dgServiceBc + 1;
  146 + dgAvgTzjx = dgAvgTzjx + oBc.STOPTIME;
  147 + }
  148 + } else {
  149 + if (oBc.bcType == "normal") {
  150 + gfServiceBc = gfServiceBc + 1;
  151 + gfAvgTzjx = gfAvgTzjx + oBc.STOPTIME;
  152 + }
  153 + }
  154 +
  155 + if (oBc.bcType == "normal" || oBc.bcType == "cf") {
  156 + serviceBc = serviceBc + 1;
  157 + serviceLc = serviceLc + oBc.jhlc;
  158 + servicesj = servicesj + oBc.bcsj;
  159 + avgTzjx = avgTzjx + oBc.STOPTIME;
  160 +
  161 + if (oBc.bcType == "cf") {
  162 + cfbc = cfbc + 1;
  163 + cfsj = cfsj + oBc.bcsj;
  164 + }
  165 + } else if (oBc.bcType == "in") {
  166 + jcbc = jcbc + 1;
  167 + jcsj = jcsj + oBc.bcsj;
  168 + } else if (oBc.bcType == "out") {
  169 + ccbc = ccbc + 1;
  170 + ccsj = ccsj + oBc.bcsj;
  171 + } else if (oBc.bcType == "bd") {
  172 + zwlbbc = zwlbbc + 1;
  173 + zwlbsj = zwlbsj + oBc.bcsj;
  174 + } else if (oBc.bcType == "lc") {
  175 + zwlbbc = zwlbbc + 1;
  176 + zwlbsj = zwlbsj + oBc.bcsj;
  177 + }
  178 + }
  179 + }
  180 +
  181 + dgAvgTzjx = dgAvgTzjx / dgServiceBc;
  182 + gfAvgTzjx = gfAvgTzjx / gfServiceBc;
  183 + avgTzjx = avgTzjx / dgServiceBc;
  184 +
  185 + return [
  186 + {'statItem': '总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)', 'statValue': countBc},
  187 + {'statItem': '进场总班次(包括进场且班次时间大于零的班次)', 'statValue': jcbc},
  188 + {'statItem': '出场总班次(包括进场且班次时间大于零的班次)', 'statValue': ccbc},
  189 + {'statItem': '吃饭总班次(包括吃饭且班次时间大于零的班次)', 'statValue': cfbc},
  190 + {'statItem': '早晚例保总班次(包括早晚例保且时间大于零的班次)', 'statValue': zwlbbc},
  191 + {'statItem': '营运总班次(包括正常、区间、放大站且班次时间大于零班次)','statValue': serviceBc},
  192 + {'statItem': '进场总时间(包括进场班次且班次时间大于零)', 'statValue': jcsj/60},
  193 + {'statItem': '出场总时间(包括进场班次且班次时间大于零)', 'statValue': ccsj/60},
  194 + {'statItem': '吃饭总时间(包括吃饭班次且班次时间大于零)', 'statValue': cfsj/60},
  195 + {'statItem': '早晚例保总时间(包括早晚例保班次且时间大于零的)', 'statValue': zwlbsj/60},
  196 + {'statItem': '营运班次总时间(包括正常、区间、放大站且班次时间大于零)', 'statValue': servicesj/60},
  197 + {'statItem': '总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)', 'statValue': countGs/60},
  198 + {'statItem': '空驶班次(包括直放班次)', 'statValue': ksBc},
  199 + {'statItem': '营运里程(包括正常、区间、放大站里程)', 'statValue': serviceLc},
  200 + {'statItem': '空驶里程(包括直放里程)', 'statValue': ksLc},
  201 + {'statItem': '平均停站时间(营运班次停站时间总和/营运总班次)', 'statValue': avgTzjx},
  202 + {'statItem': '高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)', 'statValue': gfServiceBc},
  203 + {'statItem': '低谷营运班次(包括低谷时段的正常、区间、放大站班次)', 'statValue': dgServiceBc},
  204 + {'statItem': '高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)', 'statValue': gfAvgTzjx},
  205 + {'statItem': '低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)', 'statValue': dgAvgTzjx},
  206 + {'statItem': '综合评估', 'statValue': 3}
  207 + ];
  208 +
  209 + };
  210 +
  211 + /**
  212 + * 内部计算Excel班次方法1,
  213 + * 这里是假设班次按照从早到晚排序,并且路牌也是从小到大排序。
  214 + * @param aExcelLp excel显示用路牌
  215 + * @param aGanttBc 甘特图班次列表
  216 + * @param oParam 参数对象
  217 + * @param bQIsUp 每一圈是上行开始还是下行开始
  218 + * @private
  219 + */
  220 + function InternalCalcuExcelBc1(aExcelLp, aGanttBc, oParam, bQIsUp) {
  221 + this._aExcelLp = aExcelLp;
  222 + this._oParam = oParam;
  223 + this._bQIsUp = bQIsUp;
  224 +
  225 + this._iUpGroupIndex = 0;
  226 + this._iDownGroupIndex = 0;
  227 +
  228 + // {"路牌名字":{"isFlag": 是否为标记班次(表示扫描过但是没有班次对象),"normal":正常班次}}
  229 + this._oLpGroupNormalGanttBc = {};
  230 + // {"路牌名字":{"cf":吃饭班次}}
  231 + this._oLpGroupCfGanttBc = {};
  232 +
  233 + // TODO:其他类型的班次再议
  234 +
  235 + // 计算上行gantt班次列表,下行gantt班次列表,并排序
  236 + var i;
  237 + var oGanttBc;
  238 + this._aUpGanttBc = [];
  239 + this._aDownGanttBc = [];
  240 + for (i = 0; i < aGanttBc.length; i++) {
  241 + oGanttBc = aGanttBc[i];
  242 + if (oGanttBc.xlDir == "relationshipGraph-up") {
  243 + this._aUpGanttBc.push(oGanttBc);
  244 + } else {
  245 + this._aDownGanttBc.push(oGanttBc);
  246 + }
  247 + }
  248 + this._aUpGanttBc.sort(function (o1, o2) { // 时间从早到晚排序
  249 + if (oParam.toTimeObj(o1.fcsj).isBefore(oParam.toTimeObj(o2.fcsj))) {
  250 + return -1;
  251 + } else {
  252 + return 1;
  253 + }
  254 + });
  255 + this._aDownGanttBc.sort(function (o1, o2) { // 时间从早到晚排序
  256 + if (oParam.toTimeObj(o1.fcsj).isBefore(oParam.toTimeObj(o2.fcsj))) {
  257 + return -1;
  258 + } else {
  259 + return 1;
  260 + }
  261 + });
  262 +
  263 + }
  264 +
  265 + //----------------------- 外部方法 -----------------------//
  266 + InternalCalcuExcelBc1.prototype.fnCalcuExcelLpBcList = function() {
  267 + // 计算Excel班次
  268 + this._calcuExcelBc(true); // 上行
  269 + // this._calcuExcelBc(false); // 下行
  270 +
  271 + // 设置路牌圈数,路由id
  272 + var iGroupCount = this._iUpGroupIndex > this._iDownGroupIndex ?
  273 + (this._iUpGroupIndex + 1) : (this._iDownGroupIndex + 1);
  274 +
  275 + var i;
  276 + var stationRouteId1;
  277 + var stationRouteId2;
  278 + var oGanttBc;
  279 + for (i = 0; i < this._aUpGanttBc.length; i++) {
  280 + oGanttBc = this._aUpGanttBc[i];
  281 + if (oGanttBc.bcType == "normal") {
  282 + if (this._bQIsUp) {
  283 + stationRouteId1 = oGanttBc.qdz;
  284 + break;
  285 + } else {
  286 + stationRouteId2 = oGanttBc.qdz;
  287 + break;
  288 + }
  289 + }
  290 + }
  291 + for (i = 0; i < this._aDownGanttBc.length; i++) {
  292 + oGanttBc = this._aUpGanttBc[i];
  293 + if (oGanttBc.bcType == "normal") {
  294 + if (!this._bQIsUp) {
  295 + stationRouteId1 = oGanttBc.qdz;
  296 + break;
  297 + } else {
  298 + stationRouteId2 = oGanttBc.qdz;
  299 + break;
  300 + }
  301 + }
  302 + }
  303 +
  304 + var oExcelLp;
  305 + for (i = 0; i < this._aExcelLp.length; i++) {
  306 + oExcelLp = this._aExcelLp[i];
  307 + oExcelLp.groupCount = iGroupCount;
  308 + oExcelLp.stationRouteId1 = stationRouteId1;
  309 + oExcelLp.stationRouteId2 = stationRouteId2;
  310 + }
  311 +
  312 + return this._aExcelLp;
  313 + };
  314 +
  315 + //----------------------- 内部方法 ------------------------//
  316 + /**
  317 + * 重新计算Excel显示班次。
  318 + * @param bIsUp 是否上行
  319 + */
  320 + InternalCalcuExcelBc1.prototype._calcuExcelBc = function(bIsUp) {
  321 + this._oLpGroupNormalGanttBc = {};
  322 + this._oLpGroupCfGanttBc = {};
  323 +
  324 + var i;
  325 + var j = 0;
  326 + var oExcelLp;
  327 + var oGanttBc;
  328 + var aGBc = bIsUp ? this._aUpGanttBc : this._aDownGanttBc;
  329 + for (i = 0; i < aGBc.length; i++) {
  330 + oGanttBc = aGBc[i];
  331 + while (j < this._aExcelLp.length) {
  332 + oExcelLp = this._aExcelLp[j];
  333 + if (this._isResetCalcuGroup(oGanttBc)) {
  334 + this._resetCalcuGroup(bIsUp);
  335 + j = 0;
  336 + i--;
  337 + break;
  338 + } else {
  339 + // TODO:其他类型班次再议
  340 +
  341 + if (oGanttBc.bcType == "cf") {
  342 + this._oLpGroupCfGanttBc[oGanttBc.lpName] = {
  343 + "cf": oGanttBc
  344 + };
  345 + break;
  346 + }
  347 +
  348 + if (oExcelLp.lpname == oGanttBc.lpName) {
  349 + if (oGanttBc.bcType == "normal") {
  350 + this._oLpGroupNormalGanttBc[oGanttBc.lpName] = {
  351 + "isFlag": false, "normal": oGanttBc
  352 + };
  353 + }
  354 + j = (j + 1) % this._aExcelLp.length;
  355 + break;
  356 + } else { // 当前路牌无对应班次,标记找过班次
  357 + this._oLpGroupNormalGanttBc[oExcelLp.lpname] = {
  358 + "isFlag": true, "normal": null
  359 + };
  360 + j = (j + 1) % this._aExcelLp.length;
  361 + }
  362 + }
  363 + }
  364 +
  365 + }
  366 +
  367 + };
  368 + InternalCalcuExcelBc1.prototype._resetCalcuGroup = function(bIsUp) {
  369 + // 重置计算圈及班次
  370 + var oExcelLp;
  371 + var oGroupGanttNormalBc;
  372 + var oGroupGanttEatBc;
  373 + for (var i = 0; i < this._aExcelLp.length; i++) {
  374 + oExcelLp = this._aExcelLp[i];
  375 + if (this._oLpGroupNormalGanttBc[oExcelLp.lpname]) {
  376 + if (!this._oLpGroupNormalGanttBc[oExcelLp.lpname].isFlag) { // 非标记班次
  377 + oGroupGanttNormalBc = this._oLpGroupNormalGanttBc[oExcelLp.lpname].normal;
  378 + }
  379 + }
  380 + if (this._oLpGroupCfGanttBc[oExcelLp.lpname]) {
  381 + oGroupGanttEatBc = this._oLpGroupCfGanttBc[oExcelLp.lpname].cf;
  382 + }
  383 + if (oGroupGanttNormalBc) {
  384 + oExcelLp.bcObjList.push({
  385 + "bcsj": oGroupGanttNormalBc.bcsj, // 班次时间
  386 + "ssj": oGroupGanttNormalBc.STOPTIME, // 停站时间
  387 + "eatsj": oGroupGanttEatBc ? oGroupGanttEatBc.bcsj : 0, // 吃饭时间
  388 +
  389 + "tccid": oGroupGanttNormalBc.tcc, // 停车场id
  390 + "qdzid": oGroupGanttNormalBc.qdz, // 起点站id
  391 + "zdzid": oGroupGanttNormalBc.zdz, // 终点站id
  392 +
  393 + "isUp": bIsUp, // 是否上行
  394 +
  395 + "bcType": oGroupGanttNormalBc.bcType, // 班次类型
  396 + "fcsj": oGroupGanttEatBc ?
  397 + ("*" + oGroupGanttNormalBc.fcsj) :
  398 + oGroupGanttNormalBc.fcsj, // 发车时间描述
  399 + "fcsjDesc": oGroupGanttEatBc ?
  400 + ("(吃" + oGroupGanttNormalBc.fcsj + ")") :
  401 + oGroupGanttNormalBc.fcsj, // 发车时间描述2
  402 +
  403 + "groupNo": bIsUp ? this._iUpGroupIndex : this._iDownGroupIndex, // 第几圈
  404 + "groupBcNo": bIsUp == this._bQIsUp ? 0 : 1 // 圈里第几个班次
  405 +
  406 + });
  407 + }
  408 + }
  409 +
  410 + if (bIsUp) {
  411 + this._iUpGroupIndex ++;
  412 + } else {
  413 + this._iDownGroupIndex ++;
  414 + }
  415 + this._oLpGroupNormalGanttBc = {};
  416 + this._oLpGroupCfGanttBc = {};
  417 + };
  418 + InternalCalcuExcelBc1.prototype._isResetCalcuGroup = function(oGanttBc) {
  419 + // 是否重置计算圈,当oGanttBc存在相同路牌的班次或者标记班次,算下一个圈
  420 + if (oGanttBc.bcType == "cf") {
  421 + return false;
  422 + }
  423 + if (this._oLpGroupNormalGanttBc[oGanttBc.lpName]) {
  424 + return true;
  425 + } else {
  426 + return false;
  427 + }
  428 +
  429 + };
  430 +
  431 + /**
  432 + * 内部Excel对象。
  433 + * @param oParam 参数对象
  434 + * @param fnGetGanttBcArray 返回gantt用的班次列表
  435 + * @constructor
  436 + */
  437 + function InternalExcelObj(oParam, fnGetGanttBcArray) {
  438 + this._oParam = oParam;
  439 + this.aGanttBc = fnGetGanttBcArray();
  440 +
  441 + // 每一圈是上行开始还是下行开始
  442 + this._qIsUp = oParam.getUpFirstDTimeObj().diff(oParam.getDownFirstDTimeObj()) <= 0 ? false : true;
  443 +
  444 + // 构造显示用lp对象
  445 + var oTempLpFlag = {};
  446 + var oGanttBc;
  447 + var aLp = [];
  448 + var oLp;
  449 + var i;
  450 + for (i = 0; i < this.aGanttBc.length; i++) {
  451 + oGanttBc = this.aGanttBc[i];
  452 + if (oTempLpFlag[oGanttBc.lpName]) {
  453 + // 已经存在路牌,不处理
  454 + continue;
  455 + }
  456 +
  457 + oLp = {
  458 + "lpname": oGanttBc.lpName, // 路牌名字
  459 + "isUp": this._qIsUp, // 每圈的第一个班次是否上行
  460 + "bcObjList": [], // 内部班次列表(后面计算班次列表)
  461 + "groupCount": 0, // 总圈数(后面计算总圈数)
  462 + "zlc": 0, // 总里程
  463 + "yylc": 0, // 营运里程
  464 + "kslc": 0, // 空驶里程
  465 + "zgs": 0, // 总工时
  466 + "zbc": 0, // 总班次
  467 + "yygs": 0, // 营运工时
  468 + "yybc": 0, // 营运班次
  469 + "stationRouteId1": 0, // 第一个班次起点站路由id
  470 + "stationRouteId2": 0 // 第二个班次起点站路由id
  471 + };
  472 + oTempLpFlag[oGanttBc.lpName] = {"flag" : true}; // 标记一下
  473 + aLp.push(oLp);
  474 + }
  475 +
  476 + // 计算Excel班次
  477 + this._celb = new InternalCalcuExcelBc1(aLp, this.aGanttBc, oParam, this._qIsUp);
  478 +
  479 + }
  480 +
  481 + // html5导出excel方法
  482 + InternalExcelObj.prototype.downloadFile = function(data, mimeType, fileName) {
  483 + _fnDownloadFile(data, mimeType, fileName);
  484 + };
  485 + /**
  486 + * 获取班次统计数据。
  487 + */
  488 + InternalExcelObj.prototype.fnGetStatInfoList = function() {
  489 + return _fnCalcuExportStatInfo_sheet(this.aGanttBc, this._oParam);
  490 + };
  491 + /**
  492 + * 获取参数数据。
  493 + */
  494 + InternalExcelObj.prototype.fnGetParamInfoList = function() {
  495 + return _fnCalcuExportParam_sheet(this._oParam);
  496 + };
  497 + /**
  498 + * 获取路牌班次数据。
  499 + * @return {*}
  500 + */
  501 + InternalExcelObj.prototype.fnGetLpBcInfoList = function() {
  502 + return this._celb.fnCalcuExcelLpBcList();
  503 + };
  504 +
  505 + return InternalExcelObj;
  506 +
  507 +} ());
0 \ No newline at end of file 508 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/js/v2_2/main_v2_2.js
@@ -58,160 +58,90 @@ var Main_v2_2 = function() { @@ -58,160 +58,90 @@ var Main_v2_2 = function() {
58 }; 58 };
59 }, 59 },
60 60
61 - //----------------------------------- 导入导出方法 -----------------------------------// 61 + //----------------------------------- 导入导出配置 -----------------------------------//
62 62
63 /** 63 /**
64 * 导出时刻表配置。 64 * 导出时刻表配置。
65 - * @param aInternalLpObj 内部路牌对象列表 65 + * @param fnGetGanttBc 获取gantt班次方法
66 */ 66 */
67 - exportDataConfig: function(aInternalLpObj) { 67 + exportExcelConfig: function(fnGetGanttBc) {
  68 + var oExcel = new Main_v2_2_ExcelObj(_paramObj, fnGetGanttBc);
  69 +
68 $('.exportAddXls').off('click'); 70 $('.exportAddXls').off('click');
69 $('.exportAddXlsx').off('click'); 71 $('.exportAddXlsx').off('click');
70 72
71 $('.exportAddXls').on('click', function() { 73 $('.exportAddXls').on('click', function() {
72 - alert("测试中....."); 74 + alert("dddd");
  75 +
  76 +
  77 + var aInfos = {
  78 + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
  79 + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
  80 + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
  81 + };
  82 +
  83 + console.log(aInfos);
  84 +
  85 + $(".exportAdd").addClass("disabled");
  86 + $(".exportAddSpan").html("正在导出...");
  87 +
  88 + // 提交
  89 + $.ajax({
  90 + type: 'POST',
  91 + url: "/tidc/exportDTDFile/xls",
  92 + dataType: 'binary',
  93 + contentType: "application/json",
  94 + data: JSON.stringify(aInfos),
  95 + success: function(data){
  96 + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
  97 +
  98 + $(".exportAdd").removeClass("disabled");
  99 + $(".exportAddSpan").html(" 导出数据");
  100 + },
  101 + error: function(xhr, type){
  102 + alert('错误:TODO');
  103 +
  104 + $(".exportAdd").removeClass("disabled");
  105 + $(".exportAddSpan").html(" 导出数据");
  106 + }
  107 + });
73 }); 108 });
  109 +
74 $('.exportAddXlsx').on('click', function() { 110 $('.exportAddXlsx').on('click', function() {
75 - alert("测试中....."); 111 + var aInfos = {
  112 + "lpObjList": oExcel.fnGetLpBcInfoList(), // 路牌班次信息列表
  113 + "statInfoList": oExcel.fnGetStatInfoList(), // 统计项目列表
  114 + "parameterInfoList" : oExcel.fnGetParamInfoList() // 参数对象
  115 + };
  116 +
  117 + console.log(aInfos);
  118 +
  119 + $(".exportAdd").addClass("disabled");
  120 + $(".exportAddSpan").html("正在导出...");
  121 +
  122 + // 提交
  123 + $.ajax({
  124 + type: 'POST',
  125 + url: "/tidc/exportDTDFile/xlsx",
  126 + dataType: 'binary',
  127 + contentType: "application/json",
  128 + data: JSON.stringify(aInfos),
  129 + success: function(data){
  130 + oExcel.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
  131 +
  132 + $(".exportAdd").removeClass("disabled");
  133 + $(".exportAddSpan").html(" 导出数据");
  134 + },
  135 + error: function(xhr, type){
  136 + alert('错误:TODO');
  137 +
  138 + $(".exportAdd").removeClass("disabled");
  139 + $(".exportAddSpan").html(" 导出数据");
  140 + }
  141 + });
76 }); 142 });
  143 + }
77 144
78 - // $('.exportAddXls').on('click', function() {  
79 - // var aInfos = {  
80 - // "lpObjList": Main_v2_2_excel[0](aInternalLpObj, _paramObj), // 路牌班次信息列表  
81 - // "statInfoList": Main_v2_2_excel[1](aInternalLpObj, _paramObj), // 统计项目列表  
82 - // "parameterInfoList" : Main_v2_2_excel[2](_paramObj) // 参数对象  
83 - // };  
84 - //  
85 - // console.log(aInfos);  
86 - //  
87 - // $(".exportAdd").addClass("disabled");  
88 - // $(".exportAddSpan").html("正在导出...");  
89 - //  
90 - // // 提交  
91 - // $.ajax({  
92 - // type: 'POST',  
93 - // url: "/tidc/exportDTDFile/xls",  
94 - // dataType: 'binary',  
95 - // contentType: "application/json",  
96 - // data: JSON.stringify(aInfos),  
97 - // success: function(data){  
98 - // Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls");  
99 - //  
100 - // $(".exportAdd").removeClass("disabled");  
101 - // $(".exportAddSpan").html(" 导出数据");  
102 - // },  
103 - // error: function(xhr, type){  
104 - // alert('错误:TODO');  
105 - //  
106 - // $(".exportAdd").removeClass("disabled");  
107 - // $(".exportAddSpan").html(" 导出数据");  
108 - // }  
109 - // });  
110 - // });  
111 - //  
112 - // $('.exportAddXlsx').on('click', function() {  
113 - // var aInfos = {  
114 - // "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表  
115 - // "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj), // 统计项目列表  
116 - // "parameterInfoList" : __funCalcuExportData_paramInfoList() // 参数对象  
117 - // };  
118 - //  
119 - // console.log(aInfos);  
120 - //  
121 - // $(".exportAdd").addClass("disabled");  
122 - // $(".exportAddSpan").html("正在导出...");  
123 - //  
124 - // // 提交  
125 - // $.ajax({  
126 - // type: 'POST',  
127 - // url: "/tidc/exportDTDFile/xlsx",  
128 - // dataType: 'binary',  
129 - // contentType: "application/json",  
130 - // data: JSON.stringify(aInfos),  
131 - // success: function(data){  
132 - // Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");  
133 - //  
134 - // $(".exportAdd").removeClass("disabled");  
135 - // $(".exportAddSpan").html(" 导出数据");  
136 - // },  
137 - // error: function(xhr, type){  
138 - // alert('错误:TODO');  
139 - //  
140 - // $(".exportAdd").removeClass("disabled");  
141 - // $(".exportAddSpan").html(" 导出数据");  
142 - // }  
143 - // });  
144 - // });  
145 - },  
146 -  
147 - downloadFile: function (data, mimeType, fileName) {  
148 - var success = false;  
149 - var blob = new Blob([data], { type: mimeType });  
150 - try {  
151 - if (navigator.msSaveBlob)  
152 - navigator.msSaveBlob(blob, fileName);  
153 - else {  
154 - // Try using other saveBlob implementations, if available  
155 - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;  
156 - if (saveBlob === undefined) throw "Not supported";  
157 - saveBlob(blob, fileName);  
158 - }  
159 - success = true;  
160 - } catch (ex) {  
161 - console.log("saveBlob method failed with the following exception:");  
162 - console.log(ex);  
163 - }  
164 -  
165 - if (!success) {  
166 - // Get the blob url creator  
167 - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;  
168 - if (urlCreator) {  
169 - // Try to use a download link  
170 - var link = document.createElement('a');  
171 - if ('download' in link) {  
172 - // Try to simulate a click  
173 - try {  
174 - // Prepare a blob URL  
175 - var url = urlCreator.createObjectURL(blob);  
176 - link.setAttribute('href', url);  
177 -  
178 - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)  
179 - link.setAttribute("download", fileName);  
180 -  
181 - // Simulate clicking the download link  
182 - var event = document.createEvent('MouseEvents');  
183 - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);  
184 - link.dispatchEvent(event);  
185 - success = true;  
186 -  
187 - } catch (ex) {  
188 - console.log("Download link method with simulated click failed with the following exception:");  
189 - console.log(ex);  
190 - }  
191 - }  
192 145
193 - if (!success) {  
194 - // Fallback to window.location method  
195 - try {  
196 - // Prepare a blob URL  
197 - // Use application/octet-stream when using window.location to force download  
198 - var url = urlCreator.createObjectURL(blob);  
199 - window.location = url;  
200 - console.log("Download link method with window.location succeeded");  
201 - success = true;  
202 - } catch (ex) {  
203 - console.log("Download link method with window.location failed with the following exception:");  
204 - console.log(ex);  
205 - }  
206 - }  
207 - }  
208 - }  
209 -  
210 - if (!success) {  
211 - // Fallback to window.open method  
212 - console.log("No methods worked for saving the arraybuffer, using last resort window.open");  
213 - window.open("", '_blank', '');  
214 - }  
215 - }  
216 } 146 }
217 }(); 147 }();
218 \ No newline at end of file 148 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/paramadd.html
1 -<!-- 统计数据 -->  
2 -<style>  
3 - .form-control:focus {  
4 - border-color: #53ced9;  
5 - }  
6 - .tagsDiv {  
7 - border: 1px solid #c2cad8;  
8 - margin-left: 15px;  
9 - padding: 4px 15px 4px 15px;  
10 - width: 50%;  
11 - }  
12 -</style>  
13 -<div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true">  
14 - <div class="modal-dialog" style="margin-left: 100px;">  
15 - <div class="modal-content" style="width: 1000px;">  
16 - <div class="modal-header">  
17 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>  
18 - <h4 class="modal-title">参数数据 </h4>  
19 - </div>  
20 - <div class="modal-body">  
21 - <form class="form-horizontal" id="param_form" action="/" method="POST" novalidate="novalidate">  
22 - <div class="form-body">  
23 - <div class="alert alert-danger display-hide">  
24 - <button class="close" data-close="alert"></button>  
25 - 您的输入有误,请检查下面的输入项  
26 - </div>  
27 - <div class="alert alert-success display-none">  
28 - <button class="close" data-dismiss="alert"></button>  
29 - 验证成功!  
30 - </div>  
31 -  
32 - </div>  
33 -  
34 - <div class="tab-pane" id="ptab">  
35 -  
36 - </div>  
37 - </form>  
38 - </div>  
39 -  
40 - <div class="modal-footer">  
41 - <button type="button" class="btn default" data-dismiss="modal" id="paramcancel">  
42 - <span class="paramcancelSpan">取消</span>  
43 - </button>  
44 - <button type="button" class="btn btn-primary" id="paramnext">  
45 - <span class="paramnextSpan">确定</span>  
46 - </button>  
47 - </div>  
48 -  
49 - </div>  
50 - </div>  
51 -</div>  
52 -  
53 -<script type="text/html" id = "paramAdd_temp">  
54 - <div class="form-group">  
55 - <div class="col-md-6">  
56 - <label class="control-label col-md-5">  
57 - <span class="required"> * </span> 上行首班时间 :  
58 - </label>  
59 - <div class="col-md-5">  
60 - <input type="text" class="form-control" name="startStationFirstTime" value="{{map.startStationFirstTime}}" id="startStationFirstTime_id"  
61 - placeholder="请输入起始站首班时间">  
62 - </div>  
63 - </div>  
64 - <div class="col-md-6">  
65 - <label class="control-label col-md-5">  
66 - <span class="required"> * </span> 上行末班时间 :  
67 - </label>  
68 - <div class="col-md-5">  
69 - <input type="text" class="form-control" name="startStationEndTime" value="{{map.startStationEndTime}}" id="startStationEndTime_id"  
70 - placeholder="请输入起始站末班时间">  
71 - </div>  
72 - </div>  
73 - </div>  
74 -  
75 - <div class="form-group">  
76 - <div class="col-md-6">  
77 - <label class="control-label col-md-5">  
78 - <span class="required"> * </span> 下行首班时间 :  
79 - </label>  
80 - <div class="col-md-5">  
81 - <input type="text" class="form-control" name="endStationFirstTime" value="{{map.endStationFirstTime}}" id="endStationFirstTime_id"  
82 - placeholder="请输入终点站首班时间">  
83 - </div>  
84 - </div>  
85 - <div class="col-md-6">  
86 - <label class="control-label col-md-5">  
87 - <span class="required"> * </span> 下行末班时间 :  
88 - </label>  
89 - <div class="col-md-5">  
90 - <input type="text" class="form-control" name="endStationEndTime" value="{{map.endStationEndTime}}" id="endStationEndTime_id"  
91 - placeholder="请输入终点站末班时间">  
92 - </div>  
93 - </div>  
94 - </div>  
95 -  
96 - <div class="form-group">  
97 - <div class="col-md-6">  
98 - <label class="control-label col-md-5">  
99 - <span class="required"> * </span> 早高峰开始时间 :  
100 - </label>  
101 - <div class="col-md-5">  
102 - <input type="text" class="form-control" name="earlyStartTime" value="{{map.earlyStartTime}}" id="earlyStartTime_id"  
103 - placeholder="请输入早高峰开始时间">  
104 - </div>  
105 - </div>  
106 - <div class="col-md-6">  
107 - <label class="control-label col-md-5">  
108 - <span class="required"> * </span> 早高峰结束时间 :  
109 - </label>  
110 - <div class="col-md-5">  
111 - <input type="text" class="form-control" name="earlyEndTime" value="{{map.earlyEndTime}}" id="earlyEndTime_id"  
112 - placeholder="请输入早高峰结束时间">  
113 - </div>  
114 - </div>  
115 - </div>  
116 -  
117 - <div class="form-group">  
118 - <div class="col-md-6">  
119 - <label class="control-label col-md-5">  
120 - <span class="required"> * </span> 晚高峰开始时间 :  
121 - </label>  
122 - <div class="col-md-5">  
123 - <input type="text" class="form-control" name="lateStartTime" value="{{map.lateStartTime}}" id="lateStartTime_id"  
124 - placeholder="请输入晚高峰开始时间">  
125 - </div>  
126 - </div>  
127 - <div class="col-md-6">  
128 - <label class="control-label col-md-5">  
129 - <span class="required"> * </span> 晚高峰结束时间 :  
130 - </label>  
131 - <div class="col-md-5">  
132 - <input type="text" class="form-control" name="lateEndTime" value="{{map.lateEndTime}}" id="lateEndTime_id"  
133 - placeholder="请输入晚高峰结束时间">  
134 - </div>  
135 - </div>  
136 - </div>  
137 -  
138 - <div class="form-group">  
139 - <div class="col-md-6">  
140 - <label class="control-label col-md-5">上行进场时间  :  
141 - </label>  
142 - <div class="col-md-5">  
143 - <input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"  
144 - placeholder="请输入上行进场时间">  
145 - </div>  
146 - </div>  
147 - <div class="col-md-6">  
148 - <label class="control-label col-md-5">上行出场时间  :  
149 - </label>  
150 - <div class="col-md-5">  
151 - <input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"  
152 - placeholder="请输入上行出场时间">  
153 - </div>  
154 - </div>  
155 - </div>  
156 -  
157 - <div class="form-group">  
158 - <div class="col-md-6">  
159 - <label class="control-label col-md-5">下行进场时间  :  
160 - </label>  
161 - <div class="col-md-5">  
162 - <input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"  
163 - placeholder="请输入下行进场时间">  
164 - </div>  
165 - </div>  
166 - <div class="col-md-6">  
167 - <label class="control-label col-md-5">下行出场时间  :  
168 - </label>  
169 - <div class="col-md-5">  
170 - <input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"  
171 - placeholder="请输入下行出场时间">  
172 - </div>  
173 - </div>  
174 - </div>  
175 -  
176 - <div class="form-group">  
177 - <div class="col-md-6">  
178 - <label class="control-label col-md-5">早高峰上行时间 :</label>  
179 - <div class="col-md-5">  
180 - <input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id"  
181 - placeholder="请输入早高峰上行时间">  
182 - </div>  
183 - </div>  
184 - <div class="col-md-6">  
185 - <label class="control-label col-md-5">早高峰下行时间 :</label>  
186 - <div class="col-md-5">  
187 - <input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id"  
188 - placeholder="请输入早高峰下行时间">  
189 - </div>  
190 - </div>  
191 - </div>  
192 -  
193 - <div class="form-group">  
194 - <div class="col-md-6">  
195 - <label class="control-label col-md-5">晚高峰上行时间 :</label>  
196 - <div class="col-md-5">  
197 - <input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id"  
198 - placeholder="请输入晚高峰上行时间">  
199 - </div>  
200 - </div>  
201 - <div class="col-md-6">  
202 - <label class="control-label col-md-5">晚高峰下行时间 :</label>  
203 - <div class="col-md-5">  
204 - <input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id"  
205 - placeholder="请输入晚高峰下行时间">  
206 - </div>  
207 - </div>  
208 - </div>  
209 -  
210 - <div class="form-group">  
211 - <div class="col-md-6">  
212 - <label class="control-label col-md-5">低谷上行时间  :</label>  
213 - <div class="col-md-5">  
214 - <input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id"  
215 - placeholder="请输入低谷上行时间">  
216 - </div>  
217 - </div>  
218 - <div class="col-md-6">  
219 - <label class="control-label col-md-5">低谷下行时间  :</label>  
220 - <div class="col-md-5">  
221 - <input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id"  
222 - placeholder="请输入低谷下行时间">  
223 - </div>  
224 - </div>  
225 - </div>  
226 -  
227 - <div class="form-group">  
228 - <div class="col-md-6">  
229 - <label class="control-label col-md-5">  
230 - <span class="required"> * </span> 线路规划类型  :  
231 - </label>  
232 - <div class="col-md-5">  
233 - <select name="linePlayType" class="form-control" id="linePlayType_id">  
234 - <option value="">-- 请选择线路类型 --</option>  
235 - <option value="0">双向</option>  
236 - <option value="1">环线</option>  
237 - </select>  
238 - </div>  
239 - </div>  
240 - <div class="col-md-6">  
241 - <label class="control-label col-md-5">吃饭地点    :</label>  
242 - <div class="col-md-5">  
243 - <select type="text" class="form-control" name="cfdd" id="cfdd_id">  
244 - <option value="">请选择...</option>  
245 - <option value="0">{{map.startStationName}}</option>  
246 - <option value="1">{{map.endStationName}}</option>  
247 - <option value="allYes">起终点站都可以</option>  
248 - </select>  
249 - </div>  
250 - </div>  
251 - </div>  
252 -  
253 - <div class="form-group">  
254 - <div class="col-md-6">  
255 - <label class="control-label col-md-5">早晚例行保养  :</label>  
256 - <div class="col-md-5">  
257 - <input type="text" class="form-control" name="lb" value="{{map.lb}}" id="lb_id"  
258 - placeholder="请输入早晚例行保养">  
259 - </div>  
260 - </div>  
261 - <div class="col-md-6">  
262 - <label class="control-label col-md-5">停车场     :</label>  
263 - <div class="col-md-5">  
264 - <select name="carPark" class="form-control" id="carPark_id" style="width:100%"></select>  
265 - </div>  
266 - </div>  
267 - </div>  
268 -  
269 -  
270 - <div class="form-group">  
271 - <div class="col-md-6">  
272 - <label class="control-label col-md-5">工作餐午餐时间 :</label>  
273 - <div class="col-md-5">  
274 - <input type="text" class="form-control" name="workeLunch" value="{{map.workeLunch}}" id="workeLunch_id"  
275 - placeholder="请输入工作餐午餐时间">  
276 - </div>  
277 - </div>  
278 - <div class="col-md-6">  
279 - <label class="control-label col-md-5">工作餐晚餐时间 :</label>  
280 - <div class="col-md-5">  
281 - <input type="text" class="form-control" name="workeDinner" value="{{map.workeDinner}}" id="workeDinner_id"  
282 - placeholder="请输入工作餐晚餐时间">  
283 - </div>  
284 - </div>  
285 - </div>  
286 -  
287 - <div class="form-group">  
288 - <div class="col-md-6">  
289 - <label class="control-label col-md-5"><span class="required"> * </span>早高峰发车间隔 :</label>  
290 - <div class="col-md-3" style="padding-right: 0px;">  
291 - <input type="text" class="form-control" name="zgffcjxmin" value="{{map.zgffcjxmin}}" id="zgffcjxmin_id"  
292 - placeholder="最小间隔">  
293 - </div>  
294 - <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>  
295 - <div class="col-md-3" style="padding-left: 0px;">  
296 - <input type="text" class="form-control" name="zgffcjxmax" value="{{map.zgffcjxmax}}" id="zgffcjxmax_id"  
297 - placeholder="最大间隔">  
298 - </div>  
299 - </div>  
300 - <div class="col-md-6">  
301 - <label class="control-label col-md-5"><span class="required"> * </span>晚高峰发车间隔 :</label>  
302 - <div class="col-md-3" style="padding-right: 0px;">  
303 - <input type="text" class="form-control" name="wffcjxmin" value="{{map.wffcjxmin}}" id="wffcjxmin_id"  
304 - placeholder="最小间隔">  
305 - </div>  
306 - <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>  
307 - <div class="col-md-3" style="padding-left: 0px;">  
308 - <input type="text" class="form-control" name="wffcjxmax" value="{{map.wffcjxmax}}" id="wffcjxmax_id"  
309 - placeholder="最大间隔">  
310 - </div>  
311 - </div>  
312 - </div>  
313 -  
314 - <div class="form-group">  
315 - <div class="col-md-6">  
316 - <label class="control-label col-md-5"><span class="required"> * </span>低谷发车间隔 :</label>  
317 - <div class="col-md-3" style="padding-right: 0px;">  
318 - <input type="text" class="form-control" name="dgfcjxmin" value="{{map.dgfcjxmin}}" id="dgfcjxmin_id"  
319 - placeholder="最小间隔">  
320 - </div>  
321 - <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>  
322 - <div class="col-md-3" style="padding-left: 0px;">  
323 - <input type="text" class="form-control" name="dgfcjxmax" value="{{map.dgfcjxmax}}" id="dgfcjxmax_id"  
324 - placeholder="最大间隔">  
325 - </div>  
326 - </div>  
327 - <div class="col-md-6">  
328 - <label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label>  
329 - <div class="col-md-5">  
330 - <input type="text" class="form-control" name="jbclcount" value="{{map.jbclcount}}" id="jbclcount_id"  
331 - placeholder="为0表示是周末时刻表">  
332 - </div>  
333 - </div>  
334 - </div>  
335 -  
336 - <div class="form-group">  
337 - <div class="col-md-6">  
338 - <label class="control-label col-md-5"><span class="required"> * </span>停站类型 :</label>  
339 - <div class="col-md-5 tagsDiv">  
340 - <div class="row" style="margin-left: 15px;">  
341 - <input type="text" value="{{map.stt}}" name="stt" id="stoptype_tagsinput" style="display: none;">  
342 - </div>  
343 -  
344 - <div class="row" style="margin-top: 10px;">  
345 - <label class="control-label col-md-4">停站类型:</label>  
346 - <div class="col-md-8">  
347 - <select name="stopType" class="form-control" id="stopType_id">  
348 - <option value="">-- 请选择停站类型 --</option>  
349 - <option value="0">主站停站</option>  
350 - <option value="1">双向停站</option>  
351 - </select>  
352 - </div>  
353 - </div>  
354 -  
355 - <div class="row" style="margin-top: 10px;">  
356 - <label class="control-label col-md-4">主站:</label>  
357 - <div class="col-md-8">  
358 - <select name="masterStop" class="form-control" id="masterStop_id">  
359 - <option value="">请选择...</option>  
360 - <option value="0">{{map.startStationName}}</option>  
361 - <option value="1">{{map.endStationName}}</option>  
362 - </select>  
363 - </div>  
364 - </div>  
365 -  
366 - <div class="row" style="margin-top: 10px;margin-left: 116px;">  
367 - <a href="javascript:" class="btn red" id="stoptype_tagsinput_add">添加</a>  
368 - </div>  
369 - </div>  
370 -  
371 - </div>  
372 -  
373 - <div class="col-md-6">  
374 - <div class="form-group">  
375 - <label class="control-label col-md-5">  
376 - <span class="required"> * </span> 建议高峰配车数 :</label>  
377 - <div class="col-md-5">  
378 - <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs"  
379 - id="gfjypcsInput" min="1" value="{{map.gfjypcs}}">  
380 - </div>  
381 - </div>  
382 - <div class="form-group">  
383 - <label class="control-label col-md-5">  
384 - <span class="required"> * </span> 生成策略  :  
385 - </label>  
386 - <div class="col-md-5">  
387 - <select name="strategy" class="form-control" id="strategy_id">  
388 - <option value="AdjustTripS1" selected>AdjustTripS1</option>  
389 - <option value="AdjustTripS2" disabled>AdjustTripS2</option>  
390 - <option value="AdjustTripS3">AdjustTripS3</option>  
391 - <option value="AdjustTripS4">AdjustTripS4</option>  
392 - </select>  
393 - </div>  
394 - </div>  
395 - </div>  
396 -  
397 -  
398 - </div>  
399 -  
400 -  
401 - <!-- 隐藏字段-时间 -->  
402 - <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/>  
403 - <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/>  
404 - <input type="hidden" name="xlmc" value="{{map.xlmc}}" id="xlmc_id"/>  
405 - <input type="hidden" name="lineName" value="{{map.lineName}}" id="lineName_id"/>  
406 - <input type="hidden" name="lineVersion" value="{{map.lineVersion}}" id="lineVersion_id"/>  
407 -  
408 - <!-- 上下行行驶时间 -->  
409 - <input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/>  
410 - <input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/>  
411 -  
412 - <!-- 隐藏字段-里程 -->  
413 - <!-- 上下行行驶里程 -->  
414 - <input type="hidden" name="upMileage" value="{{map.upMileage}}" id="upMileage_id"/>  
415 - <input type="hidden" name="downMileage" value="{{map.downMileage}}" id="downMileage_id"/>  
416 - <!-- 上下行进场出场里程 -->  
417 - <input type="hidden" name="upInMileage" value="{{map.upInMileage}}" id="upInMileage_id"/>  
418 - <input type="hidden" name="downInMileage" value="{{map.downInMileage}}" id="downInMileage_id"/>  
419 - <input type="hidden" name="upOutMileage" value="{{map.upOutMileage}}" id="upOutMileage_id"/>  
420 - <input type="hidden" name="downOutMileage" value="{{map.downOutMileage}}" id="downOutMileage_id"/>  
421 -  
422 -  
423 -</script>  
424 -  
425 -<script type="text/javascript">  
426 - $('#paramadd_mobal').on('paramAddMobal.show', function(e, mainFun, mainFun2_2, oSchedule_v2_2){  
427 - var _mainFun = mainFun;  
428 - var _mainFun_v2_2 = mainFun2_2;  
429 - var _oSchedule_v2_2 = oSchedule_v2_2;  
430 -  
431 - // 加载延迟200毫秒显示mobal  
432 - setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);  
433 - var param = JSON.parse(window.localStorage.Gantt_AgursData);  
434 -  
435 - // 获取表单元素  
436 - var form = $('#param_form');  
437 - // 错误提示元素  
438 - var paramAlert = $('.alert-danger', form);  
439 - // 确定事件点击  
440 - $('#paramnext').on('click', function() {  
441 - $("#paramcancel").addClass("disabled");  
442 - $("#paramnext").addClass("disabled");  
443 - $(".paramnextSpan").html("正在生成...");  
444 -  
445 - setTimeout(function() {  
446 - form.submit();// 表单提交  
447 - }, 500);  
448 -  
449 - // $("#paramnext").removeClass("disabled");  
450 - // $("#paramnext").html("确定");  
451 - });  
452 -  
453 - // 表单验证  
454 - form.validate({  
455 - errorElement : 'span',  
456 - errorClass : 'help-block help-block-error',  
457 - focusInvalid : false,  
458 - rules: {  
459 - 'skbName' : {required : true,},// 时刻表名称,必填项.  
460 - 'lineName' : {required : true,},// 线路名称,必填项.  
461 - 'lineVersion': {required: true}, // 站点路由版本,必填项,  
462 - 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项.  
463 - 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项.  
464 - 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项.  
465 - 'endStationEndTime' : {required : true}, // 终点站末班时间,必填项.  
466 - 'earlyStartTime' : {required : true},// 早高峰开始时间,必填项 .  
467 - 'earlyEndTime' : {required : true},// 早高峰结束时间,必填项 .  
468 - 'lateStartTime' : {required : true},// 晚高峰开始时间,必填项 .  
469 - 'lateEndTime' : {required : true},// 晚高峰结束时间,必填项.  
470 - 'upInTimer' : {number : true},// 上行进场时间,必须为数字.  
471 - 'upOutTimer' : {number : true},// 上行出场时间,必须为数字.  
472 - 'downInTimer' : {number : true},// 下行进场时间,必须为数字.  
473 - 'downOutTimer' : {number : true},// 下行出场时间,必须为数字.  
474 - 'earlyUpTime' : {number : true},// 早高峰上行时间,必须为数字.  
475 - 'earlyDownTime' : {number : true},// 早高峰下行时间,必须为数字.  
476 - 'lateUpTime' : {number : true},// 晚高峰上行时间,必须为数字.  
477 - 'lateDownTime' : {number : true},// 晚高峰下行时间,必须为数字.  
478 - 'troughUpTime' : {number : true},// 低谷上行时间,必须为数字.  
479 - 'troughDownTime' : {number : true},// 低谷下行时间,必须为数字.  
480 - 'linePlayType' : {required : true},// 线路规划类型,必填项  
481 - 'lb' : {number : true},// 早晚例行保养,必须为数字.  
482 - 'workeLunch' : {number : true},// 工作餐午餐时间,必须为数字.  
483 - 'workeDinner' : {number : true},// 工作餐晚餐时间,必须为数字.  
484 - 'zgffcjxmin' : {required : true,number : true,digits: true},// 早高峰最小发车间隔.  
485 - 'zgffcjxmax' : {required : true,number : true,digits: true},// 早高峰最大发车间隔.  
486 - 'wffcjxmin' : {required : true,number : true,digits: true},// 晚高峰最小发车间隔.  
487 - 'wffcjxmax' : {required : true,number : true,digits: true},// 晚高峰最大发车间隔.  
488 - 'dgfcjxmin' : {required : true,number : true,digits: true},// 低谷最小发车间隔.  
489 - 'dgfcjxmax' : {required : true,number : true,digits: true},// 低谷最大发车间隔.  
490 - 'jbclcount': {required : true,number : true,digits: true}, // 建议加班车数  
491 - 'upTravelTime' : {required : true,number : true},// 上行行驶时间,必填项、必须为整数.  
492 - 'downTravelTime' : {required : true,number : true},// 下行行驶时间,必填项、必须为整数.  
493 - 'upMileage' : {required : true,number : true},// 上行行驶里程,必填项、必须为整数.  
494 - 'downMileage' : {required : true,number : true},// 下行行驶里程,必填项、必须为整数.  
495 - 'upInMileage' : {number : true},// 上行进场里程,必须为数字.  
496 - 'upOutMileage' : {number : true},// 上行出场里程,必须为数字.  
497 - 'downInMileage' : {number : true},// 下行进场里程,必须为数字.  
498 - 'downOutMileage' : {number : true}, // 下行出场里程,必须为数字.  
499 -  
500 - 'strategy' : {required : true} // 生成策略标识  
501 -  
502 - // TODO  
503 - },  
504 - invalidHandler : function(event, validator) {  
505 - paramAlert.show();  
506 - App.scrollTo(paramAlert, -200);  
507 - },  
508 - highlight : function(element) {  
509 - $(element).closest('.form-group').addClass('has-error');  
510 - },  
511 - unhighlight : function(element) {  
512 - $(element).closest('.form-group').removeClass('has-error');  
513 - },  
514 - success : function(label) {  
515 - label.closest('.form-group').removeClass('has-error');  
516 - },  
517 - submitHandler : function(f) {  
518 - // 1、 获取表单内容,并序列化  
519 - var fp = form.serializeJSON();  
520 -  
521 - console.log(fp);  
522 -  
523 - // 2、重新刷新表单数据  
524 - var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData);  
525 - var key;  
526 - for (key in fp) {  
527 - if (ganttMap[key]) {  
528 - if (ganttMap[key] != fp[key]) {  
529 - ganttMap[key] = fp[key];  
530 - }  
531 - } else {  
532 - ganttMap[key] = fp[key];  
533 - }  
534 - }  
535 - window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap));  
536 -  
537 - // TODO  
538 - var pp = getParamObjAndDataMap();  
539 - var paramObj = pp[0];  
540 - var dataMap = pp[1];  
541 - var csMap = getCSMap(paramObj);  
542 - // console.log(graph);  
543 -  
544 - var data;  
545 -  
546 - if (ganttMap.baseRes == "2") { // v2版本  
547 - data = _mainFun.BXPplaceClassesTime03(paramObj, csMap.maxCar);  
548 - _mainFun.exportDataConfig(data.aInternalLpObj);  
549 - } else if (ganttMap.baseRes == "3") { // v2_2版本  
550 - csMap = getCSMap_v2(paramObj);  
551 - data = _mainFun_v2_2.BXPplaceClassesTime03(paramObj, csMap.maxCar);  
552 - _mainFun_v2_2.exportDataConfig(data.aInternalLpObj);  
553 - }  
554 -  
555 - echartsDrawGTT.init(data.json,true,true);  
556 -  
557 - // var data = obj.getDataArray();  
558 - // // 2、 调整路牌对应的班次总数  
559 - // updFormParams(params,data);  
560 - // 删除图形.  
561 - // $('svg.svg-chart').remove();  
562 - // // 重新创建图形.  
563 - // var graph = d3.select('#ganttSvg').relationshipGraph(getGraphArgus(csMap, dataMap, data));  
564 - // // 根据数据重新渲染图形.  
565 - // graph.data(data.json);  
566 - // // 记录早操.并保存历史班次数据  
567 - // graph.addHistory();  
568 - // 隐藏错误提示  
569 - paramAlert.hide();  
570 - // 隐藏 reladplus_mobal 弹出层  
571 - $('#paramadd_mobal').modal('hide');  
572 - layer.msg('成功!');  
573 - }  
574 - });  
575 -  
576 -  
577 - // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。  
578 - $('#paramadd_mobal').on('show.bs.modal', function () {  
579 - // TODO  
580 - // 把数据填充到模版中  
581 - // var tbodyHtml = template('countAdd_temp',{list:countDate});  
582 - // // 把渲染好的模版html文本追加到表格中  
583 - // $('#datatable_countadd tbody').html(tbodyHtml);  
584 - var htmldata = template('paramAdd_temp', {map : param});  
585 - $('#ptab').html(htmldata);  
586 -  
587 - // 线路规划类型  
588 - $('#linePlayType_id').val(param.linePlayType);  
589 - // 策略类型  
590 - $('#strategy_id').val(param.strategy || "AdjustTripS1");  
591 - // 吃饭地点  
592 - $get('/stationroute/all', {  
593 - 'line.id_eq': param.lineName.split('_')[0],  
594 - 'destroy_eq': 0,  
595 - 'versions_eq': param.lineVersion},  
596 - function(result) {  
597 - var opt = [];  
598 - opt.push('<option value="">请选择...</option>');  
599 - $.each(result, function(i, d) {  
600 - if (d.stationMark == 'B' && d.directions == 0) {  
601 - opt.push("<option value='0'>" + d.stationName + "</option>");  
602 - } else if (d.stationMark == 'E' && d.directions == 0) {  
603 - opt.push("<option value='1'>" + d.stationName + "</option>");  
604 - }  
605 - });  
606 - initTagsinput(opt.join(","));  
607 -  
608 - opt.push("<option value='allYes'>起终点站都可以</option>");  
609 - $('#cfdd_id').html(opt.join(""));  
610 - $('#cfdd_id').val(param.cfdd);  
611 -  
612 - }  
613 - );  
614 - // 停车场  
615 - $get('/carpark/all',null, function(cd) {  
616 - var opt = [];  
617 - opt.push('<option value="">请选择...</option><optgroup label="停车场">');  
618 - var $_len = cd.length;  
619 - if($_len > 0) {  
620 - $.each(cd, function(i, d){  
621 - opt.push('<option value="'+d.parkCode+'">'+d.parkName+'</option>');  
622 - });  
623 - }  
624 - opt.push('</optgroup>');  
625 - $('#carPark_id').html(opt.join(",")).select2();  
626 - $('#carPark_id').select2("val", param.carPark);  
627 - });  
628 -  
629 - // 上下行首末班日期控件  
630 - $('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
631 - $('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
632 - $('#endStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
633 - $('#endStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
634 -  
635 - // 早高峰晚高峰日期控件  
636 - $('#earlyStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
637 - $('#earlyEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
638 - $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
639 - $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});  
640 -  
641 - });  
642 -  
643 -  
644 -  
645 - //--------------------- 其他方法 ------------------------//  
646 -  
647 - function initTagsinput(htmlStr) {  
648 - $('#masterStop_id').html(htmlStr);  
649 -  
650 - var elt = $('#stoptype_tagsinput');  
651 - var value = elt.val();  
652 - var stoptype = value.split("/")[0];  
653 - var masterstop = value.split("/")[1];  
654 -  
655 - $('#stopType_id').val(stoptype);  
656 - $('#masterStop_id').val(masterstop);  
657 -  
658 - elt.tagsinput({  
659 - tagClass: function(item) {  
660 - return 'label label-danger label-important';  
661 - },  
662 - itemValue: 'value',  
663 - itemText: 'text'  
664 - });  
665 -  
666 - $('#stoptype_tagsinput').on('beforeItemAdd', function(event) {  
667 - // TODO:这里可以做一些逻辑判定  
668 - });  
669 -  
670 - $('#stoptype_tagsinput_add').on('click', function(){  
671 - var stoptype = $("#stopType_id").val();  
672 - var masterstop = $("#masterStop_id").val();  
673 - var masterstop_text = $("#masterStop_id option:selected").text();  
674 -  
675 - if (stoptype && stoptype != "") {  
676 - if (stoptype == "0" && masterstop && masterstop != "") {  
677 - elt.tagsinput('add', {  
678 - "value": stoptype + '/' + masterstop,  
679 - "text": "主站停站" + "/" + masterstop_text  
680 - });  
681 - } else {  
682 - elt.tagsinput('add', {  
683 - "value": 1,  
684 - "text": "双向停站"  
685 - });  
686 - }  
687 - }  
688 - });  
689 -  
690 - if (stoptype && stoptype != "") {  
691 - elt.tagsinput('add', {  
692 - "value": stoptype + '/' + masterstop,  
693 - "text":  
694 - $("#stopType_id option:selected").text() + "/" +  
695 - $("#masterStop_id option:selected").text()  
696 - });  
697 - }  
698 -  
699 - }  
700 -  
701 - function getMinDate(d1,d2) {  
702 - // 1、定义返回字符串.  
703 - var str = '';  
704 - // 2、判断时间大小.  
705 - if(strToTime(d1)>strToTime(d2))  
706 - str = d2;  
707 - else  
708 - str = d1;  
709 - // 3、返回最小时间(字符串).  
710 - return str;  
711 - }  
712 -  
713 - function strToTime(t) {  
714 - var d = new Date();  
715 - if(t) {  
716 - var _str = t.split(':');  
717 - d.setHours(parseInt(_str[0]));  
718 - d.setMinutes(parseInt(_str[1]));  
719 - }  
720 - return d;  
721 - }  
722 -  
723 - function getMaxDate(d1,d2) {  
724 - // 1、定义返回时间字符串.  
725 - var str = '';  
726 - // 2、判断时间大小.  
727 - if(strToTime(d1)>strToTime(d2))  
728 - str = d1;  
729 - else  
730 - str = d2;  
731 - // 3、返回一个最大时间(字符串).  
732 - return str;  
733 - }  
734 -  
735 - function getEndDate(date) {  
736 - var lastEndDate = Date.now();  
737 - if (date) {  
738 - var str = date.replace(/-/g,"/");  
739 - lastEndDate = new Date(str);  
740 - }  
741 - // Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间)  
742 - return lastEndDate;  
743 - }  
744 -  
745 - function formatPairing(v1,v2) {  
746 - v1 = v1 == '' ? 0 : parseInt(v1);  
747 - v2 = v2 == ''? 0 : parseInt(v2) ;  
748 - return [v1,v2];  
749 - }  
750 -  
751 - function qzdz(zd1,zd2) {  
752 - return [zd1,zd2];  
753 - }  
754 -  
755 - function formatksjssj(gp) {  
756 - return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}];  
757 - }  
758 -  
759 - function getsd(st,ed) {  
760 - return [{'st':st,'ed':ed}];  
761 - }  
762 -  
763 - function getDateTime(time) {  
764 - var dateTime = new Date();  
765 - var timeArr;  
766 - if(time !=null && time !='' && typeof(time) !='undefined') {  
767 - timeArr = time.split(':');  
768 - dateTime.setHours(parseInt(timeArr[0]));  
769 - dateTime.setMinutes(parseInt(timeArr[1]));  
770 - }  
771 - return dateTime;  
772 - }  
773 -  
774 - function getYAxisCarArray(len) {  
775 - var array = new Array();  
776 - if(len>0) {  
777 - for(var y = 0; y<len; y++) {  
778 - array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象  
779 - };  
780 - }  
781 - return array;  
782 - }  
783 -  
784 - function getylp(arr) {  
785 - var ra = new Array(),name = new Array();  
786 - for(var i = 0 ; i<arr.length;i++) {  
787 - ra.push(arr[i].lpNo);  
788 - name.push(arr[i].lpName);  
789 - }  
790 - return {'lpNoA':ra,'lpNameA':name,};  
791 - }  
792 -  
793 - function getParamObjAndDataMap() {  
794 - var map = JSON.parse(window.localStorage.Gantt_AgursData);  
795 - // seMap  
796 - var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),  
797 - 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};  
798 - // dirA  
799 - var dirA = ['relationshipGraph-up', 'relationshipGraph-down'];  
800 - // bcTypeArr  
801 - var bcTypeArr = {  
802 - 'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc',  
803 - 'major': 'major', 'venting': 'venting', 'region': 'region'  
804 - };  
805 - // seDate  
806 - var newDate = new Date();  
807 - var kssj = d3.time.hour.offset(getEndDate(  
808 - newDate.getFullYear()+ "-" +  
809 - (newDate.getMonth()+1) + "-" +  
810 - newDate.getDate() + ' ' +  
811 - seMap.s.split(':')[0] + ':00'),-1);  
812 -  
813 - var year = '' , month = '',dt = '';  
814 - if(newDate.getDate()+1>31)  
815 - dt = '01';  
816 - else  
817 - dt = newDate.getDate()+1;  
818 - if(newDate.getMonth()+1>12)  
819 - month = '01';  
820 - else if(newDate.getDate()+1>31)  
821 - month = newDate.getMonth()+2;  
822 - else  
823 - month = newDate.getMonth()+1;  
824 - if(newDate.getMonth()+1>12)  
825 - year = newDate.getFullYear()+1;  
826 - else  
827 - year = newDate.getFullYear();  
828 - var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');  
829 - seDate = {'kssj' : kssj, 'jssj' : jssj};  
830 -  
831 - // dataMap  
832 - var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下]  
833 - 'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下]  
834 - 'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下]  
835 - 'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下]  
836 - 'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下]  
837 - 'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime,  
838 - map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下]  
839 - 'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime,  
840 - map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下]  
841 - 'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下]  
842 - 'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下]  
843 - 'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下]  
844 - 'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚]  
845 - 'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间]  
846 - 'zgfsjd' : getsd(getDateTime(map.earlyStartTime),  
847 - getDateTime(map.earlyEndTime)), // 早高峰时间段  
848 - 'wgfsjd' : getsd(getDateTime(map.lateStartTime),  
849 - getDateTime(map.lateEndTime)),// 晚高峰时间段  
850 - 'gfzjsjd' : getsd(getDateTime(map.earlyEndTime),  
851 - getDateTime(map.lateStartTime)),//高峰之间时间段.  
852 - 'wgfzhsjd' : getsd(getDateTime(map.lateEndTime),  
853 - getDateTime(seMap.e)),// 晚高峰之后时间段  
854 - 'zgfzqsjd': getsd(getDateTime(seMap.s),  
855 - getDateTime(map.earlyStartTime)),//早高峰之前时间段.  
856 - 'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下]  
857 - 'bcTypeArr' : bcTypeArr,// 班次类型  
858 - 'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间.  
859 - // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间.  
860 - // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间.  
861 - // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间.  
862 - 'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间.  
863 - 'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间.  
864 - 'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间.  
865 - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙.  
866 - 'map' : map,  
867 - 'zzsj':map.zzsj,// 周转时间.  
868 - };  
869 -  
870 - var _paramObj = _mainFun.getFactory().createParameterObj(map, dataMap);  
871 -  
872 - if (!_paramObj.isTwoWayStop()) { // 主站停站使用v2_2版本  
873 - map.clzs = _oSchedule_v2_2.calcuClzx(_paramObj);  
874 - } else {  
875 - map.clzs = _paramObj.calcuClzx();  
876 - }  
877 -  
878 - return [_paramObj, dataMap];  
879 -  
880 - }  
881 -  
882 - function getCSMap(parmObj) {  
883 - var map = JSON.parse(window.localStorage.Gantt_AgursData);  
884 - return {'gattA':null,  
885 - 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,  
886 - 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),  
887 - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},  
888 - 'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))};  
889 - }  
890 - function getCSMap_v2(parmObj) {  
891 - var map = JSON.parse(window.localStorage.Gantt_AgursData);  
892 - return {'gattA':null,  
893 - 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,  
894 - 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),  
895 - 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},  
896 - 'maxCar':getYAxisCarArray(_oSchedule_v2_2.calcuClzx(parmObj))};  
897 - }  
898 -  
899 -  
900 - function getGraphArgus(CSMap, dataMap, data) {  
901 - // TODO  
902 - var map = JSON.parse(window.localStorage.Gantt_AgursData);  
903 - var sxsj = parseInt(map.upTravelTime);// 上行时间.  
904 -  
905 - // seMap  
906 - var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),  
907 - 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};  
908 -  
909 - // seDate  
910 - var newDate = new Date();  
911 - var kssj = d3.time.hour.offset(getEndDate(  
912 - newDate.getFullYear()+ "-" +  
913 - (newDate.getMonth()+1) + "-" +  
914 - newDate.getDate() + ' ' +  
915 - seMap.s.split(':')[0] + ':00'),-1);  
916 -  
917 - var year = '' , month = '',dt = '';  
918 - if(newDate.getDate()+1>31)  
919 - dt = '01';  
920 - else  
921 - dt = newDate.getDate()+1;  
922 - if(newDate.getMonth()+1>12)  
923 - month = '01';  
924 - else if(newDate.getDate()+1>31)  
925 - month = newDate.getMonth()+2;  
926 - else  
927 - month = newDate.getMonth()+1;  
928 - if(newDate.getMonth()+1>12)  
929 - year = newDate.getFullYear()+1;  
930 - else  
931 - year = newDate.getFullYear();  
932 - var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');  
933 - seDate = {'kssj' : kssj, 'jssj' : jssj};  
934 -  
935 -  
936 - var bs = sxsj > 40 ? 4 : 2;  
937 - var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs;  
938 - var VALUEKEYNAME = 'Worldwide Gross' ,  
939 - DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240,  
940 - MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60,  
941 - STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true;  
942 - var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ;  
943 - // 计算出相差天数  
944 - var days=Math.floor(dx_time/(24*3600*1000));  
945 - // 计算出小时数  
946 - var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数  
947 - var hours=Math.floor(leave1/(3600*1000));  
948 - DXHOURS = days*24+hours;  
949 - WIDTH = DXHOURS*MINUTE*MULTIPLE;  
950 - // debugger;  
951 - var lpsplitA = getylp(CSMap.maxCar);  
952 -  
953 - var sxsj = parseInt(map.upTravelTime);// 上行时间.  
954 - var xxsj = parseInt(map.downTravelTime);// 下行时间.  
955 - var stopAraay = [{  
956 - 'sxsj':sxsj,// 上行时间.  
957 - 'xxsj':xxsj,// 下行时间.  
958 - 'zzsj':map.zzsj,// 周转时间.  
959 - 'wcsj':parseInt(map.workeLunch),// 午餐时间.  
960 - 'wcsj':parseInt(map.workeDinner),// 晚餐时间.  
961 - 'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间.  
962 - 'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间.  
963 - 'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间.  
964 - 'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间.  
965 - 'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间.  
966 - 'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间.  
967 - 'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间.  
968 - 'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间.  
969 - 'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程.  
970 - 'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程.  
971 - 'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程.  
972 - 'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程.  
973 - 'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间.  
974 - }];  
975 -  
976 - var args = {  
977 - 'valueKeyName': VALUEKEYNAME,  
978 - 'hours' : DXHOURS,  
979 - 'dxHours' : 24 - DXHOURS,  
980 - 'multiple': MULTIPLE,  
981 - 'width':WIDTH,  
982 - 'widtMargin':MARGINLEFT,  
983 - 'height':HEIGHT,  
984 - 'heightMargin':MARGINBOTTOM,  
985 - 'offsetX':OFFSETX,  
986 - 'offsetY':OFFSETY,  
987 - 'downDy':OFFSETDOWNY,  
988 - 'upDy':OFFSETUPY,  
989 - 'timeDomainStart' :STARTDATETIME,  
990 - 'timeDomainEnd' : ENDDATETIME,  
991 - 'startStr':'' + STARTDATETIME,  
992 - 'endStr': '' +ENDDATETIME,  
993 - 'taskTypes': TASKTYPES,  
994 - 'lpNoA':lpsplitA.lpNoA,  
995 - 'lpNameA':lpsplitA.lpNameA,  
996 - 'tickFormat': TICKFORMAT,  
997 - 'stopAraay' : stopAraay,  
998 - 'dataMap':dataMap,  
999 - 'showTooltips': SHOWTOOLTIPS,  
1000 - 'bxrcgs':data.bxrcgs  
1001 - };  
1002 - return args;  
1003 - }  
1004 -  
1005 -  
1006 -  
1007 - });  
1008 - 1 +<!-- 统计数据 -->
  2 +<style>
  3 + .form-control:focus {
  4 + border-color: #53ced9;
  5 + }
  6 + .tagsDiv {
  7 + border: 1px solid #c2cad8;
  8 + margin-left: 15px;
  9 + padding: 4px 15px 4px 15px;
  10 + width: 50%;
  11 + }
  12 +</style>
  13 +<div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true">
  14 + <div class="modal-dialog" style="margin-left: 100px;">
  15 + <div class="modal-content" style="width: 1000px;">
  16 + <div class="modal-header">
  17 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  18 + <h4 class="modal-title">参数数据 </h4>
  19 + </div>
  20 + <div class="modal-body">
  21 + <form class="form-horizontal" id="param_form" action="/" method="POST" novalidate="novalidate">
  22 + <div class="form-body">
  23 + <div class="alert alert-danger display-hide">
  24 + <button class="close" data-close="alert"></button>
  25 + 您的输入有误,请检查下面的输入项
  26 + </div>
  27 + <div class="alert alert-success display-none">
  28 + <button class="close" data-dismiss="alert"></button>
  29 + 验证成功!
  30 + </div>
  31 +
  32 + </div>
  33 +
  34 + <div class="tab-pane" id="ptab">
  35 +
  36 + </div>
  37 + </form>
  38 + </div>
  39 +
  40 + <div class="modal-footer">
  41 + <button type="button" class="btn default" data-dismiss="modal" id="paramcancel">
  42 + <span class="paramcancelSpan">取消</span>
  43 + </button>
  44 + <button type="button" class="btn btn-primary" id="paramnext">
  45 + <span class="paramnextSpan">确定</span>
  46 + </button>
  47 + </div>
  48 +
  49 + </div>
  50 + </div>
  51 +</div>
  52 +
  53 +<script type="text/html" id = "paramAdd_temp">
  54 + <div class="form-group">
  55 + <div class="col-md-6">
  56 + <label class="control-label col-md-5">
  57 + <span class="required"> * </span> 上行首班时间 :
  58 + </label>
  59 + <div class="col-md-5">
  60 + <input type="text" class="form-control" name="startStationFirstTime" value="{{map.startStationFirstTime}}" id="startStationFirstTime_id"
  61 + placeholder="请输入起始站首班时间">
  62 + </div>
  63 + </div>
  64 + <div class="col-md-6">
  65 + <label class="control-label col-md-5">
  66 + <span class="required"> * </span> 上行末班时间 :
  67 + </label>
  68 + <div class="col-md-5">
  69 + <input type="text" class="form-control" name="startStationEndTime" value="{{map.startStationEndTime}}" id="startStationEndTime_id"
  70 + placeholder="请输入起始站末班时间">
  71 + </div>
  72 + </div>
  73 + </div>
  74 +
  75 + <div class="form-group">
  76 + <div class="col-md-6">
  77 + <label class="control-label col-md-5">
  78 + <span class="required"> * </span> 下行首班时间 :
  79 + </label>
  80 + <div class="col-md-5">
  81 + <input type="text" class="form-control" name="endStationFirstTime" value="{{map.endStationFirstTime}}" id="endStationFirstTime_id"
  82 + placeholder="请输入终点站首班时间">
  83 + </div>
  84 + </div>
  85 + <div class="col-md-6">
  86 + <label class="control-label col-md-5">
  87 + <span class="required"> * </span> 下行末班时间 :
  88 + </label>
  89 + <div class="col-md-5">
  90 + <input type="text" class="form-control" name="endStationEndTime" value="{{map.endStationEndTime}}" id="endStationEndTime_id"
  91 + placeholder="请输入终点站末班时间">
  92 + </div>
  93 + </div>
  94 + </div>
  95 +
  96 + <div class="form-group">
  97 + <div class="col-md-6">
  98 + <label class="control-label col-md-5">
  99 + <span class="required"> * </span> 早高峰开始时间 :
  100 + </label>
  101 + <div class="col-md-5">
  102 + <input type="text" class="form-control" name="earlyStartTime" value="{{map.earlyStartTime}}" id="earlyStartTime_id"
  103 + placeholder="请输入早高峰开始时间">
  104 + </div>
  105 + </div>
  106 + <div class="col-md-6">
  107 + <label class="control-label col-md-5">
  108 + <span class="required"> * </span> 早高峰结束时间 :
  109 + </label>
  110 + <div class="col-md-5">
  111 + <input type="text" class="form-control" name="earlyEndTime" value="{{map.earlyEndTime}}" id="earlyEndTime_id"
  112 + placeholder="请输入早高峰结束时间">
  113 + </div>
  114 + </div>
  115 + </div>
  116 +
  117 + <div class="form-group">
  118 + <div class="col-md-6">
  119 + <label class="control-label col-md-5">
  120 + <span class="required"> * </span> 晚高峰开始时间 :
  121 + </label>
  122 + <div class="col-md-5">
  123 + <input type="text" class="form-control" name="lateStartTime" value="{{map.lateStartTime}}" id="lateStartTime_id"
  124 + placeholder="请输入晚高峰开始时间">
  125 + </div>
  126 + </div>
  127 + <div class="col-md-6">
  128 + <label class="control-label col-md-5">
  129 + <span class="required"> * </span> 晚高峰结束时间 :
  130 + </label>
  131 + <div class="col-md-5">
  132 + <input type="text" class="form-control" name="lateEndTime" value="{{map.lateEndTime}}" id="lateEndTime_id"
  133 + placeholder="请输入晚高峰结束时间">
  134 + </div>
  135 + </div>
  136 + </div>
  137 +
  138 + <div class="form-group">
  139 + <div class="col-md-6">
  140 + <label class="control-label col-md-5">上行进场时间  :
  141 + </label>
  142 + <div class="col-md-5">
  143 + <input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"
  144 + placeholder="请输入上行进场时间">
  145 + </div>
  146 + </div>
  147 + <div class="col-md-6">
  148 + <label class="control-label col-md-5">上行出场时间  :
  149 + </label>
  150 + <div class="col-md-5">
  151 + <input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"
  152 + placeholder="请输入上行出场时间">
  153 + </div>
  154 + </div>
  155 + </div>
  156 +
  157 + <div class="form-group">
  158 + <div class="col-md-6">
  159 + <label class="control-label col-md-5">下行进场时间  :
  160 + </label>
  161 + <div class="col-md-5">
  162 + <input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"
  163 + placeholder="请输入下行进场时间">
  164 + </div>
  165 + </div>
  166 + <div class="col-md-6">
  167 + <label class="control-label col-md-5">下行出场时间  :
  168 + </label>
  169 + <div class="col-md-5">
  170 + <input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"
  171 + placeholder="请输入下行出场时间">
  172 + </div>
  173 + </div>
  174 + </div>
  175 +
  176 + <div class="form-group">
  177 + <div class="col-md-6">
  178 + <label class="control-label col-md-5">早高峰上行时间 :</label>
  179 + <div class="col-md-5">
  180 + <input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id"
  181 + placeholder="请输入早高峰上行时间">
  182 + </div>
  183 + </div>
  184 + <div class="col-md-6">
  185 + <label class="control-label col-md-5">早高峰下行时间 :</label>
  186 + <div class="col-md-5">
  187 + <input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id"
  188 + placeholder="请输入早高峰下行时间">
  189 + </div>
  190 + </div>
  191 + </div>
  192 +
  193 + <div class="form-group">
  194 + <div class="col-md-6">
  195 + <label class="control-label col-md-5">晚高峰上行时间 :</label>
  196 + <div class="col-md-5">
  197 + <input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id"
  198 + placeholder="请输入晚高峰上行时间">
  199 + </div>
  200 + </div>
  201 + <div class="col-md-6">
  202 + <label class="control-label col-md-5">晚高峰下行时间 :</label>
  203 + <div class="col-md-5">
  204 + <input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id"
  205 + placeholder="请输入晚高峰下行时间">
  206 + </div>
  207 + </div>
  208 + </div>
  209 +
  210 + <div class="form-group">
  211 + <div class="col-md-6">
  212 + <label class="control-label col-md-5">低谷上行时间  :</label>
  213 + <div class="col-md-5">
  214 + <input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id"
  215 + placeholder="请输入低谷上行时间">
  216 + </div>
  217 + </div>
  218 + <div class="col-md-6">
  219 + <label class="control-label col-md-5">低谷下行时间  :</label>
  220 + <div class="col-md-5">
  221 + <input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id"
  222 + placeholder="请输入低谷下行时间">
  223 + </div>
  224 + </div>
  225 + </div>
  226 +
  227 + <div class="form-group">
  228 + <div class="col-md-6">
  229 + <label class="control-label col-md-5">
  230 + <span class="required"> * </span> 线路规划类型  :
  231 + </label>
  232 + <div class="col-md-5">
  233 + <select name="linePlayType" class="form-control" id="linePlayType_id">
  234 + <option value="">-- 请选择线路类型 --</option>
  235 + <option value="0">双向</option>
  236 + <option value="1">环线</option>
  237 + </select>
  238 + </div>
  239 + </div>
  240 + <div class="col-md-6">
  241 + <label class="control-label col-md-5">吃饭地点    :</label>
  242 + <div class="col-md-5">
  243 + <select type="text" class="form-control" name="cfdd" id="cfdd_id">
  244 + <option value="">请选择...</option>
  245 + <option value="0">{{map.startStationName}}</option>
  246 + <option value="1">{{map.endStationName}}</option>
  247 + <option value="allYes">起终点站都可以</option>
  248 + </select>
  249 + </div>
  250 + </div>
  251 + </div>
  252 +
  253 + <div class="form-group">
  254 + <div class="col-md-6">
  255 + <label class="control-label col-md-5">早晚例行保养  :</label>
  256 + <div class="col-md-5">
  257 + <input type="text" class="form-control" name="lb" value="{{map.lb}}" id="lb_id"
  258 + placeholder="请输入早晚例行保养">
  259 + </div>
  260 + </div>
  261 + <div class="col-md-6">
  262 + <label class="control-label col-md-5">停车场     :</label>
  263 + <div class="col-md-5">
  264 + <select name="carPark" class="form-control" id="carPark_id" style="width:100%"></select>
  265 + </div>
  266 + </div>
  267 + </div>
  268 +
  269 +
  270 + <div class="form-group">
  271 + <div class="col-md-6">
  272 + <label class="control-label col-md-5">工作餐午餐时间 :</label>
  273 + <div class="col-md-5">
  274 + <input type="text" class="form-control" name="workeLunch" value="{{map.workeLunch}}" id="workeLunch_id"
  275 + placeholder="请输入工作餐午餐时间">
  276 + </div>
  277 + </div>
  278 + <div class="col-md-6">
  279 + <label class="control-label col-md-5">工作餐晚餐时间 :</label>
  280 + <div class="col-md-5">
  281 + <input type="text" class="form-control" name="workeDinner" value="{{map.workeDinner}}" id="workeDinner_id"
  282 + placeholder="请输入工作餐晚餐时间">
  283 + </div>
  284 + </div>
  285 + </div>
  286 +
  287 + <div class="form-group">
  288 + <div class="col-md-6">
  289 + <label class="control-label col-md-5"><span class="required"> * </span>早高峰发车间隔 :</label>
  290 + <div class="col-md-3" style="padding-right: 0px;">
  291 + <input type="text" class="form-control" name="zgffcjxmin" value="{{map.zgffcjxmin}}" id="zgffcjxmin_id"
  292 + placeholder="最小间隔">
  293 + </div>
  294 + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
  295 + <div class="col-md-3" style="padding-left: 0px;">
  296 + <input type="text" class="form-control" name="zgffcjxmax" value="{{map.zgffcjxmax}}" id="zgffcjxmax_id"
  297 + placeholder="最大间隔">
  298 + </div>
  299 + </div>
  300 + <div class="col-md-6">
  301 + <label class="control-label col-md-5"><span class="required"> * </span>晚高峰发车间隔 :</label>
  302 + <div class="col-md-3" style="padding-right: 0px;">
  303 + <input type="text" class="form-control" name="wffcjxmin" value="{{map.wffcjxmin}}" id="wffcjxmin_id"
  304 + placeholder="最小间隔">
  305 + </div>
  306 + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
  307 + <div class="col-md-3" style="padding-left: 0px;">
  308 + <input type="text" class="form-control" name="wffcjxmax" value="{{map.wffcjxmax}}" id="wffcjxmax_id"
  309 + placeholder="最大间隔">
  310 + </div>
  311 + </div>
  312 + </div>
  313 +
  314 + <div class="form-group">
  315 + <div class="col-md-6">
  316 + <label class="control-label col-md-5"><span class="required"> * </span>低谷发车间隔 :</label>
  317 + <div class="col-md-3" style="padding-right: 0px;">
  318 + <input type="text" class="form-control" name="dgfcjxmin" value="{{map.dgfcjxmin}}" id="dgfcjxmin_id"
  319 + placeholder="最小间隔">
  320 + </div>
  321 + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
  322 + <div class="col-md-3" style="padding-left: 0px;">
  323 + <input type="text" class="form-control" name="dgfcjxmax" value="{{map.dgfcjxmax}}" id="dgfcjxmax_id"
  324 + placeholder="最大间隔">
  325 + </div>
  326 + </div>
  327 + <div class="col-md-6">
  328 + <label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label>
  329 + <div class="col-md-5">
  330 + <input type="text" class="form-control" name="jbclcount" value="{{map.jbclcount}}" id="jbclcount_id"
  331 + placeholder="为0表示是周末时刻表">
  332 + </div>
  333 + </div>
  334 + </div>
  335 +
  336 + <div class="form-group">
  337 + <div class="col-md-6">
  338 + <label class="control-label col-md-5"><span class="required"> * </span>停站类型 :</label>
  339 + <div class="col-md-5 tagsDiv">
  340 + <div class="row" style="margin-left: 15px;">
  341 + <input type="text" value="{{map.stt}}" name="stt" id="stoptype_tagsinput" style="display: none;">
  342 + </div>
  343 +
  344 + <div class="row" style="margin-top: 10px;">
  345 + <label class="control-label col-md-4">停站类型:</label>
  346 + <div class="col-md-8">
  347 + <select name="stopType" class="form-control" id="stopType_id">
  348 + <option value="">-- 请选择停站类型 --</option>
  349 + <option value="0">主站停站</option>
  350 + <option value="1">双向停站</option>
  351 + </select>
  352 + </div>
  353 + </div>
  354 +
  355 + <div class="row" style="margin-top: 10px;">
  356 + <label class="control-label col-md-4">主站:</label>
  357 + <div class="col-md-8">
  358 + <select name="masterStop" class="form-control" id="masterStop_id">
  359 + <option value="">请选择...</option>
  360 + <option value="0">{{map.startStationName}}</option>
  361 + <option value="1">{{map.endStationName}}</option>
  362 + </select>
  363 + </div>
  364 + </div>
  365 +
  366 + <div class="row" style="margin-top: 10px;margin-left: 116px;">
  367 + <a href="javascript:" class="btn red" id="stoptype_tagsinput_add">添加</a>
  368 + </div>
  369 + </div>
  370 +
  371 + </div>
  372 +
  373 + <div class="col-md-6">
  374 + <div class="form-group">
  375 + <label class="control-label col-md-5">
  376 + <span class="required"> * </span> 建议高峰配车数 :</label>
  377 + <div class="col-md-5">
  378 + <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs"
  379 + id="gfjypcsInput" min="1" value="{{map.gfjypcs}}">
  380 + </div>
  381 + </div>
  382 + <div class="form-group">
  383 + <label class="control-label col-md-5">
  384 + <span class="required"> * </span> 生成策略  :
  385 + </label>
  386 + <div class="col-md-5">
  387 + <select name="strategy" class="form-control" id="strategy_id">
  388 + <option value="AdjustTripS1" selected>AdjustTripS1</option>
  389 + <option value="AdjustTripS2" disabled>AdjustTripS2</option>
  390 + <option value="AdjustTripS3">AdjustTripS3</option>
  391 + <option value="AdjustTripS4">AdjustTripS4</option>
  392 + </select>
  393 + </div>
  394 + </div>
  395 + </div>
  396 +
  397 +
  398 + </div>
  399 +
  400 +
  401 + <!-- 隐藏字段-时间 -->
  402 + <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/>
  403 + <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/>
  404 + <input type="hidden" name="xlmc" value="{{map.xlmc}}" id="xlmc_id"/>
  405 + <input type="hidden" name="lineName" value="{{map.lineName}}" id="lineName_id"/>
  406 + <input type="hidden" name="lineVersion" value="{{map.lineVersion}}" id="lineVersion_id"/>
  407 +
  408 + <!-- 上下行行驶时间 -->
  409 + <input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/>
  410 + <input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/>
  411 +
  412 + <!-- 隐藏字段-里程 -->
  413 + <!-- 上下行行驶里程 -->
  414 + <input type="hidden" name="upMileage" value="{{map.upMileage}}" id="upMileage_id"/>
  415 + <input type="hidden" name="downMileage" value="{{map.downMileage}}" id="downMileage_id"/>
  416 + <!-- 上下行进场出场里程 -->
  417 + <input type="hidden" name="upInMileage" value="{{map.upInMileage}}" id="upInMileage_id"/>
  418 + <input type="hidden" name="downInMileage" value="{{map.downInMileage}}" id="downInMileage_id"/>
  419 + <input type="hidden" name="upOutMileage" value="{{map.upOutMileage}}" id="upOutMileage_id"/>
  420 + <input type="hidden" name="downOutMileage" value="{{map.downOutMileage}}" id="downOutMileage_id"/>
  421 +
  422 +
  423 +</script>
  424 +
  425 +<script type="text/javascript">
  426 + $('#paramadd_mobal').on('paramAddMobal.show', function(e, mainFun, mainFun2_2, oSchedule_v2_2){
  427 + var _mainFun = mainFun;
  428 + var _mainFun_v2_2 = mainFun2_2;
  429 + var _oSchedule_v2_2 = oSchedule_v2_2;
  430 +
  431 + // 加载延迟200毫秒显示mobal
  432 + setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
  433 + var param = JSON.parse(window.localStorage.Gantt_AgursData);
  434 +
  435 + // 获取表单元素
  436 + var form = $('#param_form');
  437 + // 错误提示元素
  438 + var paramAlert = $('.alert-danger', form);
  439 + // 确定事件点击
  440 + $('#paramnext').on('click', function() {
  441 + $("#paramcancel").addClass("disabled");
  442 + $("#paramnext").addClass("disabled");
  443 + $(".paramnextSpan").html("正在生成...");
  444 +
  445 + setTimeout(function() {
  446 + form.submit();// 表单提交
  447 + }, 500);
  448 +
  449 + // $("#paramnext").removeClass("disabled");
  450 + // $("#paramnext").html("确定");
  451 + });
  452 +
  453 + // 表单验证
  454 + form.validate({
  455 + errorElement : 'span',
  456 + errorClass : 'help-block help-block-error',
  457 + focusInvalid : false,
  458 + rules: {
  459 + 'skbName' : {required : true,},// 时刻表名称,必填项.
  460 + 'lineName' : {required : true,},// 线路名称,必填项.
  461 + 'lineVersion': {required: true}, // 站点路由版本,必填项,
  462 + 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项.
  463 + 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项.
  464 + 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项.
  465 + 'endStationEndTime' : {required : true}, // 终点站末班时间,必填项.
  466 + 'earlyStartTime' : {required : true},// 早高峰开始时间,必填项 .
  467 + 'earlyEndTime' : {required : true},// 早高峰结束时间,必填项 .
  468 + 'lateStartTime' : {required : true},// 晚高峰开始时间,必填项 .
  469 + 'lateEndTime' : {required : true},// 晚高峰结束时间,必填项.
  470 + 'upInTimer' : {number : true},// 上行进场时间,必须为数字.
  471 + 'upOutTimer' : {number : true},// 上行出场时间,必须为数字.
  472 + 'downInTimer' : {number : true},// 下行进场时间,必须为数字.
  473 + 'downOutTimer' : {number : true},// 下行出场时间,必须为数字.
  474 + 'earlyUpTime' : {number : true},// 早高峰上行时间,必须为数字.
  475 + 'earlyDownTime' : {number : true},// 早高峰下行时间,必须为数字.
  476 + 'lateUpTime' : {number : true},// 晚高峰上行时间,必须为数字.
  477 + 'lateDownTime' : {number : true},// 晚高峰下行时间,必须为数字.
  478 + 'troughUpTime' : {number : true},// 低谷上行时间,必须为数字.
  479 + 'troughDownTime' : {number : true},// 低谷下行时间,必须为数字.
  480 + 'linePlayType' : {required : true},// 线路规划类型,必填项
  481 + 'lb' : {number : true},// 早晚例行保养,必须为数字.
  482 + 'workeLunch' : {number : true},// 工作餐午餐时间,必须为数字.
  483 + 'workeDinner' : {number : true},// 工作餐晚餐时间,必须为数字.
  484 + 'zgffcjxmin' : {required : true,number : true,digits: true},// 早高峰最小发车间隔.
  485 + 'zgffcjxmax' : {required : true,number : true,digits: true},// 早高峰最大发车间隔.
  486 + 'wffcjxmin' : {required : true,number : true,digits: true},// 晚高峰最小发车间隔.
  487 + 'wffcjxmax' : {required : true,number : true,digits: true},// 晚高峰最大发车间隔.
  488 + 'dgfcjxmin' : {required : true,number : true,digits: true},// 低谷最小发车间隔.
  489 + 'dgfcjxmax' : {required : true,number : true,digits: true},// 低谷最大发车间隔.
  490 + 'jbclcount': {required : true,number : true,digits: true}, // 建议加班车数
  491 + 'upTravelTime' : {required : true,number : true},// 上行行驶时间,必填项、必须为整数.
  492 + 'downTravelTime' : {required : true,number : true},// 下行行驶时间,必填项、必须为整数.
  493 + 'upMileage' : {required : true,number : true},// 上行行驶里程,必填项、必须为整数.
  494 + 'downMileage' : {required : true,number : true},// 下行行驶里程,必填项、必须为整数.
  495 + 'upInMileage' : {number : true},// 上行进场里程,必须为数字.
  496 + 'upOutMileage' : {number : true},// 上行出场里程,必须为数字.
  497 + 'downInMileage' : {number : true},// 下行进场里程,必须为数字.
  498 + 'downOutMileage' : {number : true}, // 下行出场里程,必须为数字.
  499 +
  500 + 'strategy' : {required : true} // 生成策略标识
  501 +
  502 + // TODO
  503 + },
  504 + invalidHandler : function(event, validator) {
  505 + paramAlert.show();
  506 + App.scrollTo(paramAlert, -200);
  507 + },
  508 + highlight : function(element) {
  509 + $(element).closest('.form-group').addClass('has-error');
  510 + },
  511 + unhighlight : function(element) {
  512 + $(element).closest('.form-group').removeClass('has-error');
  513 + },
  514 + success : function(label) {
  515 + label.closest('.form-group').removeClass('has-error');
  516 + },
  517 + submitHandler : function(f) {
  518 + // 1、 获取表单内容,并序列化
  519 + var fp = form.serializeJSON();
  520 +
  521 + console.log(fp);
  522 +
  523 + // 2、重新刷新表单数据
  524 + var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData);
  525 + var key;
  526 + for (key in fp) {
  527 + if (ganttMap[key]) {
  528 + if (ganttMap[key] != fp[key]) {
  529 + ganttMap[key] = fp[key];
  530 + }
  531 + } else {
  532 + ganttMap[key] = fp[key];
  533 + }
  534 + }
  535 + window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap));
  536 +
  537 + // TODO
  538 + var pp = getParamObjAndDataMap();
  539 + var paramObj = pp[0];
  540 + var dataMap = pp[1];
  541 + var csMap = getCSMap(paramObj);
  542 + // console.log(graph);
  543 +
  544 + var data;
  545 +
  546 + if (ganttMap.baseRes == "2") { // v2版本
  547 + data = _mainFun.BXPplaceClassesTime03(paramObj, csMap.maxCar);
  548 + _mainFun.exportDataConfig(data.aInternalLpObj);
  549 + } else if (ganttMap.baseRes == "3") { // v2_2版本
  550 + csMap = getCSMap_v2(paramObj);
  551 + data = _mainFun_v2_2.BXPplaceClassesTime03(paramObj, csMap.maxCar);
  552 + }
  553 +
  554 + echartsDrawGTT.init(data.json,true,true);
  555 +
  556 + if (ganttMap.baseRes == "3") {
  557 + // 导入导出设置
  558 + _mainFun_v2_2.exportExcelConfig($_GlobalGraph.getDataArray);
  559 + }
  560 +
  561 + // var data = obj.getDataArray();
  562 + // // 2、 调整路牌对应的班次总数
  563 + // updFormParams(params,data);
  564 + // 删除图形.
  565 + // $('svg.svg-chart').remove();
  566 + // // 重新创建图形.
  567 + // var graph = d3.select('#ganttSvg').relationshipGraph(getGraphArgus(csMap, dataMap, data));
  568 + // // 根据数据重新渲染图形.
  569 + // graph.data(data.json);
  570 + // // 记录早操.并保存历史班次数据
  571 + // graph.addHistory();
  572 + // 隐藏错误提示
  573 + paramAlert.hide();
  574 + // 隐藏 reladplus_mobal 弹出层
  575 + $('#paramadd_mobal').modal('hide');
  576 + layer.msg('成功!');
  577 + }
  578 + });
  579 +
  580 +
  581 + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
  582 + $('#paramadd_mobal').on('show.bs.modal', function () {
  583 + // TODO
  584 + // 把数据填充到模版中
  585 + // var tbodyHtml = template('countAdd_temp',{list:countDate});
  586 + // // 把渲染好的模版html文本追加到表格中
  587 + // $('#datatable_countadd tbody').html(tbodyHtml);
  588 + var htmldata = template('paramAdd_temp', {map : param});
  589 + $('#ptab').html(htmldata);
  590 +
  591 + // 线路规划类型
  592 + $('#linePlayType_id').val(param.linePlayType);
  593 + // 策略类型
  594 + $('#strategy_id').val(param.strategy || "AdjustTripS1");
  595 + // 吃饭地点
  596 + $get('/stationroute/all', {
  597 + 'line.id_eq': param.lineName.split('_')[0],
  598 + 'destroy_eq': 0,
  599 + 'versions_eq': param.lineVersion},
  600 + function(result) {
  601 + var opt = [];
  602 + opt.push('<option value="">请选择...</option>');
  603 + $.each(result, function(i, d) {
  604 + if (d.stationMark == 'B' && d.directions == 0) {
  605 + opt.push("<option value='0'>" + d.stationName + "</option>");
  606 + } else if (d.stationMark == 'E' && d.directions == 0) {
  607 + opt.push("<option value='1'>" + d.stationName + "</option>");
  608 + }
  609 + });
  610 + initTagsinput(opt.join(","));
  611 +
  612 + opt.push("<option value='allYes'>起终点站都可以</option>");
  613 + $('#cfdd_id').html(opt.join(""));
  614 + $('#cfdd_id').val(param.cfdd);
  615 +
  616 + }
  617 + );
  618 + // 停车场
  619 + $get('/carpark/all',null, function(cd) {
  620 + var opt = [];
  621 + opt.push('<option value="">请选择...</option><optgroup label="停车场">');
  622 + var $_len = cd.length;
  623 + if($_len > 0) {
  624 + $.each(cd, function(i, d){
  625 + opt.push('<option value="'+d.parkCode+'">'+d.parkName+'</option>');
  626 + });
  627 + }
  628 + opt.push('</optgroup>');
  629 + $('#carPark_id').html(opt.join(",")).select2();
  630 + $('#carPark_id').select2("val", param.carPark);
  631 + });
  632 +
  633 + // 上下行首末班日期控件
  634 + $('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  635 + $('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  636 + $('#endStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  637 + $('#endStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  638 +
  639 + // 早高峰晚高峰日期控件
  640 + $('#earlyStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  641 + $('#earlyEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  642 + $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  643 + $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  644 +
  645 + });
  646 +
  647 +
  648 +
  649 + //--------------------- 其他方法 ------------------------//
  650 +
  651 + function initTagsinput(htmlStr) {
  652 + $('#masterStop_id').html(htmlStr);
  653 +
  654 + var elt = $('#stoptype_tagsinput');
  655 + var value = elt.val();
  656 + var stoptype = value.split("/")[0];
  657 + var masterstop = value.split("/")[1];
  658 +
  659 + $('#stopType_id').val(stoptype);
  660 + $('#masterStop_id').val(masterstop);
  661 +
  662 + elt.tagsinput({
  663 + tagClass: function(item) {
  664 + return 'label label-danger label-important';
  665 + },
  666 + itemValue: 'value',
  667 + itemText: 'text'
  668 + });
  669 +
  670 + $('#stoptype_tagsinput').on('beforeItemAdd', function(event) {
  671 + // TODO:这里可以做一些逻辑判定
  672 + });
  673 +
  674 + $('#stoptype_tagsinput_add').on('click', function(){
  675 + var stoptype = $("#stopType_id").val();
  676 + var masterstop = $("#masterStop_id").val();
  677 + var masterstop_text = $("#masterStop_id option:selected").text();
  678 +
  679 + if (stoptype && stoptype != "") {
  680 + if (stoptype == "0" && masterstop && masterstop != "") {
  681 + elt.tagsinput('add', {
  682 + "value": stoptype + '/' + masterstop,
  683 + "text": "主站停站" + "/" + masterstop_text
  684 + });
  685 + } else {
  686 + elt.tagsinput('add', {
  687 + "value": 1,
  688 + "text": "双向停站"
  689 + });
  690 + }
  691 + }
  692 + });
  693 +
  694 + if (stoptype && stoptype != "") {
  695 + elt.tagsinput('add', {
  696 + "value": stoptype + '/' + masterstop,
  697 + "text":
  698 + $("#stopType_id option:selected").text() + "/" +
  699 + $("#masterStop_id option:selected").text()
  700 + });
  701 + }
  702 +
  703 + }
  704 +
  705 + function getMinDate(d1,d2) {
  706 + // 1、定义返回字符串.
  707 + var str = '';
  708 + // 2、判断时间大小.
  709 + if(strToTime(d1)>strToTime(d2))
  710 + str = d2;
  711 + else
  712 + str = d1;
  713 + // 3、返回最小时间(字符串).
  714 + return str;
  715 + }
  716 +
  717 + function strToTime(t) {
  718 + var d = new Date();
  719 + if(t) {
  720 + var _str = t.split(':');
  721 + d.setHours(parseInt(_str[0]));
  722 + d.setMinutes(parseInt(_str[1]));
  723 + }
  724 + return d;
  725 + }
  726 +
  727 + function getMaxDate(d1,d2) {
  728 + // 1、定义返回时间字符串.
  729 + var str = '';
  730 + // 2、判断时间大小.
  731 + if(strToTime(d1)>strToTime(d2))
  732 + str = d1;
  733 + else
  734 + str = d2;
  735 + // 3、返回一个最大时间(字符串).
  736 + return str;
  737 + }
  738 +
  739 + function getEndDate(date) {
  740 + var lastEndDate = Date.now();
  741 + if (date) {
  742 + var str = date.replace(/-/g,"/");
  743 + lastEndDate = new Date(str);
  744 + }
  745 + // Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间)
  746 + return lastEndDate;
  747 + }
  748 +
  749 + function formatPairing(v1,v2) {
  750 + v1 = v1 == '' ? 0 : parseInt(v1);
  751 + v2 = v2 == ''? 0 : parseInt(v2) ;
  752 + return [v1,v2];
  753 + }
  754 +
  755 + function qzdz(zd1,zd2) {
  756 + return [zd1,zd2];
  757 + }
  758 +
  759 + function formatksjssj(gp) {
  760 + return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}];
  761 + }
  762 +
  763 + function getsd(st,ed) {
  764 + return [{'st':st,'ed':ed}];
  765 + }
  766 +
  767 + function getDateTime(time) {
  768 + var dateTime = new Date();
  769 + var timeArr;
  770 + if(time !=null && time !='' && typeof(time) !='undefined') {
  771 + timeArr = time.split(':');
  772 + dateTime.setHours(parseInt(timeArr[0]));
  773 + dateTime.setMinutes(parseInt(timeArr[1]));
  774 + }
  775 + return dateTime;
  776 + }
  777 +
  778 + function getYAxisCarArray(len) {
  779 + var array = new Array();
  780 + if(len>0) {
  781 + for(var y = 0; y<len; y++) {
  782 + array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象
  783 + };
  784 + }
  785 + return array;
  786 + }
  787 +
  788 + function getylp(arr) {
  789 + var ra = new Array(),name = new Array();
  790 + for(var i = 0 ; i<arr.length;i++) {
  791 + ra.push(arr[i].lpNo);
  792 + name.push(arr[i].lpName);
  793 + }
  794 + return {'lpNoA':ra,'lpNameA':name,};
  795 + }
  796 +
  797 + function getParamObjAndDataMap() {
  798 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  799 + // seMap
  800 + var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),
  801 + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};
  802 + // dirA
  803 + var dirA = ['relationshipGraph-up', 'relationshipGraph-down'];
  804 + // bcTypeArr
  805 + var bcTypeArr = {
  806 + 'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc',
  807 + 'major': 'major', 'venting': 'venting', 'region': 'region'
  808 + };
  809 + // seDate
  810 + var newDate = new Date();
  811 + var kssj = d3.time.hour.offset(getEndDate(
  812 + newDate.getFullYear()+ "-" +
  813 + (newDate.getMonth()+1) + "-" +
  814 + newDate.getDate() + ' ' +
  815 + seMap.s.split(':')[0] + ':00'),-1);
  816 +
  817 + var year = '' , month = '',dt = '';
  818 + if(newDate.getDate()+1>31)
  819 + dt = '01';
  820 + else
  821 + dt = newDate.getDate()+1;
  822 + if(newDate.getMonth()+1>12)
  823 + month = '01';
  824 + else if(newDate.getDate()+1>31)
  825 + month = newDate.getMonth()+2;
  826 + else
  827 + month = newDate.getMonth()+1;
  828 + if(newDate.getMonth()+1>12)
  829 + year = newDate.getFullYear()+1;
  830 + else
  831 + year = newDate.getFullYear();
  832 + var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');
  833 + seDate = {'kssj' : kssj, 'jssj' : jssj};
  834 +
  835 + // dataMap
  836 + var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下]
  837 + 'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下]
  838 + 'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下]
  839 + 'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下]
  840 + 'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下]
  841 + 'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime,
  842 + map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下]
  843 + 'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime,
  844 + map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下]
  845 + 'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下]
  846 + 'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下]
  847 + 'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下]
  848 + 'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚]
  849 + 'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间]
  850 + 'zgfsjd' : getsd(getDateTime(map.earlyStartTime),
  851 + getDateTime(map.earlyEndTime)), // 早高峰时间段
  852 + 'wgfsjd' : getsd(getDateTime(map.lateStartTime),
  853 + getDateTime(map.lateEndTime)),// 晚高峰时间段
  854 + 'gfzjsjd' : getsd(getDateTime(map.earlyEndTime),
  855 + getDateTime(map.lateStartTime)),//高峰之间时间段.
  856 + 'wgfzhsjd' : getsd(getDateTime(map.lateEndTime),
  857 + getDateTime(seMap.e)),// 晚高峰之后时间段
  858 + 'zgfzqsjd': getsd(getDateTime(seMap.s),
  859 + getDateTime(map.earlyStartTime)),//早高峰之前时间段.
  860 + 'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下]
  861 + 'bcTypeArr' : bcTypeArr,// 班次类型
  862 + 'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间.
  863 + // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间.
  864 + // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间.
  865 + // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间.
  866 + 'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间.
  867 + 'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间.
  868 + 'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间.
  869 + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙.
  870 + 'map' : map,
  871 + 'zzsj':map.zzsj,// 周转时间.
  872 + };
  873 +
  874 + var _paramObj = _mainFun.getFactory().createParameterObj(map, dataMap);
  875 +
  876 + if (!_paramObj.isTwoWayStop()) { // 主站停站使用v2_2版本
  877 + map.clzs = _oSchedule_v2_2.calcuClzx(_paramObj);
  878 + } else {
  879 + map.clzs = _paramObj.calcuClzx();
  880 + }
  881 +
  882 + return [_paramObj, dataMap];
  883 +
  884 + }
  885 +
  886 + function getCSMap(parmObj) {
  887 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  888 + return {'gattA':null,
  889 + 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,
  890 + 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),
  891 + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},
  892 + 'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))};
  893 + }
  894 + function getCSMap_v2(parmObj) {
  895 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  896 + return {'gattA':null,
  897 + 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,
  898 + 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),
  899 + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},
  900 + 'maxCar':getYAxisCarArray(_oSchedule_v2_2.calcuClzx(parmObj))};
  901 + }
  902 +
  903 +
  904 + function getGraphArgus(CSMap, dataMap, data) {
  905 + // TODO
  906 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  907 + var sxsj = parseInt(map.upTravelTime);// 上行时间.
  908 +
  909 + // seMap
  910 + var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),
  911 + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};
  912 +
  913 + // seDate
  914 + var newDate = new Date();
  915 + var kssj = d3.time.hour.offset(getEndDate(
  916 + newDate.getFullYear()+ "-" +
  917 + (newDate.getMonth()+1) + "-" +
  918 + newDate.getDate() + ' ' +
  919 + seMap.s.split(':')[0] + ':00'),-1);
  920 +
  921 + var year = '' , month = '',dt = '';
  922 + if(newDate.getDate()+1>31)
  923 + dt = '01';
  924 + else
  925 + dt = newDate.getDate()+1;
  926 + if(newDate.getMonth()+1>12)
  927 + month = '01';
  928 + else if(newDate.getDate()+1>31)
  929 + month = newDate.getMonth()+2;
  930 + else
  931 + month = newDate.getMonth()+1;
  932 + if(newDate.getMonth()+1>12)
  933 + year = newDate.getFullYear()+1;
  934 + else
  935 + year = newDate.getFullYear();
  936 + var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');
  937 + seDate = {'kssj' : kssj, 'jssj' : jssj};
  938 +
  939 +
  940 + var bs = sxsj > 40 ? 4 : 2;
  941 + var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs;
  942 + var VALUEKEYNAME = 'Worldwide Gross' ,
  943 + DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240,
  944 + MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60,
  945 + STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true;
  946 + var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ;
  947 + // 计算出相差天数
  948 + var days=Math.floor(dx_time/(24*3600*1000));
  949 + // 计算出小时数
  950 + var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数
  951 + var hours=Math.floor(leave1/(3600*1000));
  952 + DXHOURS = days*24+hours;
  953 + WIDTH = DXHOURS*MINUTE*MULTIPLE;
  954 + // debugger;
  955 + var lpsplitA = getylp(CSMap.maxCar);
  956 +
  957 + var sxsj = parseInt(map.upTravelTime);// 上行时间.
  958 + var xxsj = parseInt(map.downTravelTime);// 下行时间.
  959 + var stopAraay = [{
  960 + 'sxsj':sxsj,// 上行时间.
  961 + 'xxsj':xxsj,// 下行时间.
  962 + 'zzsj':map.zzsj,// 周转时间.
  963 + 'wcsj':parseInt(map.workeLunch),// 午餐时间.
  964 + 'wcsj':parseInt(map.workeDinner),// 晚餐时间.
  965 + 'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间.
  966 + 'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间.
  967 + 'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间.
  968 + 'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间.
  969 + 'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间.
  970 + 'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间.
  971 + 'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间.
  972 + 'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间.
  973 + 'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程.
  974 + 'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程.
  975 + 'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程.
  976 + 'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程.
  977 + 'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间.
  978 + }];
  979 +
  980 + var args = {
  981 + 'valueKeyName': VALUEKEYNAME,
  982 + 'hours' : DXHOURS,
  983 + 'dxHours' : 24 - DXHOURS,
  984 + 'multiple': MULTIPLE,
  985 + 'width':WIDTH,
  986 + 'widtMargin':MARGINLEFT,
  987 + 'height':HEIGHT,
  988 + 'heightMargin':MARGINBOTTOM,
  989 + 'offsetX':OFFSETX,
  990 + 'offsetY':OFFSETY,
  991 + 'downDy':OFFSETDOWNY,
  992 + 'upDy':OFFSETUPY,
  993 + 'timeDomainStart' :STARTDATETIME,
  994 + 'timeDomainEnd' : ENDDATETIME,
  995 + 'startStr':'' + STARTDATETIME,
  996 + 'endStr': '' +ENDDATETIME,
  997 + 'taskTypes': TASKTYPES,
  998 + 'lpNoA':lpsplitA.lpNoA,
  999 + 'lpNameA':lpsplitA.lpNameA,
  1000 + 'tickFormat': TICKFORMAT,
  1001 + 'stopAraay' : stopAraay,
  1002 + 'dataMap':dataMap,
  1003 + 'showTooltips': SHOWTOOLTIPS,
  1004 + 'bxrcgs':data.bxrcgs
  1005 + };
  1006 + return args;
  1007 + }
  1008 +
  1009 +
  1010 +
  1011 + });
  1012 +
1009 </script> 1013 </script>
1010 \ No newline at end of file 1014 \ No newline at end of file