Commit 8de956dca7d86dcc3e4c3ac8513b6e9a72c45a31

Authored by 潘钊
1 parent 64d242d5

add tts模块, 加入班次搜索框

src/main/resources/static/real_control_v2/js/data/data_basic.js
@@ -2,11 +2,12 @@ @@ -2,11 +2,12 @@
2 2
3 var gb_data_basic = (function() { 3 var gb_data_basic = (function() {
4 4
5 - var stationRoutes,lineCode2NameAll,lineInformations;  
6 - var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", function(routes, code2Name, informations) { 5 + var stationRoutes,lineCode2NameAll,lineInformations, nbbm2deviceMap;
  6 + var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", function(routes, code2Name, informations, nbbm2device) {
7 stationRoutes = routes; 7 stationRoutes = routes;
8 lineCode2NameAll = code2Name; 8 lineCode2NameAll = code2Name;
9 lineInformations = informations; 9 lineInformations = informations;
  10 + nbbm2deviceMap = nbbm2device;
10 gb_main_ep.emitLater('data-basic'); 11 gb_main_ep.emitLater('data-basic');
11 }); 12 });
12 13
@@ -46,6 +47,11 @@ var gb_data_basic = (function() { @@ -46,6 +47,11 @@ var gb_data_basic = (function() {
46 ep.emit('lineCode2Name', rs); 47 ep.emit('lineCode2Name', rs);
47 }); 48 });
48 49
  50 + //nbbm to device id
  51 + $.get('/basic/nbbm2deviceId', function(rs){
  52 + ep.emit('nbbm2deviceId', rs);
  53 + });
  54 +
