Commit 1d844605a786641b3571c78433589e240eec2298
1 parent
2f937ccd
加字典
Showing
13 changed files
with
741 additions
and
353 deletions
README.md
| ... | ... | @@ -19,31 +19,46 @@ |
| 19 | 19 | |
| 20 | 20 | ---------- |
| 21 | 21 | |
| 22 | -## 字典表 | |
| 22 | +## 字典表 dictionary.js | |
| 23 | 23 | ---------- |
| 24 | 24 | 字典操作全部由前端负责,主要有2种。 |
| 25 | 25 | |
| 26 | -1、将字典代码转换为中文 。片段加载完成后,包含 `class="nt-dictionary"` 的标签会被转换,data-group 为所属字典组。 | |
| 26 | +1、转换字典代码。 | |
| 27 | + 当pjax的`pjax:success`事件被触发(片段加载完成) | |
| 28 | + 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换 | |
| 27 | 29 | ``` html |
| 28 | - | |
| 29 | -<span class="nt-dictionary" data-group="XianLuXingZhi">GJXL</span> | |
| 30 | - | |
| 31 | ---转换后 | |
| 32 | -<span class="dictionary" data-group="XianLuXingZhi" data-code="GJXL" >过江线路</span> | |
| 33 | -``` | |
| 34 | -2、生成下拉框,当包含`class="nt-dictionary"` 的标签是`select`时。 | |
| 35 | -``` html | |
| 36 | -<!- 原 --> | |
| 37 | -<select class="nt-dictionary" data-group="XianLuXingZhi" data-code="GJXL"></select> | |
| 38 | - | |
| 39 | -<!-- 转换后 --> | |
| 40 | -<select class="nt-dictionary" data-group="XianLuXingZhi" > | |
| 41 | - <option value="GJXL">过江线路</option> | |
| 42 | - <option value="CCTXL">村村通线路</option> | |
| 43 | - <option value="YXXL">夜宵线路</option> | |
| 44 | - <option value="CSBS">穿梭巴士</option> | |
| 30 | +--dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码 | |
| 31 | +<span class="nt-dictionary" data-group="ScheduleType">out</span> | |
| 32 | +--to | |
| 33 | +<span>出场</span> | |
| 34 | + | |
| 35 | +<!- dom标签为input时,如下 data-code为要转换的代码 --> | |
| 36 | +<input class="nt-dictionary" data-group="ScheduleType" data-code="out"> | |
| 37 | +--to | |
| 38 | +<input value="出场"> | |
| 39 | + | |
| 40 | +<!- dom标签为select时 如下 data-code为要选中的项 --> | |
| 41 | +<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select> | |
| 42 | +--to | |
| 43 | +<select> | |
| 44 | + <option value="normal">正常班次</option> | |
| 45 | + <option value="out" selected>出场</option> | |
| 46 | + <option value="in">进场</option> | |
| 47 | + <option value="oil">加油</option> | |
| 48 | + <option value="temp">临加</option> | |
| 49 | + <option value="region">区间</option> | |
| 50 | + <option value="venting">放空</option> | |
| 51 | + <option value="major">放大站</option> | |
| 45 | 52 | </select> |
| 46 | 53 | ``` |
| 54 | +*原标签的class 除nt-dictionary 外,其余均会被保留* | |
| 55 | + | |
| 56 | +2、dictionary.js提供如下方法自行使用 | |
| 57 | +| 方法名 | 参数| 描述|返回| | |
| 58 | +| ---- | ---- | ---- | ---- | | |
| 59 | +| groups | 无|获取所有字典组 | {LineTrend: 线路走向, ScheduleType: 班次类型} | | |
| 60 | +| getByGroup | (group) | 获取字典组下的字典(LineTrend) |{0: 上行, 1: 下行}| | |
| 61 | +| transformCode | (group, code) | 转换字典代码(LineTrend, 0) | 上行 | | |
| 47 | 62 | |
| 48 | 63 | ## gps |
| 49 | 64 | ---------- | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
0 → 100644
| 1 | +package com.bsth.entity.realcontrol; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * @ClassName: ChildTaskPlan | |
| 6 | + * @Description: TODO(子任务计划) | |
| 7 | + * @author PanZhao | |
| 8 | + * @date 2016年6月20日 上午11:22:22 | |
| 9 | + * | |
| 10 | + */ | |
| 11 | +public class ChildTaskPlan { | |
| 12 | + | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 开始时间 | |
| 17 | + * HH:mm | |
| 18 | + */ | |
| 19 | + private String startTimeStr; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 结束时间 | |
| 23 | + * HH:mm | |
| 24 | + */ | |
| 25 | + private String endTimeStr; | |
| 26 | + | |
| 27 | +} | ... | ... |
src/main/resources/static/assets/js/dictionary.js
0 → 100644
| 1 | +/** | |
| 2 | + * | |
| 3 | + * @Description: TODO(字典转换相关) | |
| 4 | + * @author PanZhao | |
| 5 | + * @date 2016年6月20日 中午13:14:22 | |
| 6 | + * | |
| 7 | + */ | |
| 8 | +var dictionaryUtils = (function(){ | |
| 9 | + | |
| 10 | + var dictionaryData = {}; | |
| 11 | + //获取所有字典 | |
| 12 | + $.get('/dictionary/all', function(ds){ | |
| 13 | + //分组数据 | |
| 14 | + $.each(ds, function(){ | |
| 15 | + if(!dictionaryData[this.dGroup]) | |
| 16 | + dictionaryData[this.dGroup] = {}; | |
| 17 | + dictionaryData[this.dGroup][this.dCode] = this.dName; | |
| 18 | + }); | |
| 19 | + | |
| 20 | + console.log(dictionaryData); | |
| 21 | + }); | |
| 22 | + | |
| 23 | + var dictObject = { | |
| 24 | + //获取所有字典组 | |
| 25 | + groups: function(){ | |
| 26 | + return dictionaryData[0]; | |
| 27 | + }, | |
| 28 | + //获取字典组下的字典 | |
| 29 | + getByGroup: function(group){ | |
| 30 | + return dictionaryData[group]; | |
| 31 | + }, | |
| 32 | + //转换字典代码 | |
| 33 | + transformCode: function(group, code){ | |
| 34 | + return dictionaryData[group][code]; | |
| 35 | + }, | |
| 36 | + //转换页面DOM元素 | |
| 37 | + transformDom: function(es){ | |
| 38 | + $.each(es, function(i, e){ | |
| 39 | + switch ($(e)[0].tagName) { | |
| 40 | + case 'SELECT': | |
| 41 | + transformSelect(e); | |
| 42 | + break; | |
| 43 | + case 'INPUT': | |
| 44 | + transformInput(e); | |
| 45 | + break; | |
| 46 | + default: | |
| 47 | + transformText(e); | |
| 48 | + break; | |
| 49 | + } | |
| 50 | + }); | |
| 51 | + } | |
| 52 | + }; | |
| 53 | + | |
| 54 | + function transformText(e){ | |
| 55 | + var group = $(e).data('group'); | |
| 56 | + var code = $.trim($(e).text()); | |
| 57 | + | |
| 58 | + var name = dictionaryData[group][code]; | |
| 59 | + if(name) | |
| 60 | + $(e).text(name); | |
| 61 | + else | |
| 62 | + console.log('字典转换失败', e); | |
| 63 | + } | |
| 64 | + | |
| 65 | + function transformInput(e){ | |
| 66 | + var group = $(e).data('group'); | |
| 67 | + var code = $(e).data('code'); | |
| 68 | + | |
| 69 | + var name = dictionaryData[group][code]; | |
| 70 | + if(name) | |
| 71 | + $(e).val(name); | |
| 72 | + else | |
| 73 | + console.log('字典转换失败', e); | |
| 74 | + } | |
| 75 | + | |
| 76 | + function transformSelect(e){ | |
| 77 | + var group = $(e).data('group'); | |
| 78 | + var code = $(e).data('code'); | |
| 79 | + var items = dictionaryData[group]; | |
| 80 | + | |
| 81 | + var ops = ''; | |
| 82 | + | |
| 83 | + for(var c in items){ | |
| 84 | + if(c == code) | |
| 85 | + ops += '<option value="'+c+'" selected>'+items[c]+'</option>'; | |
| 86 | + else | |
| 87 | + ops += '<option value="'+c+'">'+items[c]+'</option>'; | |
| 88 | + } | |
| 89 | + $(e).removeClass('nt-dictionary'); | |
| 90 | + $(e).replaceWith('<select class="'+$(e).attr('class')+'">'+ops+'</select>'); | |
| 91 | + } | |
| 92 | + | |
| 93 | + return dictObject; | |
| 94 | +})(); | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -287,6 +287,7 @@ tr.row-active td { |
| 287 | 287 | <script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" data-exclude=1></script> |
| 288 | 288 | |
| 289 | 289 | <script src="/assets/js/common.js"></script> |
| 290 | +<script src="/assets/js/dictionary.js"></script> | |
| 290 | 291 | <!-- d3 --> |
| 291 | 292 | <script src="/assets/js/d3.min.js" data-exclude=1></script> |
| 292 | 293 | |
| ... | ... | @@ -369,11 +370,16 @@ $(function(){ |
| 369 | 370 | } |
| 370 | 371 | }); |
| 371 | 372 | }); |
| 372 | - | |
| 373 | 373 | |
| 374 | 374 | //modal关闭时销毁dom |
| 375 | 375 | $(document).on('hidden.bs.modal', '.modal', function(){ |
| 376 | - $(this).remove(); | |
| 376 | + $(this).remove(); | |
| 377 | + }); | |
| 378 | + | |
| 379 | + //pjax加载完成事件 | |
| 380 | + $(document).on('pjax:success', function(){ | |
| 381 | + var dicts = $(pjaxContainer).find('.nt-dictionary'); | |
| 382 | + dictionaryUtils.transformDom(dicts); | |
| 377 | 383 | }); |
| 378 | 384 | |
| 379 | 385 | function loadPage(url){ | ... | ... |
src/main/resources/static/pages/control/line/child_pages/child_task.html
| ... | ... | @@ -4,16 +4,16 @@ |
| 4 | 4 | <div class="form-body"> |
| 5 | 5 | <div class="form-custom-row"> |
| 6 | 6 | <div class="item" style="margin-top: 0"> |
| 7 | - <span class="item-label" style="width: 40px;">线路: </span> | |
| 8 | - <input class="form-control" value="85路"> | |
| 7 | + <div class="input-icon right"> | |
| 8 | + <span class="item-label" style="width: 40px;">线路: </span> | |
| 9 | + <select name="line" class="form-control lineSelect"> | |
| 10 | + </select> | |
| 11 | + </div> | |
| 9 | 12 | </div> |
| 10 | 13 | |
| 11 | 14 | <div class="item" style="margin-top: 0"> |
| 12 | 15 | <span class="item-label" style="width: 40px;">路牌: </span> |
| 13 | - <select name="foo" class="form-control"> | |
| 14 | - <option value="青 +9">青 +9</option> | |
| 15 | - <option value="青 +9">青 +9</option> | |
| 16 | - <option value="青 +9">青 +9</option> | |
| 16 | + <select name="lp" class="form-control LPSelect"> | |
| 17 | 17 | </select> |
| 18 | 18 | </div> |
| 19 | 19 | </div> |
| ... | ... | @@ -27,16 +27,16 @@ |
| 27 | 27 | </div> |
| 28 | 28 | <div class="custom-table-panel"> |
| 29 | 29 | <div style="height: 36px;position: relative;"> |
| 30 | - <div class="custom-table-header" style="width: 800px;"> | |
| 30 | + <div class="custom-table-header" style="min-width: 800px;"> | |
| 31 | 31 | <table class="table table-bordered table-advance" > |
| 32 | 32 | <thead> |
| 33 | 33 | <tr> |
| 34 | - <th width="7%">序号</th> | |
| 34 | + <th width="6%">序号</th> | |
| 35 | 35 | <th width="9%">开始时间</th> |
| 36 | 36 | <th width="9%">结束时间</th> |
| 37 | - <th width="13%">起点</th> | |
| 38 | - <th width="13%">终点</th> | |
| 39 | - <th width="7%">里程</th> | |
| 37 | + <th width="14%">起点</th> | |
| 38 | + <th width="14%">终点</th> | |
| 39 | + <th width="6%">里程</th> | |
| 40 | 40 | <th width="10%">车辆</th> |
| 41 | 41 | <th width="9%">驾驶员</th> |
| 42 | 42 | <th width="9%">售票员</th> |
| ... | ... | @@ -45,175 +45,9 @@ |
| 45 | 45 | </table> |
| 46 | 46 | </div> |
| 47 | 47 | </div> |
| 48 | - <div class="custom-table-body" style="width: 800px;"> | |
| 49 | - <table class="table table-bordered table-advance" > | |
| 50 | - <tbody> | |
| 51 | - <tr> | |
| 52 | - <td width="7%">1</td> | |
| 53 | - <td width="9%">05:00</td> | |
| 54 | - <td width="9%">05:00</td> | |
| 55 | - <td width="13%">长岛路东陆路</td> | |
| 56 | - <td width="13%">陆家嘴地铁站</td> | |
| 57 | - <td width="7%">22</td> | |
| 58 | - <td width="10%">W2B-091</td> | |
| 59 | - <td width="9%">张全强</td> | |
| 60 | - <td width="9%"></td> | |
| 61 | - </tr> | |
| 62 | - <tr> | |
| 63 | - <td>2</td> | |
| 64 | - <td>06:00</td> | |
| 65 | - <td>07:00</td> | |
| 66 | - <td>长岛路东陆路</td> | |
| 67 | - <td>陆家嘴地铁站</td> | |
| 68 | - <td>22</td> | |
| 69 | - <td>W2B-091</td> | |
| 70 | - <td>张全强</td> | |
| 71 | - <td></td> | |
| 72 | - </tr> | |
| 73 | - <tr> | |
| 74 | - <td>3</td> | |
| 75 | - <td>05:00</td> | |
| 76 | - <td>05:00</td> | |
| 77 | - <td>长岛路东陆路</td> | |
| 78 | - <td>陆家嘴地铁站</td> | |
| 79 | - <td>22</td> | |
| 80 | - <td>W2B-091</td> | |
| 81 | - <td>张全强</td> | |
| 82 | - <td></td> | |
| 83 | - </tr> | |
| 84 | - <tr> | |
| 85 | - <td>4</td> | |
| 86 | - <td>05:00</td> | |
| 87 | - <td>05:00</td> | |
| 88 | - <td>长岛路东陆路</td> | |
| 89 | - <td>陆家嘴地铁站</td> | |
| 90 | - <td>22</td> | |
| 91 | - <td>W2B-091</td> | |
| 92 | - <td>张全强</td> | |
| 93 | - <td></td> | |
| 94 | - </tr> | |
| 95 | - <tr> | |
| 96 | - <td>5</td> | |
| 97 | - <td>05:00</td> | |
| 98 | - <td>05:00</td> | |
| 99 | - <td>长岛路东陆路</td> | |
| 100 | - <td>陆家嘴地铁站</td> | |
| 101 | - <td>22</td> | |
| 102 | - <td>W2B-091</td> | |
| 103 | - <td>张全强</td> | |
| 104 | - <td></td> | |
| 105 | - </tr> | |
| 106 | - <tr> | |
| 107 | - <td>6</td> | |
| 108 | - <td>05:00</td> | |
| 109 | - <td>05:00</td> | |
| 110 | - <td>长岛路东陆路</td> | |
| 111 | - <td>陆家嘴地铁站</td> | |
| 112 | - <td>22</td> | |
| 113 | - <td>W2B-091</td> | |
| 114 | - <td>张全强</td> | |
| 115 | - <td></td> | |
| 116 | - </tr> | |
| 117 | - <tr> | |
| 118 | - <td>7</td> | |
| 119 | - <td>05:00</td> | |
| 120 | - <td>05:00</td> | |
| 121 | - <td>长岛路东陆路</td> | |
| 122 | - <td>陆家嘴地铁站</td> | |
| 123 | - <td>22</td> | |
| 124 | - <td>W2B-091</td> | |
| 125 | - <td>张全强</td> | |
| 126 | - <td></td> | |
| 127 | - </tr> | |
| 128 | - <tr> | |
| 129 | - <td>8</td> | |
| 130 | - <td>05:00</td> | |
| 131 | - <td>05:00</td> | |
| 132 | - <td>长岛路东陆路</td> | |
| 133 | - <td>陆家嘴地铁站</td> | |
| 134 | - <td>22</td> | |
| 135 | - <td>W2B-091</td> | |
| 136 | - <td>张全强</td> | |
| 137 | - <td></td> | |
| 138 | - </tr> | |
| 139 | - <tr> | |
| 140 | - <td>9</td> | |
| 141 | - <td>05:00</td> | |
| 142 | - <td>05:00</td> | |
| 143 | - <td>长岛路东陆路</td> | |
| 144 | - <td>陆家嘴地铁站</td> | |
| 145 | - <td>22</td> | |
| 146 | - <td>W2B-091</td> | |
| 147 | - <td>张全强</td> | |
| 148 | - <td></td> | |
| 149 | - </tr> | |
| 150 | - <tr> | |
| 151 | - <td>10</td> | |
| 152 | - <td>05:00</td> | |
| 153 | - <td>05:00</td> | |
| 154 | - <td>长岛路东陆路</td> | |
| 155 | - <td>陆家嘴地铁站</td> | |
| 156 | - <td>22</td> | |
| 157 | - <td>W2B-091</td> | |
| 158 | - <td>张全强</td> | |
| 159 | - <td></td> | |
| 160 | - </tr> | |
| 161 | - <tr> | |
| 162 | - <td>11</td> | |
| 163 | - <td>05:00</td> | |
| 164 | - <td>05:00</td> | |
| 165 | - <td>长岛路东陆路</td> | |
| 166 | - <td>陆家嘴地铁站</td> | |
| 167 | - <td>22</td> | |
| 168 | - <td>W2B-091</td> | |
| 169 | - <td>张全强</td> | |
| 170 | - <td></td> | |
| 171 | - </tr> | |
| 172 | - <tr> | |
| 173 | - <td>12</td> | |
| 174 | - <td>05:00</td> | |
| 175 | - <td>05:00</td> | |
| 176 | - <td>长岛路东陆路</td> | |
| 177 | - <td>陆家嘴地铁站</td> | |
| 178 | - <td>22</td> | |
| 179 | - <td>W2B-091</td> | |
| 180 | - <td>张全强</td> | |
| 181 | - <td></td> | |
| 182 | - </tr> | |
| 183 | - <tr> | |
| 184 | - <td>13</td> | |
| 185 | - <td>05:00</td> | |
| 186 | - <td>05:00</td> | |
| 187 | - <td>长岛路东陆路</td> | |
| 188 | - <td>陆家嘴地铁站</td> | |
| 189 | - <td>22</td> | |
| 190 | - <td>W2B-091</td> | |
| 191 | - <td>张全强</td> | |
| 192 | - <td></td> | |
| 193 | - </tr> | |
| 194 | - <tr> | |
| 195 | - <td>14</td> | |
| 196 | - <td>05:00</td> | |
| 197 | - <td>05:00</td> | |
| 198 | - <td>长岛路东陆路</td> | |
| 199 | - <td>陆家嘴地铁站</td> | |
| 200 | - <td>22</td> | |
| 201 | - <td>W2B-091</td> | |
| 202 | - <td>张全强</td> | |
| 203 | - <td></td> | |
| 204 | - </tr> | |
| 205 | - <tr> | |
| 206 | - <td>15</td> | |
| 207 | - <td>05:00</td> | |
| 208 | - <td>05:00</td> | |
| 209 | - <td>长岛路东陆路</td> | |
| 210 | - <td>陆家嘴地铁站</td> | |
| 211 | - <td>22</td> | |
| 212 | - <td>W2B-091</td> | |
| 213 | - <td>张全强</td> | |
| 214 | - <td></td> | |
| 215 | - </tr> | |
| 216 | - </tbody> | |
| 48 | + <div class="custom-table-body" style="min-width: 800px;"> | |
| 49 | + <table class="table table-bordered table-advance mainTable table-striped" > | |
| 50 | + <tbody></tbody> | |
| 217 | 51 | </table> |
| 218 | 52 | </div> |
| 219 | 53 | </div> |
| ... | ... | @@ -225,16 +59,16 @@ |
| 225 | 59 | </div> |
| 226 | 60 | <div class="custom-table-panel"> |
| 227 | 61 | <div style="height: 36px;position: relative;"> |
| 228 | - <div class="custom-table-header" style="width: 800px;"> | |
| 62 | + <div class="custom-table-header" style="min-width: 800px;"> | |
| 229 | 63 | <table class="table table-bordered table-advance" > |
| 230 | 64 | <thead> |
| 231 | 65 | <tr> |
| 232 | - <th width="7%">序号</th> | |
| 66 | + <th width="6%">序号</th> | |
| 233 | 67 | <th width="9%">开始时间</th> |
| 234 | 68 | <th width="9%">结束时间</th> |
| 235 | - <th width="13%">起点</th> | |
| 236 | - <th width="13%">终点</th> | |
| 237 | - <th width="7%">里程</th> | |
| 69 | + <th width="14%">起点</th> | |
| 70 | + <th width="14%">终点</th> | |
| 71 | + <th width="6%">里程</th> | |
| 238 | 72 | <th width="10%">车辆</th> |
| 239 | 73 | <th width="9%">驾驶员</th> |
| 240 | 74 | <th width="9%">售票员</th> |
| ... | ... | @@ -243,16 +77,16 @@ |
| 243 | 77 | </table> |
| 244 | 78 | </div> |
| 245 | 79 | </div> |
| 246 | - <div class="custom-table-body" style="width: 800px;"> | |
| 80 | + <div class="custom-table-body" style="min-width: 800px;"> | |
| 247 | 81 | <table class="table table-bordered table-advance" > |
| 248 | 82 | <tbody> |
| 249 | 83 | <tr> |
| 250 | - <td width="7%">1</td> | |
| 84 | + <td width="6%">1</td> | |
| 251 | 85 | <td width="9%"></td> |
| 252 | 86 | <td width="9%"></td> |
| 253 | - <td width="13%"></td> | |
| 254 | - <td width="13%"></td> | |
| 255 | - <td width="7%"></td> | |
| 87 | + <td width="14%"></td> | |
| 88 | + <td width="14%"></td> | |
| 89 | + <td width="6%"></td> | |
| 256 | 90 | <td width="10%"></td> |
| 257 | 91 | <td width="9%"></td> |
| 258 | 92 | <td width="9%"></td> |
| ... | ... | @@ -342,49 +176,49 @@ |
| 342 | 176 | </div> |
| 343 | 177 | <!-- 主任务信息 --> |
| 344 | 178 | <div class="custom-box" > |
| 345 | - <div class="custom-box-body main"> | |
| 179 | + <div class="custom-box-body main" id="mainDetailPabel"> | |
| 346 | 180 | <div class="row"> |
| 347 | 181 | <div class="col-md-4"> |
| 348 | 182 | <span class="custom-label">序号: </span> |
| 349 | - <input class="form-control" disabled="disabled" value="10"> | |
| 183 | + <input class="form-control" disabled="disabled" data-cell="0"> | |
| 350 | 184 | </div> |
| 351 | 185 | <div class="col-md-4"> |
| 352 | 186 | <span class="custom-label">开始时间: </span> |
| 353 | - <input class="form-control" value="11:34"> | |
| 187 | + <input class="form-control" data-cell="1" type="time"> | |
| 354 | 188 | </div> |
| 355 | 189 | <div class="col-md-4"> |
| 356 | 190 | <span class="custom-label">结束时间:</span> |
| 357 | - <input class="form-control" value="12:12"> | |
| 191 | + <input class="form-control" data-cell="2" type="time"> | |
| 358 | 192 | </div> |
| 359 | 193 | </div> |
| 360 | 194 | |
| 361 | 195 | <div class="row"> |
| 362 | 196 | <div class="col-md-4"> |
| 363 | 197 | <span class="custom-label">起点: </span> |
| 364 | - <input class="form-control" disabled="disabled" value="陆家嘴地铁站"> | |
| 198 | + <input class="form-control" disabled="disabled" data-cell="3"> | |
| 365 | 199 | </div> |
| 366 | 200 | <div class="col-md-4"> |
| 367 | 201 | <span class="custom-label">终点: </span> |
| 368 | - <input class="form-control" disabled="disabled" value="长岛路东陆路"> | |
| 202 | + <input class="form-control" disabled="disabled" data-cell="4"> | |
| 369 | 203 | </div> |
| 370 | 204 | <div class="col-md-4"> |
| 371 | 205 | <span class="custom-label">里程:</span> |
| 372 | - <input class="form-control" disabled="disabled" value="13.66"> | |
| 206 | + <input class="form-control" disabled="disabled" data-cell="5"> | |
| 373 | 207 | </div> |
| 374 | 208 | </div> |
| 375 | 209 | |
| 376 | 210 | <div class="row"> |
| 377 | 211 | <div class="col-md-4"> |
| 378 | 212 | <span class="custom-label">车辆: </span> |
| 379 | - <input class="form-control" disabled="disabled" value="W2B-102"> | |
| 213 | + <input class="form-control" disabled="disabled" data-cell="6"> | |
| 380 | 214 | </div> |
| 381 | 215 | <div class="col-md-4"> |
| 382 | 216 | <span class="custom-label">驾驶员: </span> |
| 383 | - <input class="form-control" disabled="disabled" value="顾文雄"> | |
| 217 | + <input class="form-control" disabled="disabled" data-cell="7"> | |
| 384 | 218 | </div> |
| 385 | 219 | <div class="col-md-4"> |
| 386 | 220 | <span class="custom-label">售票员:</span> |
| 387 | - <input class="form-control" disabled="disabled"> | |
| 221 | + <input class="form-control" disabled="disabled" data-cell="8"> | |
| 388 | 222 | </div> |
| 389 | 223 | </div> |
| 390 | 224 | </div> |
| ... | ... | @@ -395,15 +229,15 @@ |
| 395 | 229 | <div class="row"> |
| 396 | 230 | <div class="col-md-4"> |
| 397 | 231 | <span class="custom-label">序号: </span> |
| 398 | - <input class="form-control" disabled="disabled" value="10"> | |
| 232 | + <input class="form-control" disabled="disabled" value="1"> | |
| 399 | 233 | </div> |
| 400 | 234 | <div class="col-md-4"> |
| 401 | 235 | <span class="custom-label">开始时间: </span> |
| 402 | - <input class="form-control" value="11:34"> | |
| 236 | + <input class="form-control" value="" type="time" name=""> | |
| 403 | 237 | </div> |
| 404 | 238 | <div class="col-md-4"> |
| 405 | 239 | <span class="custom-label">结束时间:</span> |
| 406 | - <input class="form-control" value="12:12"> | |
| 240 | + <input class="form-control" value="" type="time"> | |
| 407 | 241 | </div> |
| 408 | 242 | </div> |
| 409 | 243 | |
| ... | ... | @@ -414,22 +248,22 @@ |
| 414 | 248 | </div> |
| 415 | 249 | <div class="col-md-4"> |
| 416 | 250 | <span class="custom-label">起点: </span> |
| 417 | - <input class="form-control" > | |
| 251 | + <select class="form-control"></select> | |
| 418 | 252 | </div> |
| 419 | 253 | <div class="col-md-4"> |
| 420 | 254 | <span class="custom-label">终点:</span> |
| 421 | - <input class="form-control" > | |
| 255 | + <select class="form-control"></select> | |
| 422 | 256 | </div> |
| 423 | 257 | </div> |
| 424 | 258 | |
| 425 | 259 | <div class="row"> |
| 426 | 260 | <div class="col-md-4"> |
| 427 | 261 | <span class="custom-label">里程类型: </span> |
| 428 | - <input class="form-control" disabled="disabled" value="W2B-102"> | |
| 262 | + <input class="form-control" disabled="disabled" value=""> | |
| 429 | 263 | </div> |
| 430 | 264 | <div class="col-md-4"> |
| 431 | 265 | <span class="custom-label">里程: </span> |
| 432 | - <input class="form-control" disabled="disabled" value="顾文雄"> | |
| 266 | + <input class="form-control" disabled="disabled" value=""> | |
| 433 | 267 | </div> |
| 434 | 268 | <div class="col-md-4"> |
| 435 | 269 | <span class="custom-label">是否烂班:</span> |
| ... | ... | @@ -449,8 +283,37 @@ |
| 449 | 283 | <button type="button" class="btn layui-layer-close"> 取消 </button> |
| 450 | 284 | </div> |
| 451 | 285 | </div> |
| 286 | + | |
| 287 | + | |
| 288 | +<script id="child_task_main_table_temp" type="text/html"> | |
| 289 | +{{each list as item i}} | |
| 290 | +<tr data-id="{{item.id}}"> | |
| 291 | + <td width="6%">{{i + 1}}</td> | |
| 292 | + <td width="9%">{{item.fcsj}}</td> | |
| 293 | + <td width="9%">{{item.zdsj}}</td> | |
| 294 | + <td width="14%">{{item.qdzName}}</td> | |
| 295 | + <td width="14%">{{item.zdzName}}</td> | |
| 296 | + <td width="6%">{{item.jhlc}}</td> | |
| 297 | + <td width="10%">{{item.clZbh}}</td> | |
| 298 | + <td width="9%">{{item.jName}}</td> | |
| 299 | + <td width="9%">{{item.sName}}</td> | |
| 300 | +</tr> | |
| 301 | +{{/each}} | |
| 302 | +</script> | |
| 303 | + | |
| 304 | + | |
| 452 | 305 | <script> |
| 453 | 306 | $(function(){ |
| 307 | + //线路编码和名称对照 | |
| 308 | + var storage = window.localStorage; | |
| 309 | + var lineMap = JSON.parse(storage.getItem('lineIds')); | |
| 310 | + //线路 ——> 路牌 ——> 班次 3层映射 | |
| 311 | + var scheduleLineMap; | |
| 312 | + //初始选中班次 | |
| 313 | + var initSelected; | |
| 314 | + //线路站点路由 | |
| 315 | + var stationRoute; | |
| 316 | + | |
| 454 | 317 | //滚动时固定表头 |
| 455 | 318 | $('.custom-table-panel').on('scroll', function(){ |
| 456 | 319 | var top = $(this).scrollTop() |
| ... | ... | @@ -459,9 +322,83 @@ $(function(){ |
| 459 | 322 | }); |
| 460 | 323 | |
| 461 | 324 | var $table = $('.custom-table-body table'); |
| 462 | - $table.find('tr').on('click', function(){ | |
| 325 | + //主任务点击事件 | |
| 326 | + $('#childTaskDiv').on('click', '.mainTable tr', function(){ | |
| 463 | 327 | $table.find('tr._active').removeClass('_active'); |
| 464 | 328 | $(this).addClass('_active'); |
| 329 | + //显示班次详细 | |
| 330 | + $.each(this.cells, function(i,cell){ | |
| 331 | + $('#mainDetailPabel input[data-cell='+i+']').val($(cell).text()); | |
| 332 | + }); | |
| 333 | + //子任务初始值 | |
| 334 | + | |
| 335 | + | |
| 465 | 336 | }); |
| 337 | + | |
| 338 | + var lineSelect = $('#childTaskDiv .lineSelect'); | |
| 339 | + var lpSelect = $('#childTaskDiv .LPSelect'); | |
| 340 | + //线路下拉框 | |
| 341 | + $('#childTaskDiv').on('init', function(e, ops ){ | |
| 342 | + var data = ops.data | |
| 343 | + , stationRoute = ops.stationRoute | |
| 344 | + , lineData = [], lineName; | |
| 345 | + | |
| 346 | + console.log('路由', stationRoute); | |
| 347 | + for(var lineCode in data ){ | |
| 348 | + lineName = lineMap[lineCode]; | |
| 349 | + lineData.push({id: lineCode, text: lineName}); | |
| 350 | + } | |
| 351 | + | |
| 352 | + scheduleLineMap = data; | |
| 353 | + initSelected = ops.selected; | |
| 354 | + | |
| 355 | + initPinYinSelect2(lineSelect, lineData, function(){ | |
| 356 | + //绑定change事件 | |
| 357 | + lineSelect.on('change', changeLine); | |
| 358 | + //初始选中的线路 | |
| 359 | + lineSelect.val(initSelected.xlBm).trigger("change"); | |
| 360 | + | |
| 361 | + setTimeout(function(){ | |
| 362 | + //选中路牌 | |
| 363 | + lpSelect.val(initSelected.lpName).trigger("change"); | |
| 364 | + | |
| 365 | + //选中班次 | |
| 366 | + var $tr = $('.mainTable tr[data-id='+initSelected.id+']'); | |
| 367 | + $tr.trigger('click'); | |
| 368 | + //滚动条 | |
| 369 | + var cont = $('.custom-table-panel'); | |
| 370 | + cont.animate({ | |
| 371 | + scrollTop: $tr.offset().top - cont.offset().top + $tr.scrollTop() - 36 * 4 | |
| 372 | + }, 500); | |
| 373 | + | |
| 374 | + }, 300); | |
| 375 | + }); | |
| 376 | + }); | |
| 377 | + lpSelect.on('change', refreshMainList); | |
| 378 | + | |
| 379 | + function changeLine(){ | |
| 380 | + var lineCode = lineSelect.val(); | |
| 381 | + //设置路牌数据 | |
| 382 | + var data = []; | |
| 383 | + for(var lp in scheduleLineMap[lineCode]){ | |
| 384 | + data.push({id: lp, text: lp}); | |
| 385 | + } | |
| 386 | + if(data.length > 0){ | |
| 387 | + initPinYinSelect2(lpSelect.html(''), data, function(){ | |
| 388 | + refreshMainList(); | |
| 389 | + }); | |
| 390 | + } | |
| 391 | + } | |
| 392 | + | |
| 393 | + /** | |
| 394 | + * 刷新主任务列表 | |
| 395 | + */ | |
| 396 | + function refreshMainList(){ | |
| 397 | + var lineCode = lineSelect.val(); | |
| 398 | + var lp = lpSelect.val(); | |
| 399 | + | |
| 400 | + var htmlStr = template('child_task_main_table_temp', {list: scheduleLineMap[lineCode][lp]}); | |
| 401 | + $('#childTaskDiv .mainTable tbody').html(htmlStr); | |
| 402 | + } | |
| 466 | 403 | }); |
| 467 | 404 | </script> | ... | ... |
src/main/resources/static/pages/control/line/child_pages/temporary_add.html
| ... | ... | @@ -4,17 +4,13 @@ |
| 4 | 4 | <div class="form-body"> |
| 5 | 5 | <div class="form-custom-row"> |
| 6 | 6 | <div class="item" style="margin-top: 0"> |
| 7 | - <span class="item-label" style="width: 40px;">线路: </span> <input | |
| 8 | - class="form-control" value="85路"> | |
| 7 | + <span class="item-label" style="width: 40px;">线路: </span> | |
| 8 | + <select name="line" class="form-control lineSelect"></select> | |
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | 11 | <div class="item" style="margin-top: 0"> |
| 12 | 12 | <span class="item-label" style="width: 40px;">路牌: </span> |
| 13 | - <select | |
| 14 | - name="foo" class="form-control"> | |
| 15 | - <option value="青 +9">青 +9</option> | |
| 16 | - <option value="青 +9">青 +9</option> | |
| 17 | - <option value="青 +9">青 +9</option> | |
| 13 | + <select name="foo" class="form-control LPSelect"> | |
| 18 | 14 | </select> |
| 19 | 15 | <i class="fa fa-plus add-icon" title="新增路牌"></i> |
| 20 | 16 | </div> |
| ... | ... | @@ -301,10 +297,32 @@ |
| 301 | 297 | </div> |
| 302 | 298 | |
| 303 | 299 | <script> |
| 304 | - (function() { | |
| 305 | - //停靠表头 | |
| 306 | - var width = $('.custom-table-body').width(); | |
| 307 | - $('.custom-table-header').css('position', 'fixed').css('width', width); | |
| 308 | - | |
| 309 | - })(); | |
| 300 | +(function() { | |
| 301 | + //停靠表头 | |
| 302 | + var width = $('.custom-table-body').width(); | |
| 303 | + $('.custom-table-header').css('position', 'fixed').css('width', width); | |
| 304 | + | |
| 305 | + var storage = window.localStorage; | |
| 306 | + var lineItems = JSON.parse(storage.getItem('lineControlItems')); | |
| 307 | + | |
| 308 | + //线路下拉框 | |
| 309 | + var lineData = []; | |
| 310 | + $.each(lineItems, function(){ | |
| 311 | + lineData.push({id: this.lineCode, text: this.name}); | |
| 312 | + }); | |
| 313 | + | |
| 314 | + var lineSelect = $('#temporaryAddDiv .lineSelect'); | |
| 315 | + var lpSelect = $('#temporaryAddDiv .LPSelect'); | |
| 316 | + initPinYinSelect2(lineSelect, lineData); | |
| 317 | + | |
| 318 | + $('#temporaryAddDiv').on('init', function(e, ops){ | |
| 319 | + var data = ops.data | |
| 320 | + , lineData = [], lineName; | |
| 321 | + | |
| 322 | + for(var lineCode in data ){ | |
| 323 | + lineName = lineMap[lineCode]; | |
| 324 | + lineData.push({id: lineCode, text: lineName}); | |
| 325 | + } | |
| 326 | + }); | |
| 327 | +})(); | |
| 310 | 328 | </script> |
| 311 | 329 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/control/line/css/lineControl.css
| ... | ... | @@ -1417,7 +1417,8 @@ height: 400px; |
| 1417 | 1417 | padding: 0 5px; |
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | -.custom-box-body input.form-control{ | |
| 1420 | +.custom-box-body input.form-control, | |
| 1421 | +.custom-box-body select.form-control{ | |
| 1421 | 1422 | display: inline-block; |
| 1422 | 1423 | width: 190px; |
| 1423 | 1424 | } |
| ... | ... | @@ -1511,4 +1512,18 @@ label.error{ |
| 1511 | 1512 | content: "暂无数据"; |
| 1512 | 1513 | color: #6f6c6c; |
| 1513 | 1514 | font-size: 12px; |
| 1515 | +} | |
| 1516 | + | |
| 1517 | +.form-custom .select2-container--bootstrap{ | |
| 1518 | + display: inline-block; | |
| 1519 | +} | |
| 1520 | + | |
| 1521 | +.select2-container--open{ | |
| 1522 | + z-index: 999999999; | |
| 1523 | +} | |
| 1524 | + | |
| 1525 | +#childTaskDiv .mainTable tr td:nth-child(1){ | |
| 1526 | + text-align: center; | |
| 1527 | + font-family: arial; | |
| 1528 | + color: #433833; | |
| 1514 | 1529 | } |
| 1515 | 1530 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/control/line/js/data.js
| ... | ... | @@ -17,6 +17,12 @@ var _data = (function(){ |
| 17 | 17 | var schedules = {} |
| 18 | 18 | ,scheduleList = []; |
| 19 | 19 | |
| 20 | + //站点路由缓存 | |
| 21 | + var stationRoute = {}; | |
| 22 | + | |
| 23 | + //线路 ——> 路牌 ——> 班次 3层映射 | |
| 24 | + var lineLpMap = {}; | |
| 25 | + | |
| 20 | 26 | var dataObject = { |
| 21 | 27 | getLines: function(){ |
| 22 | 28 | return JSON.parse(storage.getItem('lineControlItems')); |
| ... | ... | @@ -24,6 +30,14 @@ var _data = (function(){ |
| 24 | 30 | getLineIds: function(){ |
| 25 | 31 | return JSON.parse(storage.getItem('lineIds')); |
| 26 | 32 | }, |
| 33 | + //获取线路路牌对照数据 | |
| 34 | + getLineLpMap: function(){ | |
| 35 | + return lineLpMap; | |
| 36 | + }, | |
| 37 | + //根据线路编码获取站点路由 | |
| 38 | + getStationRouteByLine: function(lineCode){ | |
| 39 | + return stationRoute[lineCode]; | |
| 40 | + }, | |
| 27 | 41 | //为GPS点附加班次信息 |
| 28 | 42 | attachSchedulInfo: function(gpsArray){ |
| 29 | 43 | $.each(gpsArray, function(){ |
| ... | ... | @@ -53,9 +67,10 @@ var _data = (function(){ |
| 53 | 67 | //查询实际排班计划 |
| 54 | 68 | queryRealSchedule: function(lineArrayStr, cb){ |
| 55 | 69 | $.get('/realSchedule/lines', {lines: lineArrayStr} ,function(rs){ |
| 56 | - var list, sm, em; | |
| 70 | + var list, sm, em, lineName; | |
| 57 | 71 | for(var lineCode in rs){ |
| 58 | 72 | list = rs[lineCode]; |
| 73 | + lineLpMap[lineCode] = {}; | |
| 59 | 74 | $.each(list, function(){ |
| 60 | 75 | //发车时间 + 历时 = 终点时间 |
| 61 | 76 | if(this.bcsj){ |
| ... | ... | @@ -71,6 +86,12 @@ var _data = (function(){ |
| 71 | 86 | //缓存实际排班计划 |
| 72 | 87 | schedules[this.id] = this; |
| 73 | 88 | scheduleList.push(this); |
| 89 | + | |
| 90 | + //构造 线路 ——> 路牌 ——> 班次 3层映射 | |
| 91 | + if(!lineLpMap[lineCode][this.lpName]) | |
| 92 | + lineLpMap[lineCode][this.lpName] = []; | |
| 93 | + | |
| 94 | + lineLpMap[lineCode][this.lpName].push(this); | |
| 74 | 95 | }); |
| 75 | 96 | |
| 76 | 97 | //按发车时间排序 |
| ... | ... | @@ -197,6 +218,10 @@ var _data = (function(){ |
| 197 | 218 | //排序 |
| 198 | 219 | up.sort(upSort); |
| 199 | 220 | down.sort(downSort); |
| 221 | + //缓存路由 | |
| 222 | + if(routes.length > 0){ | |
| 223 | + stationRoute[routes[0].lineCode] = [up, down]; | |
| 224 | + } | |
| 200 | 225 | |
| 201 | 226 | //合并 |
| 202 | 227 | var data = []; | ... | ... |
src/main/resources/static/pages/control/line/js/drawSvg.js
| ... | ... | @@ -236,7 +236,7 @@ var drawSvg = (function(){ |
| 236 | 236 | } |
| 237 | 237 | }); |
| 238 | 238 | |
| 239 | -/* function drawNumber(multiGps, num, that, start, end){ | |
| 239 | + function drawNumber(multiGps, num, that, start, end){ | |
| 240 | 240 | var circle = $('#' + $(multiGps).attr('for')) |
| 241 | 241 | ,x = circle.attr('cx') |
| 242 | 242 | ,y = circle.attr('cy'); |
| ... | ... | @@ -251,7 +251,7 @@ var drawSvg = (function(){ |
| 251 | 251 | |
| 252 | 252 | numberG.append('rect').attr('x', x).attr('y', y); |
| 253 | 253 | numberG.append('text').attr('x', x).attr('y', y).text(num); |
| 254 | - }*/ | |
| 254 | + } | |
| 255 | 255 | } |
| 256 | 256 | }; |
| 257 | 257 | ... | ... |
src/main/resources/static/pages/control/line/js/rightMenu.js
| ... | ... | @@ -162,7 +162,7 @@ var _menu = (function() { |
| 162 | 162 | }); |
| 163 | 163 | }, |
| 164 | 164 | //子任务 |
| 165 | - childTask: function(){ | |
| 165 | + childTask: function(schedul){ | |
| 166 | 166 | $.get('/pages/control/line/child_pages/child_task.html', function(content){ |
| 167 | 167 | layer.open({ |
| 168 | 168 | type: 1, |
| ... | ... | @@ -173,12 +173,17 @@ var _menu = (function() { |
| 173 | 173 | shift: 5, |
| 174 | 174 | title: '子任务编辑', |
| 175 | 175 | success: function(){ |
| 176 | + $('#childTaskDiv').trigger('init', { | |
| 177 | + data: _data.getLineLpMap(), | |
| 178 | + selected: schedul, | |
| 179 | + stationRoute: _data.getStationRouteByLine(schedul.xlBm) | |
| 180 | + }); | |
| 176 | 181 | } |
| 177 | 182 | }); |
| 178 | 183 | }); |
| 179 | 184 | }, |
| 180 | 185 | //临加班次 |
| 181 | - temporaryAdd: function(){ | |
| 186 | + temporaryAdd: function(schedul){ | |
| 182 | 187 | $.get('/pages/control/line/child_pages/temporary_add.html', function(content){ |
| 183 | 188 | layer.open({ |
| 184 | 189 | type: 1, |
| ... | ... | @@ -189,6 +194,7 @@ var _menu = (function() { |
| 189 | 194 | shift: 5, |
| 190 | 195 | title: '临加/抽增', |
| 191 | 196 | success: function(){ |
| 197 | + $('#temporaryAddDiv').trigger('init', {data: _data.getLineLpMap(), selected: schedul}); | |
| 192 | 198 | } |
| 193 | 199 | }); |
| 194 | 200 | }); | ... | ... |
src/main/resources/static/pages/permission/dictionary/add.html
src/main/resources/static/pages/permission/dictionary/list.html
| 1 | +<style> | |
| 2 | +#datatable_dictionary tr td:nth-of-type(2){ | |
| 3 | + font-family: 微软雅黑; | |
| 4 | +} | |
| 5 | + | |
| 6 | +#datatable_dictionary tr td:nth-of-type(2) span.dgroup{ | |
| 7 | + font-size: 12px; | |
| 8 | + color: gray; | |
| 9 | + margin-left: 8px; | |
| 10 | +} | |
| 11 | + | |
| 12 | +#datatable_dictionary tr td span.dcode{ | |
| 13 | + background: #da7b7b; | |
| 14 | + padding: 3px 7px; | |
| 15 | + color: white; | |
| 16 | + border-radius: 5px !important; | |
| 17 | +} | |
| 18 | +</style> | |
| 1 | 19 | <div class="page-head"> |
| 2 | 20 | <div class="page-title"> |
| 3 | 21 | <h1>字典管理</h1> |
| ... | ... | @@ -17,127 +35,210 @@ |
| 17 | 35 | <div class="portlet light portlet-fit portlet-datatable bordered"> |
| 18 | 36 | <div class="portlet-title"> |
| 19 | 37 | <div class="caption"> |
| 20 | - <i class="fa fa-database font-dark"></i> <span | |
| 38 | + <i class="fa fa-database font-dark"></i> <span | |
| 21 | 39 | class="caption-subject font-dark sbold uppercase">字典表</span> |
| 22 | 40 | </div> |
| 23 | 41 | <div class="actions"> |
| 24 | - <a class="btn btn-circle blue" href="add.html" data-pjax><i | |
| 25 | - class="fa fa-plus"></i> 添加字典</a> | |
| 42 | + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加字典</a> | |
| 43 | + <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除</button> | |
| 26 | 44 | </div> |
| 27 | 45 | </div> |
| 28 | 46 | <div class="portlet-body"> |
| 29 | - <div class="row" id="dictsContainer"></div> | |
| 30 | - </div> | |
| 31 | - </div> | |
| 32 | - </div> | |
| 33 | -</div> | |
| 34 | -<script id="dict_list_temp" type="text/html"> | |
| 35 | -{{each list as group i}} | |
| 36 | -<div class="col-lg-4"> | |
| 37 | -<div class="portlet light portlet-fit bordered"> | |
| 38 | - <div class="portlet-body"> | |
| 39 | - <div class="mt-element-list"> | |
| 40 | - <div class="mt-list-head list-default ext-1 bg-blue-chambray font-white " data-toggle="collapse" href="#list_{{group.dCode}}" aria-expanded="true"> | |
| 41 | - <div class="row"> | |
| 42 | - <div class="col-xs-7"> | |
| 43 | - <div class="list-head-title-container"> | |
| 44 | - <h3 class="list-title uppercase sbold">{{group.dName}}</h3> | |
| 45 | - <div class="list-date">4月, 2016</div> | |
| 46 | - </div> | |
| 47 | - </div> | |
| 48 | - <div class="col-xs-4"> | |
| 49 | - <div class="list-head-summary-container"> | |
| 50 | - <div class="list-pending"> | |
| 51 | - <div class="list-label badge badge-danger">{{group.dCode}}</div> | |
| 52 | - </div> | |
| 53 | - </div> | |
| 47 | + <div class="table-container" style="margin-top: 10px"> | |
| 48 | + <table | |
| 49 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 50 | + id="datatable_dictionary"> | |
| 51 | + <thead> | |
| 52 | + <tr role="row" class="heading"> | |
| 53 | + <th width="3%">#</th> | |
| 54 | + <th width="15%">字典组</th> | |
| 55 | + <th width="13%">字典名</th> | |
| 56 | + <th width="100">代码</th> | |
| 57 | + <th width="11%">描述</th> | |
| 58 | + <th width="18%">固化</th> | |
| 59 | + <th width="18%">操作</th> | |
| 60 | + </tr> | |
| 61 | + <tr role="row" class="filter"> | |
| 62 | + <td></td> | |
| 63 | + <td> | |
| 64 | + <select name="dGroup_eq" class="form-control form-filter input-sm" id="dGroupSelect"></select> | |
| 65 | + </td> | |
| 66 | + <td> | |
| 67 | + <select class="nt-dictionary " data-group="ScheduleType" data-code="out"></select> | |
| 68 | + </td> | |
| 69 | + <td> | |
| 70 | + </td> | |
| 71 | + <td> | |
| 72 | + </td> | |
| 73 | + <td> | |
| 74 | + </td> | |
| 75 | + <td> | |
| 76 | + </td> | |
| 77 | + </tr> | |
| 78 | + </thead> | |
| 79 | + <tbody></tbody> | |
| 80 | + </table> | |
| 81 | + <div style="text-align: right;"> | |
| 82 | + <ul id="pagination" class="pagination"></ul> | |
| 54 | 83 | </div> |
| 55 | 84 | </div> |
| 56 | 85 | </div> |
| 57 | - | |
| 58 | -<div class="panel-collapse collapse mt-list-container list-default ext-1" id="list_{{group.dCode}}" | |
| 59 | - aria-expanded="true" style="max-height: 350px;overflow: auto;"> | |
| 60 | - <ul> | |
| 61 | - {{each group.children as item i}} | |
| 62 | - <li class="mt-list-item done"> | |
| 63 | - <div class="list-icon-container"> | |
| 64 | - <a href="javascript:;"> <i class="icon-close"></i> | |
| 65 | - </a> | |
| 66 | - </div> | |
| 67 | - <div class="list-datetime help-block"> | |
| 68 | - {{item.dCode}} | |
| 69 | - </div> | |
| 70 | - <div class="list-item-content"> | |
| 71 | - <h3 class="uppercase"> | |
| 72 | - <a href="javascript:;">{{item.dName}}</a> | |
| 73 | - </h3> | |
| 74 | - <p class="help-block">{{item.descriptions}}</p> | |
| 75 | - </div> | |
| 76 | - </li> | |
| 77 | - {{/each}} | |
| 78 | - </ul> | |
| 79 | -</div> | |
| 80 | - | |
| 81 | - | |
| 82 | - | |
| 83 | 86 | </div> |
| 84 | 87 | </div> |
| 85 | 88 | </div> |
| 86 | -</div> | |
| 89 | + | |
| 90 | +<script id="dictionary_list_temp" type="text/html"> | |
| 91 | +{{each list as obj i}} | |
| 92 | +<tr> | |
| 93 | + <td style="vertical-align: middle;"> | |
| 94 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 95 | + </td> | |
| 96 | + <td> | |
| 97 | + {{obj.dGroupText}}<span class="dgroup">{{obj.dGroup}}</span> | |
| 98 | + </td> | |
| 99 | + <td> | |
| 100 | + {{obj.dName}} | |
| 101 | + </td> | |
| 102 | + <td> | |
| 103 | + <span class="dcode">{{obj.dCode}}</span> | |
| 104 | + </td> | |
| 105 | + <td> | |
| 106 | + {{obj.descriptions}} | |
| 107 | + </td> | |
| 108 | + <td> | |
| 109 | + 否 | |
| 110 | + </td> | |
| 111 | + <td> | |
| 112 | + </td> | |
| 113 | +</tr> | |
| 87 | 114 | {{/each}} |
| 115 | +{{if list.length == 0}} | |
| 116 | +<tr> | |
| 117 | + <td colspan=7><h6 class="muted">没有找到相关数据</h6></td> | |
| 118 | +</tr> | |
| 119 | +{{/if}} | |
| 88 | 120 | </script> |
| 89 | 121 | |
| 90 | -<!-- | |
| 91 | -<div class="mt-list-container list-default ext-1"> | |
| 92 | - <ul> | |
| 93 | - {{each group.children as item i}} | |
| 94 | - <li class="mt-list-item done"> | |
| 95 | - <div class="list-icon-container"> | |
| 96 | - <a href="javascript:;"> <i class="icon-close"></i> | |
| 97 | - </a> | |
| 98 | - </div> | |
| 99 | - <div class="list-datetime help-block"> | |
| 100 | - {{item.dCode}} | |
| 101 | - </div> | |
| 102 | - <div class="list-item-content"> | |
| 103 | - <h3 class="uppercase"> | |
| 104 | - <a href="javascript:;">{{item.dName}}</a> | |
| 105 | - </h3> | |
| 106 | - <p class="help-block">{{item.descriptions}}</p> | |
| 107 | - </div> | |
| 108 | - </li> | |
| 109 | - {{/each}} | |
| 110 | - </ul> | |
| 111 | - </div> | |
| 112 | - --> | |
| 113 | -<script> | |
| 114 | - $(function() { | |
| 115 | - | |
| 116 | - $get('/dictionary/all', null, function(array) { | |
| 117 | - var groups = [], len = array.length, fs = ''; | |
| 118 | - for (var i = 0; i < len; i++) { | |
| 119 | - var pCode = array[i].dGroup; | |
| 120 | - | |
| 121 | - if (pCode == 0) { | |
| 122 | - array[i].updateDate = moment(array[i].updateDate) | |
| 123 | - .format(fs); | |
| 124 | - groups.push(array[i]); | |
| 125 | - } | |
| 126 | - | |
| 127 | - for (var j = 0; j < len; j++) { | |
| 128 | - if (pCode == array[j].dCode) { | |
| 129 | - if (!array[j].children) | |
| 130 | - array[j].children = []; | |
| 131 | - array[j].children.push(array[i]); | |
| 132 | - break; | |
| 133 | - } | |
| 134 | - } | |
| 135 | - } | |
| 122 | +<script type="text/javascript"> | |
| 123 | +$(function(){ | |
| 124 | + //字典组代码和名称对照 | |
| 125 | + var dGroups = {}; | |
| 126 | + | |
| 127 | + var page = 0, initPagination; | |
| 128 | + var icheckOptions = { | |
| 129 | + checkboxClass: 'icheckbox_flat-blue', | |
| 130 | + increaseArea: '20%' | |
| 131 | + } | |
| 132 | + | |
| 133 | + var init = function(){ | |
| 134 | + //字典组下拉框 | |
| 135 | + $.get('/dictionary/all', {dGroup_eq: 0}, function(rs){ | |
| 136 | + var data = [{id: '-1', text: '请选择...'}]; | |
| 137 | + $.each(rs, function(){ | |
| 138 | + dGroups[this.dCode] = this.dName; | |
| 139 | + data.push({id: this.dCode, text: this.dName + ' -' +this.dCode}); | |
| 140 | + }); | |
| 141 | + initPinYinSelect2('#dGroupSelect' , data); | |
| 142 | + jsDoQuery(null,true); | |
| 143 | + }); | |
| 144 | + } | |
| 145 | + | |
| 146 | + init(); | |
| 136 | 147 | |
| 137 | - var htmlStr = template('dict_list_temp', { | |
| 138 | - list : groups | |
| 148 | + | |
| 149 | + //重置 | |
| 150 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 151 | + $('tr.filter input, select').val('').change(); | |
| 152 | + jsDoQuery(null, true); | |
| 153 | + }); | |
| 154 | + | |
| 155 | + //切换字典组 | |
| 156 | + $('#dGroupSelect').on('change', function(){ | |
| 157 | + var val = $(this).val(), params = {}; | |
| 158 | + if(val && val != -1){ | |
| 159 | + params['dGroup_eq'] = val; | |
| 160 | + } | |
| 161 | + page = 0; | |
| 162 | + jsDoQuery(params, true); | |
| 163 | + }); | |
| 164 | + | |
| 165 | + /* | |
| 166 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 167 | + */ | |
| 168 | + function jsDoQuery(p, pagination){ | |
| 169 | + var params = {}; | |
| 170 | + if(p) | |
| 171 | + params = p; | |
| 172 | + //更新时间排序 | |
| 173 | + params['order'] = 'dGroup'; | |
| 174 | + params['page'] = page; | |
| 175 | + params['dGroup_ne'] = 0; | |
| 176 | + var i = layer.load(2); | |
| 177 | + $get('/dictionary' ,params, function(data){ | |
| 178 | + $.each(data.content, function(){ | |
| 179 | + this.dGroupText = dGroups[this.dGroup]; | |
| 139 | 180 | }); |
| 140 | - $('#dictsContainer').html(htmlStr); | |
| 181 | + var bodyHtm = template('dictionary_list_temp', {list: data.content}); | |
| 182 | + | |
| 183 | + $('#datatable_dictionary tbody').html(bodyHtm) | |
| 184 | + .find('.icheck').iCheck(icheckOptions) | |
| 185 | + .on('ifChanged', iCheckChange); | |
| 186 | + if(pagination && data.content.length > 0){ | |
| 187 | + //重新分页 | |
| 188 | + initPagination = true; | |
| 189 | + showPagination(data); | |
| 190 | + } | |
| 191 | + layer.close(i); | |
| 141 | 192 | }); |
| 193 | + } | |
| 194 | + | |
| 195 | + function iCheckChange(){ | |
| 196 | + var tr = $(this).parents('tr'); | |
| 197 | + if(this.checked) | |
| 198 | + tr.addClass('row-active'); | |
| 199 | + else | |
| 200 | + tr.removeClass('row-active'); | |
| 201 | + | |
| 202 | + if($('#datatable_dictionary input.icheck:checked').length == 1) | |
| 203 | + $('#removeButton').removeAttr('disabled'); | |
| 204 | + else | |
| 205 | + $('#removeButton').attr('disabled', 'disabled'); | |
| 206 | + } | |
| 207 | + | |
| 208 | + function showPagination(data){ | |
| 209 | + //分页 | |
| 210 | + $('#pagination').jqPaginator({ | |
| 211 | + totalPages: data.totalPages, | |
| 212 | + visiblePages: 6, | |
| 213 | + currentPage: page + 1, | |
| 214 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | |
| 215 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | |
| 216 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | |
| 217 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | |
| 218 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | |
| 219 | + onPageChange: function (num, type) { | |
| 220 | + if(initPagination){ | |
| 221 | + initPagination = false; | |
| 222 | + return; | |
| 223 | + } | |
| 224 | + | |
| 225 | + | |
| 226 | + page = num - 1; | |
| 227 | + jsDoQuery(null, false); | |
| 228 | + } | |
| 229 | + }); | |
| 230 | + } | |
| 231 | + | |
| 232 | + //删除 | |
| 233 | + $('#removeButton').on('click', function(){ | |
| 234 | + if($(this).attr('disabled')) | |
| 235 | + return; | |
| 236 | + | |
| 237 | + var id = $('#datatable_resource input.icheck:checked').data('id'); | |
| 238 | + layer.msg('删除还没写....'); | |
| 239 | + /* removeConfirm('确定要删除选中的数据?', '/dictionary/' + id ,function(){ | |
| 240 | + $('tr.filter .filter-submit').click(); | |
| 241 | + }); */ | |
| 142 | 242 | }); |
| 143 | -</script> | |
| 144 | 243 | \ No newline at end of file |
| 244 | +}); | |
| 245 | +</script> | ... | ... |
src/main/resources/static/pages/permission/dictionary/list_old.html
0 → 100644
| 1 | +<div class="page-head"> | |
| 2 | + <div class="page-title"> | |
| 3 | + <h1>字典管理</h1> | |
| 4 | + </div> | |
| 5 | +</div> | |
| 6 | + | |
| 7 | +<ul class="page-breadcrumb breadcrumb"> | |
| 8 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i | |
| 9 | + class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li> | |
| 11 | + <li><span class="active">字典管理</span></li> | |
| 12 | +</ul> | |
| 13 | + | |
| 14 | +<div class="row"> | |
| 15 | + <div class="col-md-12"> | |
| 16 | + <!-- Begin: life time stats --> | |
| 17 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 18 | + <div class="portlet-title"> | |
| 19 | + <div class="caption"> | |
| 20 | + <i class="fa fa-database font-dark"></i> <span | |
| 21 | + class="caption-subject font-dark sbold uppercase">字典表</span> | |
| 22 | + </div> | |
| 23 | + <div class="actions"> | |
| 24 | + <a class="btn btn-circle blue" href="add.html" data-pjax><i | |
| 25 | + class="fa fa-plus"></i> 添加字典</a> | |
| 26 | + </div> | |
| 27 | + </div> | |
| 28 | + <div class="portlet-body"> | |
| 29 | + <div class="row" id="dictsContainer"></div> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | +</div> | |
| 34 | +<script id="dict_list_temp" type="text/html"> | |
| 35 | +{{each list as group i}} | |
| 36 | +<div class="col-lg-4"> | |
| 37 | +<div class="portlet light portlet-fit bordered"> | |
| 38 | + <div class="portlet-body"> | |
| 39 | + <div class="mt-element-list"> | |
| 40 | + <div class="mt-list-head list-default ext-1 bg-blue-chambray font-white " data-toggle="collapse" href="#list_{{group.dCode}}" aria-expanded="true"> | |
| 41 | + <div class="row"> | |
| 42 | + <div class="col-xs-7"> | |
| 43 | + <div class="list-head-title-container"> | |
| 44 | + <h3 class="list-title uppercase sbold">{{group.dName}}</h3> | |
| 45 | + <div class="list-date">4月, 2016</div> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + <div class="col-xs-4"> | |
| 49 | + <div class="list-head-summary-container"> | |
| 50 | + <div class="list-pending"> | |
| 51 | + <div class="list-label badge badge-danger">{{group.dCode}}</div> | |
| 52 | + </div> | |
| 53 | + </div> | |
| 54 | + </div> | |
| 55 | + </div> | |
| 56 | + </div> | |
| 57 | + | |
| 58 | +<div class="panel-collapse collapse mt-list-container list-default ext-1" id="list_{{group.dCode}}" | |
| 59 | + aria-expanded="true" style="max-height: 350px;overflow: auto;"> | |
| 60 | + <ul> | |
| 61 | + {{each group.children as item i}} | |
| 62 | + <li class="mt-list-item done"> | |
| 63 | + <div class="list-icon-container"> | |
| 64 | + <a href="javascript:;"> <i class="icon-close"></i> | |
| 65 | + </a> | |
| 66 | + </div> | |
| 67 | + <div class="list-datetime help-block"> | |
| 68 | + {{item.dCode}} | |
| 69 | + </div> | |
| 70 | + <div class="list-item-content"> | |
| 71 | + <h3 class="uppercase"> | |
| 72 | + <a href="javascript:;">{{item.dName}}</a> | |
| 73 | + </h3> | |
| 74 | + <p class="help-block">{{item.descriptions}}</p> | |
| 75 | + </div> | |
| 76 | + </li> | |
| 77 | + {{/each}} | |
| 78 | + </ul> | |
| 79 | +</div> | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + </div> | |
| 84 | + </div> | |
| 85 | +</div> | |
| 86 | +</div> | |
| 87 | +{{/each}} | |
| 88 | +</script> | |
| 89 | + | |
| 90 | +<!-- | |
| 91 | +<div class="mt-list-container list-default ext-1"> | |
| 92 | + <ul> | |
| 93 | + {{each group.children as item i}} | |
| 94 | + <li class="mt-list-item done"> | |
| 95 | + <div class="list-icon-container"> | |
| 96 | + <a href="javascript:;"> <i class="icon-close"></i> | |
| 97 | + </a> | |
| 98 | + </div> | |
| 99 | + <div class="list-datetime help-block"> | |
| 100 | + {{item.dCode}} | |
| 101 | + </div> | |
| 102 | + <div class="list-item-content"> | |
| 103 | + <h3 class="uppercase"> | |
| 104 | + <a href="javascript:;">{{item.dName}}</a> | |
| 105 | + </h3> | |
| 106 | + <p class="help-block">{{item.descriptions}}</p> | |
| 107 | + </div> | |
| 108 | + </li> | |
| 109 | + {{/each}} | |
| 110 | + </ul> | |
| 111 | + </div> | |
| 112 | + --> | |
| 113 | +<script> | |
| 114 | + $(function() { | |
| 115 | + | |
| 116 | + $get('/dictionary/all', null, function(array) { | |
| 117 | + var groups = [], len = array.length, fs = ''; | |
| 118 | + for (var i = 0; i < len; i++) { | |
| 119 | + var pCode = array[i].dGroup; | |
| 120 | + | |
| 121 | + if (pCode == 0) { | |
| 122 | + array[i].updateDate = moment(array[i].updateDate) | |
| 123 | + .format(fs); | |
| 124 | + groups.push(array[i]); | |
| 125 | + } | |
| 126 | + | |
| 127 | + for (var j = 0; j < len; j++) { | |
| 128 | + if (pCode == array[j].dCode) { | |
| 129 | + if (!array[j].children) | |
| 130 | + array[j].children = []; | |
| 131 | + array[j].children.push(array[i]); | |
| 132 | + break; | |
| 133 | + } | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + var htmlStr = template('dict_list_temp', { | |
| 138 | + list : groups | |
| 139 | + }); | |
| 140 | + $('#dictsContainer').html(htmlStr); | |
| 141 | + }); | |
| 142 | + }); | |
| 143 | +</script> | |
| 0 | 144 | \ No newline at end of file | ... | ... |