49 function findLineByCodes(codeArr){ 55 function findLineByCodes(codeArr){
50 var rs=[]; 56 var rs=[];
51 $.each(codeArr, function(){ 57 $.each(codeArr, function(){
@@ -73,6 +79,7 @@ var gb_data_basic = (function() { @@ -73,6 +79,7 @@ var gb_data_basic = (function() {
73 activeLines: activeLines, 79 activeLines: activeLines,
74 line_idx: line_idx, 80 line_idx: line_idx,
75 codeToLine: codeToLine, 81 codeToLine: codeToLine,
  82 + nbbm2deviceMap: function(){return nbbm2deviceMap;},
76 getLineInformation: getLineInformation, 83 getLineInformation: getLineInformation,
77 stationRoutes: function(lineCode){return stationRoutes[lineCode]}, 84 stationRoutes: function(lineCode){return stationRoutes[lineCode]},
78 findLineByCodes: findLineByCodes, 85 findLineByCodes: findLineByCodes,
src/main/resources/static/real_control_v2/js/data/data_gps.js
@@ -76,11 +76,16 @@ var gb_data_gps = (function() { @@ -76,11 +76,16 @@ var gb_data_gps = (function() {
76 return realData[deviceId]; 76 return realData[deviceId];
77 } 77 }
78 78
  79 + var findGpsByNbbm = function(nbbm){
  80 + return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
  81 + }
  82 +
79 return { 83 return {
80 fixedTimeRefresh: fixedTimeRefresh, 84 fixedTimeRefresh: fixedTimeRefresh,
81 registerCallback: registerCallback, 85 registerCallback: registerCallback,
82 allGps: realData, 86 allGps: realData,
83 gpsByLineCode: gpsByLineCode, 87 gpsByLineCode: gpsByLineCode,
84 - findOne: findOne 88 + findOne: findOne,
  89 + findGpsByNbbm: findGpsByNbbm
85 }; 90 };
86 })(); 91 })();
src/main/resources/static/real_control_v2/js/data/data_schedule.js deleted 100644 → 0
1 -/* 实际排班数据管理模块 */  
2 -  
3 -var gb_data_sch = (function(){  
4 -  
5 -})();  
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
@@ -12,5 +12,10 @@ @@ -12,5 +12,10 @@
12 }] 12 }]
13 }, { 13 }, {
14 "id": 3, 14 "id": 3,
15 - "text": "系统设置" 15 + "text": "系统设置",
  16 + "children": [{
  17 + "id": 3.1,
  18 + "text": "TTS",
  19 + "event": "tts_config"
  20 + }]
16 }] 21 }]
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -5,7 +5,8 @@ var gb_schedule_table = (function() { @@ -5,7 +5,8 @@ var gb_schedule_table = (function() {
5 var temps; 5 var temps;
6 //线路分组的班次数据 6 //线路分组的班次数据
7 var line2Schedule = {}; 7 var line2Schedule = {};
8 - 8 + //车辆应发未发车辆数
  9 + var car_yfwf_map = {};
9 var schedule_sort = function(s1, s2) { 10 var schedule_sort = function(s1, s2) {
10 return s1.dfsjT - s2.dfsjT; 11 return s1.dfsjT - s2.dfsjT;
11 } 12 }
@@ -64,7 +65,7 @@ var gb_schedule_table = (function() { @@ -64,7 +65,7 @@ var gb_schedule_table = (function() {
64 //dbclick event 65 //dbclick event
65 gb_schedule_table_dbclick.init(); 66 gb_schedule_table_dbclick.init();
66 67
67 - cb&&cb(); 68 + cb && cb();
68 }); 69 });
69 } 70 }
70 71
@@ -97,44 +98,44 @@ var gb_schedule_table = (function() { @@ -97,44 +98,44 @@ var gb_schedule_table = (function() {
97 } 98 }
98 99
99 //新增一个班次,附带更新的班次 100 //新增一个班次,附带更新的班次
100 - var insertSchedule=function(sch, upArr){  
101 - line2Schedule[sch.xlBm][sch.id]=sch;  
102 - //update  
103 - if(isArray(upArr)){  
104 - $.each(upArr, function(){  
105 - line2Schedule[this.xlBm][this.id]=this;  
106 - });  
107 - }  
108 -  
109 - //重新渲染表格  
110 - var data=gb_common.get_vals(line2Schedule[sch.xlBm]).sort(schedule_sort)  
111 - ,dirData = gb_common.groupBy(data, 'xlDir')  
112 - ,tabCont=$('li.line_schedule[data-id='+sch.xlBm+']');  
113 -  
114 - for (var upDown in dirData) {  
115 - htmlStr = temps['line-schedule-table-temp']({  
116 - dir: upDown,  
117 - line: gb_data_basic.codeToLine[sch.xlBm],  
118 - list: dirData[upDown]  
119 - });  
120 - $('.schedule-wrap .card-panel:eq(' + upDown + ')', tabCont).html(htmlStr);  
121 - }  
122 - calc_yfwf_num(sch.xlBm);  
123 - //定位到新添加的班次  
124 - scroToDl(sch); 101 + var insertSchedule = function(sch, upArr) {
  102 + line2Schedule[sch.xlBm][sch.id] = sch;
  103 + //update
  104 + if (isArray(upArr)) {
  105 + $.each(upArr, function() {
  106 + line2Schedule[this.xlBm][this.id] = this;
  107 + });
  108 + }
  109 +
  110 + //重新渲染表格
  111 + var data = gb_common.get_vals(line2Schedule[sch.xlBm]).sort(schedule_sort),
  112 + dirData = gb_common.groupBy(data, 'xlDir'),
  113 + tabCont = $('li.line_schedule[data-id=' + sch.xlBm + ']');
  114 +
  115 + for (var upDown in dirData) {
  116 + htmlStr = temps['line-schedule-table-temp']({
  117 + dir: upDown,
  118 + line: gb_data_basic.codeToLine[sch.xlBm],
  119 + list: dirData[upDown]
  120 + });
  121 + $('.schedule-wrap .card-panel:eq(' + upDown + ')', tabCont).html(htmlStr);
  122 + }
  123 + calc_yfwf_num(sch.xlBm);
  124 + //定位到新添加的班次
  125 + scroToDl(sch);
125 } 126 }
126 127
127 //删除一个班次 128 //删除一个班次
128 - var deheteSchedule = function(sch){  
129 - sch = line2Schedule[sch.xlBm][sch.id];  
130 - if(sch){  
131 - var dl = $('li.line_schedule[data-id=' + sch.xlBm + '] .ct_table_body dl[data-id=' + sch.id + ']')  
132 - ,dls=dl.parent().find('dl');  
133 - delete line2Schedule[sch.xlBm][sch.id];  
134 - dl.remove();  
135 - reset_seq_no(dls);  
136 - calc_yfwf_num(sch.xlBm);  
137 - } 129 + var deheteSchedule = function(sch) {
  130 + sch = line2Schedule[sch.xlBm][sch.id];
  131 + if (sch) {
  132 + var dl = $('li.line_schedule[data-id=' + sch.xlBm + '] .ct_table_body dl[data-id=' + sch.id + ']'),
  133 + dls = dl.parent().find('dl');
  134 + delete line2Schedule[sch.xlBm][sch.id];
  135 + dl.remove();
  136 + reset_seq_no(dls);
  137 + calc_yfwf_num(sch.xlBm);
  138 + }
138 } 139 }
139 140
140 //更新班次 141 //更新班次
@@ -150,7 +151,7 @@ var gb_schedule_table = (function() { @@ -150,7 +151,7 @@ var gb_schedule_table = (function() {
150 151
151 //update dom 152 //update dom
152 var updateDom = function(sch) { 153 var updateDom = function(sch) {
153 - if(!sch) return; 154 + if (!sch) return;
154 var dl = $('li.line_schedule[data-id=' + sch.xlBm + '] .ct_table_body dl[data-id=' + sch.id + ']'); 155 var dl = $('li.line_schedule[data-id=' + sch.xlBm + '] .ct_table_body dl[data-id=' + sch.id + ']');
155 var dds = $('dd', dl); 156 var dds = $('dd', dl);
156 $(dds[1]).find('a').text(sch.lpName); 157 $(dds[1]).find('a').text(sch.lpName);
@@ -169,17 +170,17 @@ var gb_schedule_table = (function() { @@ -169,17 +170,17 @@ var gb_schedule_table = (function() {
169 calc_sch_real_shift(sch); 170 calc_sch_real_shift(sch);
170 var sfsjDd = temps['line-schedule-sfsj-temp'](sch); 171 var sfsjDd = temps['line-schedule-sfsj-temp'](sch);
171 $(dds[7]).replaceWith(sfsjDd); 172 $(dds[7]).replaceWith(sfsjDd);
172 - if(sch.remarks)  
173 - $(dds[8]).html('<span title="'+sch.remarks+'" data-uk-tooltip="{pos:\'top-left\'}">'+sch.remarks+'</span>'); 173 + if (sch.remarks)
  174 + $(dds[8]).html('<span title="' + sch.remarks + '" data-uk-tooltip="{pos:\'top-left\'}">' + sch.remarks + '</span>');
174 else 175 else
175 - $(dds[8]).html(''); 176 + $(dds[8]).html('');
176 } 177 }
177 178
178 //拖拽选中... 179 //拖拽选中...
179 var seq_nos = '.line-schedule-table .ct_table_body>dl>dd.seq_no'; 180 var seq_nos = '.line-schedule-table .ct_table_body>dl>dd.seq_no';
180 var drag_strat; 181 var drag_strat;
181 $(document).on('mousedown', seq_nos, function(e) { 182 $(document).on('mousedown', seq_nos, function(e) {
182 - if(e.button != 0) return; 183 + if (e.button != 0) return;
183 var dl = $(this).parent(); 184 var dl = $(this).parent();
184 if (dl.hasClass('drag-active')) 185 if (dl.hasClass('drag-active'))
185 dl.removeClass('drag-active'); 186 dl.removeClass('drag-active');
@@ -196,14 +197,14 @@ var gb_schedule_table = (function() { @@ -196,14 +197,14 @@ var gb_schedule_table = (function() {
196 197
197 reset_drag_active_all(this); 198 reset_drag_active_all(this);
198 //向上选中 199 //向上选中
199 - if(e <= drag_strat){  
200 - for (var i = drag_strat; i > e-2; i--)  
201 - $(dls[i]).addClass('drag-active'); 200 + if (e <= drag_strat) {
  201 + for (var i = drag_strat; i > e - 2; i--)
  202 + $(dls[i]).addClass('drag-active');
202 } 203 }
203 //向下选中 204 //向下选中
204 - else{  
205 - for (var j = drag_strat; j < e; j++)  
206 - $(dls[j]).addClass('drag-active'); 205 + else {
  206 + for (var j = drag_strat; j < e; j++)
  207 + $(dls[j]).addClass('drag-active');
207 } 208 }
208 } 209 }
209 }).on('click', seq_nos, function() { 210 }).on('click', seq_nos, function() {
@@ -220,22 +221,22 @@ var gb_schedule_table = (function() { @@ -220,22 +221,22 @@ var gb_schedule_table = (function() {
220 schArr = gb_common.get_vals(line2Schedule[lineCode]).filter(function(item) { 221 schArr = gb_common.get_vals(line2Schedule[lineCode]).filter(function(item) {
221 return item.clZbh == sch.clZbh; 222 return item.clZbh == sch.clZbh;
222 }).sort(schedule_sort), 223 }).sort(schedule_sort),
223 - nextSch,tempDL; 224 + nextSch, tempDL;
224 $.each(schArr, function(i) { 225 $.each(schArr, function(i) {
225 - tempDL=$('dl[data-id=' + this.id + ']', contWrap); 226 + tempDL = $('dl[data-id=' + this.id + ']', contWrap);
226 tempDL.addClass('relevance-active'); 227 tempDL.addClass('relevance-active');
227 - if (i < schArr.length - 1 && this.id == id){  
228 - nextSch = schArr[i + 1];  
229 - tempDL.addClass('intimity'); 228 + if (i < schArr.length - 1 && this.id == id) {
  229 + nextSch = schArr[i + 1];
  230 + tempDL.addClass('intimity');
230 } 231 }
231 }); 232 });
232 233
233 - if(nextSch){  
234 - $('dl[data-id=' + nextSch.id + ']', contWrap).addClass('intimity');  
235 - if (nextSch.xlDir == sch.xlDir)  
236 - return;  
237 - //滚动到下一个班次  
238 - scroToDl(nextSch); 234 + if (nextSch) {
  235 + $('dl[data-id=' + nextSch.id + ']', contWrap).addClass('intimity');
  236 + if (nextSch.xlDir == sch.xlDir)
  237 + return;
  238 + //滚动到下一个班次
  239 + scroToDl(nextSch);
239 } 240 }
240 }); 241 });
241 242
@@ -282,25 +283,33 @@ var gb_schedule_table = (function() { @@ -282,25 +283,33 @@ var gb_schedule_table = (function() {
282 $(dd).parents('.uk-grid.schedule-wrap').find('.relevance-active').removeClass('relevance-active intimity'); 283 $(dd).parents('.uk-grid.schedule-wrap').find('.relevance-active').removeClass('relevance-active intimity');
283 } 284 }
284 285
285 - //计算应发未发数量  
286 - var calc_yfwf_num = function(lineCode){  
287 286
288 - var schArr=gb_common.get_vals(line2Schedule[lineCode]).sort(schedule_sort)  
289 - ,yfwf_num=0  
290 - ,t = new Date().valueOf(); 287 + //计算应发未发数量 car_yfwf_map
  288 + var calc_yfwf_num = function(lineCode) {
291 289
292 - $.each(schArr, function(){  
293 - if(this.fcsjT > t)  
294 - return false; 290 + var schArr = gb_common.get_vals(line2Schedule[lineCode]).sort(schedule_sort),
  291 + yfwf_num = 0,
  292 + t = new Date().valueOf();
295 293
296 - if(this.fcsjActual == null && this.fcsjActualTime == null && this.status != -1)  
297 - yfwf_num ++;  
298 - }); 294 + var carYfwfMap={}, nbbm;
  295 + $.each(schArr, function() {
  296 + if (this.fcsjT > t)
  297 + return false;
  298 +
  299 + if (this.fcsjActual == null && this.fcsjActualTime == null && this.status != -1){
  300 + yfwf_num++;
  301 + nbbm=this.clZbh;
  302 + if(carYfwfMap[nbbm])
  303 + carYfwfMap[nbbm]++;
  304 + else
  305 + carYfwfMap[nbbm]=1;
  306 + }
  307 + });
  308 + car_yfwf_map[lineCode]=carYfwfMap;
299 309
300 - $('#badge_yfwf_num_'+lineCode).text(yfwf_num); 310 + $('#badge_yfwf_num_' + lineCode).text(yfwf_num);
301 } 311 }
302 312
303 -  
304 return { 313 return {
305 show: show, 314 show: show,
306 findScheduleByLine: findScheduleByLine, 315 findScheduleByLine: findScheduleByLine,
@@ -308,6 +317,7 @@ var gb_schedule_table = (function() { @@ -308,6 +317,7 @@ var gb_schedule_table = (function() {
308 deheteSchedule: deheteSchedule, 317 deheteSchedule: deheteSchedule,
309 insertSchedule: insertSchedule, 318 insertSchedule: insertSchedule,
310 schedule_sort: schedule_sort, 319 schedule_sort: schedule_sort,
311 - calc_yfwf_num: calc_yfwf_num 320 + calc_yfwf_num: calc_yfwf_num,
  321 + car_yfwf_map: function(lineCode){return car_yfwf_map[lineCode];}
312 }; 322 };
313 })(); 323 })();
src/main/resources/static/real_control_v2/js/line_schedule/search.js
@@ -8,7 +8,7 @@ var gb_sch_search = (function() { @@ -8,7 +8,7 @@ var gb_sch_search = (function() {
8 ' <li data-value="{{ $item.value }}">' + 8 ' <li data-value="{{ $item.value }}">' +
9 ' <a>' + 9 ' <a>' +
10 ' {{ $item.value }}' + 10 ' {{ $item.value }}' +
11 - ' <small >执行班次 07:00</small>' + 11 + ' <small >{{$item.exec}}</small>' +
12 ' <small class="search-result-desc">{{{ $item.desc }}}</small>' + 12 ' <small class="search-result-desc">{{{ $item.desc }}}</small>' +
13 ' </a>' + 13 ' </a>' +
14 ' </li>' + 14 ' </li>' +
@@ -20,7 +20,7 @@ var gb_sch_search = (function() { @@ -20,7 +20,7 @@ var gb_sch_search = (function() {
20 _input, schArr, lineCode, group_cars; 20 _input, schArr, lineCode, group_cars;
21 $(document) 21 $(document)
22 .on('focus', ips, function() { 22 .on('focus', ips, function() {
23 - $(this).addClass('active'); 23 + $(this).parent().addClass('active');
24 lineCode = $(this).parents('li.line_schedule').data('id'); 24 lineCode = $(this).parents('li.line_schedule').data('id');
25 schArr = gb_common.get_vals(gb_schedule_table.findScheduleByLine(lineCode)); 25 schArr = gb_common.get_vals(gb_schedule_table.findScheduleByLine(lineCode));
26 26
@@ -28,10 +28,15 @@ var gb_sch_search = (function() { @@ -28,10 +28,15 @@ var gb_sch_search = (function() {
28 _input = $(this); 28 _input = $(this);
29 }) 29 })
30 .on('blur', ips, function() { 30 .on('blur', ips, function() {
31 - if ($(this).val() == '')  
32 - $(this).removeClass('active'); 31 + if ($(this).val() == ''){
  32 + reset_all();
  33 + }
33 }); 34 });
34 35
  36 + $(document).on('click', '.search_sch_panel i.cancel', function(){
  37 + reset_all();
  38 + });
  39 +
35 var elements = '.search_sch_panel .sch-search-autocom'; 40 var elements = '.search_sch_panel .sch-search-autocom';
36 var init = function() { 41 var init = function() {
37 $(elements).each(function() { 42 $(elements).each(function() {
@@ -43,32 +48,67 @@ var gb_sch_search = (function() { @@ -43,32 +48,67 @@ var gb_sch_search = (function() {
43 var constructor = function(e) { 48 var constructor = function(e) {
44 UIkit.autocomplete(e, { 49 UIkit.autocomplete(e, {
45 minLength: 1, 50 minLength: 1,
46 - delay: 50, 51 + delay: 10,
47 source: autocomplete_source 52 source: autocomplete_source
48 }).on('selectitem.uk.autocomplete', selectitem); 53 }).on('selectitem.uk.autocomplete', selectitem);
49 } 54 }
50 55
51 var autocomplete_source = function(release) { 56 var autocomplete_source = function(release) {
52 var rs = [], 57 var rs = [],
53 - v = _input.val().toUpperCase(); 58 + v = _input.val().toUpperCase(),
  59 + gps, yfwf_map = gb_schedule_table.car_yfwf_map(lineCode);
  60 +
54 for (var car in group_cars) { 61 for (var car in group_cars) {
55 - if (car.indexOf(v) != -1) 62 + if (car.indexOf(v) != -1) {
  63 + //车辆对应的gps
  64 + gps = gb_data_gps.findGpsByNbbm(car)
56 rs.push({ 65 rs.push({
57 value: car, 66 value: car,
58 - desc: '应发未发:0,已完成 8 个班次' 67 + desc: '应发未发:' + (yfwf_map[car] == null ? 0 : yfwf_map[car]),
  68 + exec: execSch(gps)
59 }); 69 });
  70 + }
60 } 71 }
61 72
62 - console.log(rs);  
63 release && release(rs); 73 release && release(rs);
64 } 74 }
65 75
66 - var selectitem = function(event, data, acobject){  
67 - var cont='li.line_schedule[data-id='+lineCode+']'  
68 - ,tbodys=$('.line-schedule-table .ct_table_body', cont); 76 + var reset_all = function() {
  77 + var cont = 'li.line_schedule[data-id=' + lineCode + ']';
  78 + //uikit 会记住上一次搜索值,触发keyup以清空该值
  79 + $('.sch-search-autocom input', cont).val('').trigger('keyup').parent().removeClass('active');
  80 + $('.line-schedule-table .ct_table_body dl._search_hide', cont).removeClass('_search_hide');
  81 + }
  82 +
  83 + function execSch(gps) {
  84 + if (gps && gps.schId) {
  85 + var sch = gb_schedule_table.findScheduleByLine(gps.lineId)[gps.schId];
  86 + if (sch)
  87 + return '(执行' + (sch.xlDir == 0 ? '上行' : '下行') + sch.dfsj + ')';
  88 + }
  89 + return '';
  90 + }
  91 +
  92 + var selectitem = function(event, data, acobject) {
  93 + var cont = 'li.line_schedule[data-id=' + lineCode + ']',
  94 + tbodys = $('.line-schedule-table .ct_table_body', cont);
  95 +
  96 + $('.sch-search-autocom input', cont).val(data.value).parent().addClass('active');
  97 +
  98 + $.each(tbodys, function() {
  99 + filterScheduleByNbbm(this, data.value);
  100 + });
  101 + }
69 102
70 - $('.sch-search-autocom input', cont).val(data.value).addClass('active');  
71 - console.log(tbodys); 103 + var filterScheduleByNbbm = function(tbody, car) {
  104 + var dls = $('dl', tbody),
  105 + dds;
  106 + dls.removeClass('_search_hide');
  107 + $.each(dls, function() {
  108 + dds = $('dd', this);
  109 + if (car != $(dds[2]).data('nbbm'))
  110 + $(this).addClass('_search_hide');
  111 + });
72 } 112 }
73 113
74 return { 114 return {
src/main/resources/static/real_control_v2/js/main.js
@@ -37,7 +37,7 @@ var gb_main_ep = new EventProxy(), @@ -37,7 +37,7 @@ var gb_main_ep = new EventProxy(),
37 eq.once('render-sch-table', function() { 37 eq.once('render-sch-table', function() {
38 gb_schedule_table.show(function(){ 38 gb_schedule_table.show(function(){
39 //搜索框 39 //搜索框
40 - //gb_sch_search.init(); 40 + gb_sch_search.init();
41 }); 41 });
42 42
43 //嵌入地图页面 43 //嵌入地图页面
src/main/resources/static/real_control_v2/js/north/toolbar.js
@@ -46,6 +46,9 @@ var gb_northToolbar = (function() { @@ -46,6 +46,9 @@ var gb_northToolbar = (function() {
46 }, 46 },
47 directive_history: function(){ 47 directive_history: function(){
48 open_modal('/real_control_v2/fragments/north/nav/directive_history.html', {}, modal_opts); 48 open_modal('/real_control_v2/fragments/north/nav/directive_history.html', {}, modal_opts);
  49 + },
  50 + tts_config: function(){
  51 + open_modal('/real_control_v2/fragments/north/nav/tts_config.html', {}, modal_opts);
49 } 52 }
50 } 53 }
51 })(); 54 })();
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
@@ -44,7 +44,11 @@ var gb_sch_websocket = (function() { @@ -44,7 +44,11 @@ var gb_sch_websocket = (function() {
44 msg.dateStr = moment(msg.timestamp).format('HH:mm'); 44 msg.dateStr = moment(msg.timestamp).format('HH:mm');
45 msg.text = gb_common.reqCode80[msg.data.requestCode]; 45 msg.text = gb_common.reqCode80[msg.data.requestCode];
46 46
47 - findMailBox(msg.data.lineId).prepend(temps['sys-note-80-temp'](msg)); 47 + var $item=$(temps['sys-note-80-temp'](msg));
  48 + findMailBox(msg.data.lineId).prepend($item);
  49 + //tts
  50 + var ttsMsg=$item.find('.uk-panel-title').text();
  51 + gb_tts.speak(ttsMsg, msg.data.lineId);
48 } 52 }
49 53
50 var waitRemoves = []; 54 var waitRemoves = [];
@@ -53,12 +57,16 @@ var gb_sch_websocket = (function() { @@ -53,12 +57,16 @@ var gb_sch_websocket = (function() {
53 gb_schedule_table.updateSchedule(msg.t); 57 gb_schedule_table.updateSchedule(msg.t);
54 msg.domId = 'fache_' + msg.t.id + '_' + parseInt(Math.random() * 10000); 58 msg.domId = 'fache_' + msg.t.id + '_' + parseInt(Math.random() * 10000);
55 59
56 - findMailBox(msg.t.xlBm).prepend(temps['sys-note-42-temp'](msg)); 60 + var $item=$(temps['sys-note-42-temp'](msg));
  61 + findMailBox(msg.t.xlBm).prepend($item);
57 waitRemoves.push({ 62 waitRemoves.push({
58 t: currentSecond(), 63 t: currentSecond(),
59 dom: msg.domId 64 dom: msg.domId
60 }); 65 });
61 66
  67 + //tts
  68 + var ttsMsg=$item.find('.title').text();
  69 + gb_tts.speak(ttsMsg, msg.t.xlBm);
62 gb_schedule_table.calc_yfwf_num(msg.t.xlBm); 70 gb_schedule_table.calc_yfwf_num(msg.t.xlBm);
63 } 71 }
64 72
@@ -67,11 +75,15 @@ var gb_sch_websocket = (function() { @@ -67,11 +75,15 @@ var gb_sch_websocket = (function() {
67 gb_schedule_table.updateSchedule(msg.t); 75 gb_schedule_table.updateSchedule(msg.t);
68 msg.domId = 'zhongDian_' + msg.t.id + '_' + parseInt(Math.random() * 10000); 76 msg.domId = 'zhongDian_' + msg.t.id + '_' + parseInt(Math.random() * 10000);
69 77
70 - findMailBox(msg.t.xlBm).prepend(temps['sys-note-42_1-temp'](msg)); 78 + var $item=$(temps['sys-note-42_1-temp'](msg));
  79 + findMailBox(msg.t.xlBm).prepend($item);
71 waitRemoves.push({ 80 waitRemoves.push({
72 t: currentSecond(), 81 t: currentSecond(),
73 dom: msg.domId 82 dom: msg.domId
74 }); 83 });
  84 + //tts
  85 + var ttsMsg=$item.find('.title').text();
  86 + gb_tts.speak(ttsMsg, msg.t.xlBm);
75 } 87 }
76 88
77 //服务器通知刷新班次 89 //服务器通知刷新班次
src/main/resources/static/real_control_v2/main.html
@@ -126,6 +126,8 @@ @@ -126,6 +126,8 @@
126 <!-- websocket --> 126 <!-- websocket -->
127 <script src="/assets/js/sockjs.min.js"></script> 127 <script src="/assets/js/sockjs.min.js"></script>
128 <script src="/real_control_v2/js/websocket/sch_websocket.js"></script> 128 <script src="/real_control_v2/js/websocket/sch_websocket.js"></script>
  129 + <!-- tts -->
  130 + <script src="/real_control_v2/js/utils/tts.js"></script>
129 </body> 131 </body>
130 132
131 </html> 133 </html>