Commit d32f9c893edb525206d135d59286b513d62de663
1 parent
d0d05b4d
报表
Showing
58 changed files
with
1822 additions
and
600 deletions
pom.xml
| ... | ... | @@ -219,6 +219,12 @@ |
| 219 | 219 | <artifactId>jaxrpc-api</artifactId> |
| 220 | 220 | <version>1.1</version> |
| 221 | 221 | </dependency> |
| 222 | + | |
| 223 | + <dependency> | |
| 224 | + <groupId>org.springframework.boot</groupId> | |
| 225 | + <artifactId>spring-boot-devtools</artifactId> | |
| 226 | + <optional>true</optional> | |
| 227 | + </dependency> | |
| 222 | 228 | </dependencies> |
| 223 | 229 | |
| 224 | 230 | <dependencyManagement> |
| ... | ... | @@ -248,7 +254,6 @@ |
| 248 | 254 | <artifactId>maven-war-plugin</artifactId> |
| 249 | 255 | <version>2.2</version><!--$NO-MVN-MAN-VER$ --> |
| 250 | 256 | <configuration> |
| 251 | - <version>3.1</version> | |
| 252 | 257 | <failOnMissingWebXml>false</failOnMissingWebXml> |
| 253 | 258 | </configuration> |
| 254 | 259 | </plugin> |
| ... | ... | @@ -257,6 +262,12 @@ |
| 257 | 262 | <artifactId>spring-boot-maven-plugin</artifactId> |
| 258 | 263 | </plugin> |
| 259 | 264 | </plugins> |
| 265 | + <resources> | |
| 266 | + <resource> | |
| 267 | + <directory>src/main/resources</directory> | |
| 268 | + <filtering>false</filtering> | |
| 269 | + </resource> | |
| 270 | + </resources> | |
| 260 | 271 | </build> |
| 261 | 272 | <repositories> |
| 262 | 273 | <repository> | ... | ... |
src/main/java/com/bsth/controller/DeviceGpsController.java
0 → 100644
| 1 | +package com.bsth.controller; | |
| 2 | + | |
| 3 | +import java.io.BufferedReader; | |
| 4 | +import java.io.File; | |
| 5 | +import java.io.FileInputStream; | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.io.InputStreamReader; | |
| 8 | +import java.util.ArrayList; | |
| 9 | +import java.util.HashMap; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +import javax.servlet.http.HttpServletRequest; | |
| 14 | + | |
| 15 | +import org.apache.commons.lang.StringEscapeUtils; | |
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 17 | +import org.springframework.util.StringUtils; | |
| 18 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 19 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 20 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 21 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 22 | +import org.springframework.web.bind.annotation.RestController; | |
| 23 | +import org.springframework.web.multipart.MultipartFile; | |
| 24 | + | |
| 25 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 26 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 27 | +import com.fasterxml.jackson.core.JsonParseException; | |
| 28 | +import com.fasterxml.jackson.databind.JsonMappingException; | |
| 29 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 30 | + | |
| 31 | +@RestController | |
| 32 | +@RequestMapping("devicegps") | |
| 33 | +public class DeviceGpsController { | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + GpsRealData gpsRealData; | |
| 37 | + | |
| 38 | + @RequestMapping(value = "/real/line/{lineCode}") | |
| 39 | + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | |
| 40 | + return gpsRealData.getByLine(lineCode); | |
| 41 | + } | |
| 42 | + | |
| 43 | + @RequestMapping(value = "/real/all") | |
| 44 | + public List<GpsEntity> findByLineCodes() { | |
| 45 | + return new ArrayList<>(gpsRealData.all()); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @RequestMapping(value = "/open", method = RequestMethod.POST) | |
| 49 | + public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) { | |
| 50 | + Map<String, Object> res = new HashMap<>(); | |
| 51 | + File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + ""); | |
| 52 | + File rd = rf.getParentFile(); | |
| 53 | + if (!rd.exists()) { | |
| 54 | + rd.mkdirs(); | |
| 55 | + } | |
| 56 | + | |
| 57 | + BufferedReader reader = null; | |
| 58 | + try { | |
| 59 | + file.transferTo(rf); | |
| 60 | + reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK")); | |
| 61 | + String line = null; | |
| 62 | + List<Map<String, Object>> data = new ArrayList<>(); | |
| 63 | + while ((line = reader.readLine()) != null) { | |
| 64 | + if (!StringUtils.isEmpty(line)) { | |
| 65 | + String temp[] = line.split(","); | |
| 66 | + if (temp.length != 4) { | |
| 67 | + res.put("errCode", 1); | |
| 68 | + res.put("msg", "txt文档格式错误,请检查"); | |
| 69 | + return res; | |
| 70 | + } | |
| 71 | + Map<String, Object> info = new HashMap<>(); | |
| 72 | + info.put("lineName", temp[0]); | |
| 73 | + info.put("lineCode", temp[1]); | |
| 74 | + info.put("inCode", temp[2]); | |
| 75 | + info.put("deviceId", temp[3]); | |
| 76 | + info.put("detail", gpsRealData.get(temp[3])); | |
| 77 | + | |
| 78 | + data.add(info); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + // 删除临时文件 | |
| 82 | + rf.delete(); | |
| 83 | + res.put("errCode", 0); | |
| 84 | + res.put("data", data); | |
| 85 | + } catch (IllegalStateException e) { | |
| 86 | + // TODO Auto-generated catch block | |
| 87 | + e.printStackTrace(); | |
| 88 | + } catch (IOException e) { | |
| 89 | + // TODO Auto-generated catch block | |
| 90 | + e.printStackTrace(); | |
| 91 | + } finally { | |
| 92 | + try { | |
| 93 | + if (reader != null) reader.close(); | |
| 94 | + } catch (IOException e) { | |
| 95 | + // TODO Auto-generated catch block | |
| 96 | + e.printStackTrace(); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + return res; | |
| 101 | + } | |
| 102 | + | |
| 103 | + @SuppressWarnings("unchecked") | |
| 104 | + @RequestMapping(value = "/open/filter", method = RequestMethod.POST) | |
| 105 | + public Map<String, Object> filter(@RequestParam(value = "json")String json) { | |
| 106 | + json = StringEscapeUtils.unescapeHtml(json); | |
| 107 | + Map<String, Object> res = new HashMap<>(); | |
| 108 | + List<Map<String, Object>> data = null; | |
| 109 | + try { | |
| 110 | + data = new ObjectMapper().readValue(json, List.class); | |
| 111 | + for (Map<String, Object> info : data) { | |
| 112 | + info.put("detail", gpsRealData.findByDeviceId((String)info.get("deviceId"))); | |
| 113 | + } | |
| 114 | + | |
| 115 | + res.put("errCode", 0); | |
| 116 | + res.put("data", data); | |
| 117 | + } catch (JsonParseException e) { | |
| 118 | + // TODO Auto-generated catch block | |
| 119 | + e.printStackTrace(); | |
| 120 | + } catch (JsonMappingException e) { | |
| 121 | + // TODO Auto-generated catch block | |
| 122 | + e.printStackTrace(); | |
| 123 | + } catch (IOException e) { | |
| 124 | + // TODO Auto-generated catch block | |
| 125 | + e.printStackTrace(); | |
| 126 | + } | |
| 127 | + | |
| 128 | + return res; | |
| 129 | + } | |
| 130 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| ... | ... | @@ -21,6 +21,11 @@ public class BasicDataController { |
| 21 | 21 | return BasicData.deviceId2NbbmMap.values(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + @RequestMapping("/nbbm2deviceId") | |
| 25 | + public Map<String, String> nbbm2deviceId(Map<String, Object> map){ | |
| 26 | + return BasicData.deviceId2NbbmMap.inverse(); | |
| 27 | + } | |
| 28 | + | |
| 24 | 29 | @RequestMapping("/lineCode2Name") |
| 25 | 30 | public Map<String, String> findLineCodeMap(){ |
| 26 | 31 | return BasicData.lineCode2NameMap; | ... | ... |
src/main/java/com/bsth/data/BasicData.java
src/main/java/com/bsth/data/arrival/AnalyseData.java
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
| ... | ... | @@ -51,7 +51,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ |
| 51 | 51 | @Override |
| 52 | 52 | public void run(String... arg0) throws Exception { |
| 53 | 53 | logger.info("ArrivalData_GPS,30,10"); |
| 54 | - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS); | |
| 54 | + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 10, TimeUnit.SECONDS); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | @Component | ... | ... |
src/main/java/com/bsth/data/arrival/DataLoader.java
| ... | ... | @@ -58,7 +58,7 @@ public class DataLoader { |
| 58 | 58 | PreparedStatement ps = null; |
| 59 | 59 | ResultSet rs = null; |
| 60 | 60 | |
| 61 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | |
| 61 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by create_date"; | |
| 62 | 62 | try{ |
| 63 | 63 | long t = System.currentTimeMillis(); |
| 64 | 64 | ... | ... |
src/main/java/com/bsth/data/directive/FirstScheduleCheckThread.java
| ... | ... | @@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.stereotype.Component; |
| 10 | 10 | |
| 11 | +import com.bsth.data.match.Arrival2Schedule; | |
| 12 | +import com.bsth.data.match.ExpectArrivalEnd; | |
| 11 | 13 | import com.bsth.data.schedule.DayOfSchedule; |
| 12 | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 13 | 15 | import com.bsth.service.directive.DirectiveService; |
| ... | ... | @@ -63,6 +65,26 @@ public class FirstScheduleCheckThread extends Thread{ |
| 63 | 65 | && Math.abs(first.getDfsjT() - t) < THREE_MINUTES){ |
| 64 | 66 | |
| 65 | 67 | directiveService.send60Dispatch(first, dayOfSchedule.doneSum(first.getClZbh()), "定补@系统"); |
| 68 | + //期望完成出场班次时间 | |
| 69 | + long endTime; | |
| 70 | + | |
| 71 | + if(first.getZdsj() != null) | |
| 72 | + endTime=first.getZdsjT() - 60000; | |
| 73 | + else | |
| 74 | + endTime=schList.get(1).getDfsjT() - 60000; | |
| 75 | + | |
| 76 | + ExpectArrivalEnd ead = new ExpectArrivalEnd() | |
| 77 | + ,ead2 = new ExpectArrivalEnd(); | |
| 78 | + ead.setNbbm(car); | |
| 79 | + ead.setEndStation(first.getQdzCode()); | |
| 80 | + ead.setEndTime(endTime); | |
| 81 | + | |
| 82 | + ead2.setNbbm(car); | |
| 83 | + ead2.setEndStation(first.getZdzCode()); | |
| 84 | + ead2.setEndTime(endTime); | |
| 85 | + | |
| 86 | + Arrival2Schedule.addExpect(car, ead); | |
| 87 | + Arrival2Schedule.addExpect(car, ead2); | |
| 66 | 88 | } |
| 67 | 89 | } |
| 68 | 90 | } | ... | ... |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| ... | ... | @@ -52,7 +52,7 @@ public class GatewayHttpUtils { |
| 52 | 52 | post.setEntity(new StringEntity(jsonStr, "utf-8")); |
| 53 | 53 | |
| 54 | 54 | CloseableHttpResponse response = httpClient.execute(post); |
| 55 | - | |
| 55 | + | |
| 56 | 56 | JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); |
| 57 | 57 | if(null != json && json.getInteger("errCode") == 0) |
| 58 | 58 | code = 0; | ... | ... |
src/main/java/com/bsth/data/forecast/SampleTimeDataLoader.java
| 1 | 1 | package com.bsth.data.forecast; |
| 2 | 2 | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | 3 | import java.util.ArrayList; |
| 5 | 4 | import java.util.Collections; |
| 6 | 5 | import java.util.Comparator; |
| ... | ... | @@ -9,6 +8,8 @@ import java.util.Iterator; |
| 9 | 8 | import java.util.List; |
| 10 | 9 | import java.util.Set; |
| 11 | 10 | |
| 11 | +import org.joda.time.format.DateTimeFormat; | |
| 12 | +import org.joda.time.format.DateTimeFormatter; | |
| 12 | 13 | import org.slf4j.Logger; |
| 13 | 14 | import org.slf4j.LoggerFactory; |
| 14 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -39,14 +40,14 @@ public class SampleTimeDataLoader extends Thread { |
| 39 | 40 | // 当天日期 |
| 40 | 41 | String rq; |
| 41 | 42 | |
| 42 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 43 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm") | |
| 44 | + ,fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 43 | 45 | |
| 44 | 46 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 45 | 47 | |
| 46 | 48 | @Override |
| 47 | 49 | public void run() { |
| 48 | - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | |
| 49 | - rq = sdfyyyyMMdd.format(new Date()); | |
| 50 | + rq = fmtyyyyMMdd.print(new Date().getTime()); | |
| 50 | 51 | |
| 51 | 52 | Iterator<Sample> iterator = sampleRepository.findAll().iterator(); |
| 52 | 53 | ArrayListMultimap<String, Sample> sampleMap = ArrayListMultimap.create(); |
| ... | ... | @@ -103,8 +104,9 @@ public class SampleTimeDataLoader extends Thread { |
| 103 | 104 | TimeRange tg; |
| 104 | 105 | for (Sample s : list) { |
| 105 | 106 | tg = new TimeRange(); |
| 106 | - tg.startTime = sdfyyyyMMddHHmm.parse(rq + s.getsDate()).getTime(); | |
| 107 | - tg.endTime = sdfyyyyMMddHHmm.parse(rq + s.geteDate()).getTime(); | |
| 107 | + | |
| 108 | + tg.startTime = fmtyyyyMMddHHmm.parseMillis(rq + s.getsDate()); | |
| 109 | + tg.endTime = fmtyyyyMMddHHmm.parseMillis(rq + s.geteDate()); | |
| 108 | 110 | tg.runTime = s.getRunTime(); |
| 109 | 111 | simple.ranges.add(tg); |
| 110 | 112 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -66,6 +66,10 @@ public class GpsEntity { |
| 66 | 66 | |
| 67 | 67 | /** 是否异常数据 */ |
| 68 | 68 | private boolean abnormal; |
| 69 | + | |
| 70 | + private int valid; | |
| 71 | + | |
| 72 | + private int version; | |
| 69 | 73 | |
| 70 | 74 | public Integer getCompanyCode() { |
| 71 | 75 | return companyCode; |
| ... | ... | @@ -218,4 +222,20 @@ public class GpsEntity { |
| 218 | 222 | public void setAbnormal(boolean abnormal) { |
| 219 | 223 | this.abnormal = abnormal; |
| 220 | 224 | } |
| 225 | + | |
| 226 | + public int getValid() { | |
| 227 | + return valid; | |
| 228 | + } | |
| 229 | + | |
| 230 | + public void setValid(int valid) { | |
| 231 | + this.valid = valid; | |
| 232 | + } | |
| 233 | + | |
| 234 | + public int getVersion() { | |
| 235 | + return version; | |
| 236 | + } | |
| 237 | + | |
| 238 | + public void setVersion(int version) { | |
| 239 | + this.version = version; | |
| 240 | + } | |
| 221 | 241 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -34,7 +34,7 @@ import com.google.common.collect.TreeMultimap; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * |
| 37 | - * @ClassName: GpsRealEntityBuffer | |
| 37 | + * @ClassName: GpsRealData | |
| 38 | 38 | * @Description: TODO(实时GPS数据集合) |
| 39 | 39 | * @author PanZhao |
| 40 | 40 | * @date 2016年8月12日 下午2:04:41 |
| ... | ... | @@ -73,7 +73,7 @@ public class GpsRealData implements CommandLineRunner{ |
| 73 | 73 | @Override |
| 74 | 74 | public void run(String... arg0) throws Exception { |
| 75 | 75 | logger.info("gpsDataLoader,20,6"); |
| 76 | - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); | |
| 76 | + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public GpsEntity add(GpsEntity gps) { | ... | ... |
src/main/java/com/bsth/data/match/Arrival2Schedule.java
| 1 | 1 | package com.bsth.data.match; |
| 2 | 2 | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | 3 | import java.util.ArrayList; |
| 5 | 4 | import java.util.Collections; |
| 6 | -import java.util.HashMap; | |
| 7 | 5 | import java.util.List; |
| 8 | -import java.util.Map; | |
| 9 | 6 | import java.util.Set; |
| 10 | 7 | |
| 8 | +import org.joda.time.format.DateTimeFormat; | |
| 9 | +import org.joda.time.format.DateTimeFormatter; | |
| 11 | 10 | import org.slf4j.Logger; |
| 12 | 11 | import org.slf4j.LoggerFactory; |
| 13 | 12 | import org.springframework.beans.BeansException; |
| ... | ... | @@ -15,14 +14,17 @@ import org.springframework.context.ApplicationContext; |
| 15 | 14 | import org.springframework.context.ApplicationContextAware; |
| 16 | 15 | import org.springframework.stereotype.Component; |
| 17 | 16 | |
| 17 | +import com.bsth.data.LineConfigData; | |
| 18 | 18 | import com.bsth.data.arrival.ArrivalComparator; |
| 19 | 19 | import com.bsth.data.arrival.ArrivalData_GPS; |
| 20 | 20 | import com.bsth.data.arrival.ArrivalEntity; |
| 21 | 21 | import com.bsth.data.schedule.DayOfSchedule; |
| 22 | 22 | import com.bsth.data.schedule.ScheduleComparator; |
| 23 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 23 | 24 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 24 | 25 | import com.bsth.service.directive.DirectiveService; |
| 25 | 26 | import com.bsth.websocket.handler.SendUtils; |
| 27 | +import com.google.common.collect.ArrayListMultimap; | |
| 26 | 28 | |
| 27 | 29 | /** |
| 28 | 30 | * |
| ... | ... | @@ -38,13 +40,14 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 38 | 40 | private static DayOfSchedule dayOfSchedule; |
| 39 | 41 | private static SendUtils sendUtils; |
| 40 | 42 | private static DirectiveService directiveService; |
| 43 | + private static LineConfigData lineConfigData; | |
| 41 | 44 | private final static int ONE_MINUTE = 1000 * 60; |
| 42 | 45 | //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次 |
| 43 | 46 | private final static int FOUR_HOURS = 1000 * 60 * 60 * 4; |
| 44 | 47 | |
| 45 | 48 | private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class); |
| 46 | 49 | |
| 47 | - private static Map<String, ExpectArrivalEnd> expectMap = new HashMap<>(); | |
| 50 | + private static ArrayListMultimap<String, ExpectArrivalEnd> expectMap = ArrayListMultimap.create(); | |
| 48 | 51 | |
| 49 | 52 | /** |
| 50 | 53 | * |
| ... | ... | @@ -61,6 +64,8 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 61 | 64 | |
| 62 | 65 | public static class SchMatchThread extends Thread{ |
| 63 | 66 | String nbbm; |
| 67 | + LineConfig conf; | |
| 68 | + | |
| 64 | 69 | public SchMatchThread(String nbbm){ |
| 65 | 70 | this.nbbm = nbbm; |
| 66 | 71 | } |
| ... | ... | @@ -69,11 +74,11 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 69 | 74 | private ScheduleComparator.FCSJ schComparator = new ScheduleComparator.FCSJ(); |
| 70 | 75 | private ArrivalComparator arrComparator = new ArrivalComparator(); |
| 71 | 76 | private MatchResultComparator mrComparator = new MatchResultComparator(); |
| 72 | - private SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 73 | - | |
| 77 | + | |
| 78 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 79 | + | |
| 74 | 80 | @Override |
| 75 | 81 | public void run() { |
| 76 | - | |
| 77 | 82 | //班次列表 |
| 78 | 83 | List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm); |
| 79 | 84 | //进出起终点数据 |
| ... | ... | @@ -82,6 +87,7 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 82 | 87 | if(schList.size() == 0 || arrList.size() == 0) |
| 83 | 88 | return; |
| 84 | 89 | |
| 90 | + conf = lineConfigData.get(schList.get(0).getXlBm()); | |
| 85 | 91 | //排序 |
| 86 | 92 | Collections.sort(schList, schComparator); |
| 87 | 93 | Collections.sort(arrList, arrComparator); |
| ... | ... | @@ -113,8 +119,8 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 113 | 119 | if(sch.isDestroy()) |
| 114 | 120 | continue; |
| 115 | 121 | |
| 116 | - //没有里程的不匹配 | |
| 117 | - if(sch.getBcsj() == null && sch.getJhlc() == null) | |
| 122 | + //线路配置出站既出场,并且没有里程的不匹配 | |
| 123 | + if(conf.getOutConfig()==2 && sch.getBcsj() == null && sch.getJhlc() == null) | |
| 118 | 124 | continue; |
| 119 | 125 | |
| 120 | 126 | list.add(sch); |
| ... | ... | @@ -194,7 +200,15 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 194 | 200 | mr = new MatchResult(); |
| 195 | 201 | mr.sch = sch; |
| 196 | 202 | mr.ts = inArr.getTs(); |
| 197 | - mr.diff = inArr.getTs() - sch.getZdsjT(); | |
| 203 | + //班次没有里程和运送时间的 | |
| 204 | + if(sch.getZdsj() == null){ | |
| 205 | + if(i < schList.size()-1) | |
| 206 | + mr.diff = inArr.getTs() - schList.get(i + 1).getDfsjT(); | |
| 207 | + else | |
| 208 | + mr.diff = inArr.getTs() - sch.getDfsjT(); | |
| 209 | + } | |
| 210 | + else | |
| 211 | + mr.diff = inArr.getTs() - sch.getZdsjT(); | |
| 198 | 212 | mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs()); |
| 199 | 213 | if(Math.abs(mr.diff) < FOUR_HOURS && mr.success) |
| 200 | 214 | mrs.add(mr); |
| ... | ... | @@ -216,13 +230,8 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 216 | 230 | public void carOut(MatchResult mr){ |
| 217 | 231 | ScheduleRealInfo sch = mr.sch; |
| 218 | 232 | |
| 219 | - if(expectMap.containsKey(nbbm)){ | |
| 220 | - ExpectArrivalEnd ead = expectMap.get(nbbm); | |
| 221 | - if(mr.ts < ead.getEndTime()) | |
| 222 | - return; | |
| 223 | - else | |
| 224 | - expectMap.remove(nbbm); | |
| 225 | - } | |
| 233 | + if(!isExpectOut(mr)) | |
| 234 | + return; | |
| 226 | 235 | //设置发车时间 |
| 227 | 236 | sch.setFcsjActualAll(mr.ts); |
| 228 | 237 | //通知客户端 |
| ... | ... | @@ -231,8 +240,32 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 231 | 240 | dayOfSchedule.save(sch); |
| 232 | 241 | //车辆当前执行班次 |
| 233 | 242 | dayOfSchedule.addExecPlan(sch); |
| 243 | + | |
| 234 | 244 | //期望车辆到达的终点 |
| 235 | - expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts)); | |
| 245 | + if(sch.getZdsj() != null) | |
| 246 | + expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts)); | |
| 247 | + } | |
| 248 | + | |
| 249 | + /** | |
| 250 | + * | |
| 251 | + * @Title: isExpectOut | |
| 252 | + * @Description: TODO(是否是一个期望的出站匹配结果) | |
| 253 | + */ | |
| 254 | + private boolean isExpectOut(MatchResult mr){ | |
| 255 | + ScheduleRealInfo sch = mr.sch; | |
| 256 | + String nbbm = sch.getClZbh(); | |
| 257 | + if(expectMap.containsKey(nbbm)){ | |
| 258 | + List<ExpectArrivalEnd> eads = expectMap.get(nbbm); | |
| 259 | + for(ExpectArrivalEnd ead : eads){ | |
| 260 | + if(sch.getQdzCode().equals(ead.getEndStation()) | |
| 261 | + || mr.ts > ead.getEndTime()){ | |
| 262 | + expectMap.removeAll(nbbm); | |
| 263 | + return true; | |
| 264 | + } | |
| 265 | + } | |
| 266 | + return false; | |
| 267 | + } | |
| 268 | + return true; | |
| 236 | 269 | } |
| 237 | 270 | |
| 238 | 271 | /** |
| ... | ... | @@ -243,15 +276,8 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 243 | 276 | public void carInStop(MatchResult mr){ |
| 244 | 277 | ScheduleRealInfo sch = mr.sch; |
| 245 | 278 | String nbbm=sch.getClZbh(); |
| 246 | - if(expectMap.containsKey(nbbm)){ | |
| 247 | - ExpectArrivalEnd ead = expectMap.get(nbbm); | |
| 248 | - if(mr.ts < ead.getEndTime() | |
| 249 | - && !mr.sch.getZdzCode().equals(ead.getEndStation())){ | |
| 250 | - return; | |
| 251 | - } | |
| 252 | - else | |
| 253 | - expectMap.remove(nbbm); | |
| 254 | - } | |
| 279 | + if(!isExpectIn(mr)) | |
| 280 | + return; | |
| 255 | 281 | |
| 256 | 282 | //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。 |
| 257 | 283 | if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){ |
| ... | ... | @@ -289,6 +315,28 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 289 | 315 | |
| 290 | 316 | /** |
| 291 | 317 | * |
| 318 | + * @Title: isExpectOut | |
| 319 | + * @Description: TODO(是否是一个期望的进站匹配结果) | |
| 320 | + */ | |
| 321 | + private boolean isExpectIn(MatchResult mr){ | |
| 322 | + ScheduleRealInfo sch = mr.sch; | |
| 323 | + String nbbm = sch.getClZbh(); | |
| 324 | + if(expectMap.containsKey(nbbm)){ | |
| 325 | + List<ExpectArrivalEnd> eads = expectMap.get(nbbm); | |
| 326 | + for(ExpectArrivalEnd ead : eads){ | |
| 327 | + if(sch.getZdzCode().equals(ead.getEndStation()) | |
| 328 | + || mr.ts > ead.getEndTime()){ | |
| 329 | + expectMap.removeAll(nbbm); | |
| 330 | + return true; | |
| 331 | + } | |
| 332 | + } | |
| 333 | + return false; | |
| 334 | + } | |
| 335 | + return true; | |
| 336 | + } | |
| 337 | + | |
| 338 | + /** | |
| 339 | + * | |
| 292 | 340 | * @Title: correctFirstSignal |
| 293 | 341 | * @Description: TODO(检查并纠正首班出场到离站) |
| 294 | 342 | */ |
| ... | ... | @@ -342,8 +390,9 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 342 | 390 | //上行发车,和到达时间比较一下。起点一般不会立即发出 |
| 343 | 391 | if(mr.sch.getXlDir().equals("0") |
| 344 | 392 | && null != mr.sch.getQdzArrDateSJ()){ |
| 345 | - | |
| 346 | - long dt = sdfyyyyMMddHHmm.parse(mr.sch.getRealExecDate() + mr.sch.getQdzArrDateSJ()).getTime(); | |
| 393 | + | |
| 394 | + | |
| 395 | + long dt = fmtyyyyMMddHHmm.parseMillis(mr.sch.getRealExecDate() + mr.sch.getQdzArrDateSJ()); | |
| 347 | 396 | |
| 348 | 397 | //停站时间少于 计划的3分之1,标记为漂移信号 |
| 349 | 398 | if((mr.ts - dt < (mr.sch.getDfsjT() - dt) / 3)){ |
| ... | ... | @@ -367,6 +416,7 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 367 | 416 | sendUtils = arg0.getBean(SendUtils.class); |
| 368 | 417 | dayOfSchedule = arg0.getBean(DayOfSchedule.class); |
| 369 | 418 | directiveService = arg0.getBean(DirectiveService.class); |
| 419 | + lineConfigData = arg0.getBean(LineConfigData.class); | |
| 370 | 420 | } |
| 371 | 421 | |
| 372 | 422 | /** |
| ... | ... | @@ -376,6 +426,10 @@ public class Arrival2Schedule implements ApplicationContextAware { |
| 376 | 426 | * @param @param nbbm |
| 377 | 427 | */ |
| 378 | 428 | public void removeExpect(String nbbm){ |
| 379 | - expectMap.remove(nbbm); | |
| 429 | + expectMap.removeAll(nbbm); | |
| 430 | + } | |
| 431 | + | |
| 432 | + public static void addExpect(String nbbm, ExpectArrivalEnd eae){ | |
| 433 | + expectMap.put(nbbm, eae); | |
| 380 | 434 | } |
| 381 | 435 | } | ... | ... |
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java
| ... | ... | @@ -5,7 +5,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 5 | 5 | /** |
| 6 | 6 | * |
| 7 | 7 | * @ClassName: ExpectArrivalEnd |
| 8 | - * @Description: TODO(期望车辆在某个时间段到达某个终点........) | |
| 8 | + * @Description: TODO(期望车辆在某个时间段到达某个终点或 发出某个起点........) | |
| 9 | 9 | * @author PanZhao |
| 10 | 10 | * @date 2016年11月2日 下午8:04:43 |
| 11 | 11 | * |
| ... | ... | @@ -29,6 +29,7 @@ public class ExpectArrivalEnd { |
| 29 | 29 | } |
| 30 | 30 | return ead; |
| 31 | 31 | } |
| 32 | + | |
| 32 | 33 | |
| 33 | 34 | public String getNbbm() { |
| 34 | 35 | return nbbm; | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| 1 | 1 | package com.bsth.data.schedule; |
| 2 | 2 | |
| 3 | -import java.text.ParseException; | |
| 4 | 3 | import java.text.SimpleDateFormat; |
| 5 | 4 | import java.util.ArrayList; |
| 6 | 5 | import java.util.Collection; |
| 7 | 6 | import java.util.Collections; |
| 8 | -import java.util.Date; | |
| 9 | 7 | import java.util.HashMap; |
| 10 | 8 | import java.util.HashSet; |
| 11 | 9 | import java.util.Iterator; |
| ... | ... | @@ -15,6 +13,8 @@ import java.util.Map; |
| 15 | 13 | import java.util.Set; |
| 16 | 14 | import java.util.concurrent.TimeUnit; |
| 17 | 15 | |
| 16 | +import org.joda.time.format.DateTimeFormat; | |
| 17 | +import org.joda.time.format.DateTimeFormatter; | |
| 18 | 18 | import org.slf4j.Logger; |
| 19 | 19 | import org.slf4j.LoggerFactory; |
| 20 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -115,14 +115,17 @@ public class DayOfSchedule implements CommandLineRunner { |
| 115 | 115 | @Autowired |
| 116 | 116 | ScheduleLateThread scheduleLateThread; |
| 117 | 117 | |
| 118 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd") | |
| 119 | + ,fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 120 | + | |
| 118 | 121 | @Override |
| 119 | 122 | public void run(String... arg0) throws Exception { |
| 120 | 123 | //翻班线程 |
| 121 | - Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 20, 240, TimeUnit.SECONDS); | |
| 124 | + Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 122 | 125 | //入库 |
| 123 | - //Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | |
| 126 | + Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | |
| 124 | 127 | //首班出场指令补发器 |
| 125 | - //Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 10, 120, TimeUnit.SECONDS); | |
| 128 | + Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); | |
| 126 | 129 | //班次误点扫描 |
| 127 | 130 | //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); |
| 128 | 131 | } |
| ... | ... | @@ -140,8 +143,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 140 | 143 | LineConfig conf = lineConfigData.get(lineCode); |
| 141 | 144 | long ct = System.currentTimeMillis(); |
| 142 | 145 | |
| 143 | - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | |
| 144 | - String schDate = sdfyyyyMMdd.format(new Date(ct)); | |
| 146 | + String schDate = fmtyyyyMMdd.print(ct); | |
| 145 | 147 | // 小于当天起始运营时间,则取前一天的排班 |
| 146 | 148 | if (ct < conf.getCurrStartTime()) |
| 147 | 149 | schDate = DateUtils.subtractDay(schDate, 1); |
| ... | ... | @@ -295,10 +297,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 295 | 297 | |
| 296 | 298 | try { |
| 297 | 299 | Map<String, Object> data = new HashMap<>(); |
| 298 | - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") | |
| 299 | - ,sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 300 | - | |
| 301 | - data.put("scheduleDate_eq", sdfyyyyMMdd.parse(schDate)); | |
| 300 | + | |
| 301 | + data.put("scheduleDate_eq", fmtyyyyMMdd.parseDateTime(schDate).toDate()); | |
| 302 | 302 | data.put("xlBm_eq", lineCode); |
| 303 | 303 | |
| 304 | 304 | // 查询计划排班 |
| ... | ... | @@ -308,19 +308,14 @@ public class DayOfSchedule implements CommandLineRunner { |
| 308 | 308 | realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); |
| 309 | 309 | |
| 310 | 310 | for (ScheduleRealInfo sch : realList) { |
| 311 | - sch.setScheduleDateStr(sdfyyyyMMdd.format(sch.getScheduleDate())); | |
| 311 | + sch.setScheduleDateStr(fmtyyyyMMdd.print(sch.getScheduleDate().getTime())); | |
| 312 | 312 | sch.setRealExecDate(sch.getScheduleDateStr()); |
| 313 | 313 | // 计划终点时间 |
| 314 | 314 | if (sch.getBcsj() != null) { |
| 315 | - try{ | |
| 316 | - sch.setZdsjT(sdfHHmm.parse(sch.getFcsj()).getTime() + (sch.getBcsj() * 60 * 1000)); | |
| 317 | - sch.setZdsj(sdfHHmm.format(sch.getZdsjT())); | |
| 318 | - sch.setLate(false); | |
| 319 | - }catch(ParseException pe){ | |
| 320 | - logger.error("loadPlanSch... 计算终点时间失败..."); | |
| 321 | - } | |
| 315 | + sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000))); | |
| 316 | + sch.setLate(false); | |
| 322 | 317 | } |
| 323 | - //计划里程为0,直接清空 | |
| 318 | + //计划里程为0,设置NULL | |
| 324 | 319 | if(sch.getJhlc() != null && sch.getJhlc() == 0) |
| 325 | 320 | sch.setJhlc(null); |
| 326 | 321 | } |
| ... | ... | @@ -453,6 +448,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 453 | 448 | } |
| 454 | 449 | |
| 455 | 450 | public void put(ScheduleRealInfo sch) { |
| 451 | + | |
| 456 | 452 | schAttrCalculator |
| 457 | 453 | .calcRealDate(sch) |
| 458 | 454 | .calcAllTimeByFcsj(sch); |
| ... | ... | @@ -476,9 +472,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 476 | 472 | //return sch; |
| 477 | 473 | } |
| 478 | 474 | |
| 479 | - public void calcQdzTimePlan(String nbbm){ | |
| 480 | - schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); | |
| 481 | - } | |
| 475 | +// public void calcQdzTimePlan(String nbbm){ | |
| 476 | +// schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); | |
| 477 | +// } | |
| 482 | 478 | |
| 483 | 479 | public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm){ |
| 484 | 480 | return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm)); |
| ... | ... | @@ -489,7 +485,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 489 | 485 | * @Title: nextAll |
| 490 | 486 | * @Description: TODO(之后的所有班次) |
| 491 | 487 | */ |
| 492 | - public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { | |
| 488 | +/* public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { | |
| 493 | 489 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 494 | 490 | // 排序 |
| 495 | 491 | Collections.sort(list, schFCSJComparator); |
| ... | ... | @@ -503,7 +499,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 503 | 499 | |
| 504 | 500 | } |
| 505 | 501 | return rs; |
| 506 | - } | |
| 502 | + }*/ | |
| 507 | 503 | |
| 508 | 504 | /** |
| 509 | 505 | * |
| ... | ... | @@ -595,7 +591,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 595 | 591 | |
| 596 | 592 | public void save(ScheduleRealInfo sch){ |
| 597 | 593 | //schRepository.save(sch); |
| 598 | - //pstBuffer.add(sch); | |
| 594 | + pstBuffer.add(sch); | |
| 599 | 595 | } |
| 600 | 596 | |
| 601 | 597 | ... | ... |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| 1 | 1 | package com.bsth.data.schedule; |
| 2 | 2 | |
| 3 | 3 | import java.text.ParseException; |
| 4 | -import java.text.SimpleDateFormat; | |
| 5 | 4 | import java.util.ArrayList; |
| 6 | 5 | import java.util.Collections; |
| 7 | -import java.util.Date; | |
| 8 | 6 | import java.util.List; |
| 9 | 7 | |
| 8 | +import org.joda.time.format.DateTimeFormat; | |
| 9 | +import org.joda.time.format.DateTimeFormatter; | |
| 10 | 10 | import org.slf4j.Logger; |
| 11 | 11 | import org.slf4j.LoggerFactory; |
| 12 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -34,6 +34,10 @@ public class SchAttrCalculator { |
| 34 | 34 | |
| 35 | 35 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 36 | 36 | |
| 37 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd") | |
| 38 | + ,fmtHHmm = DateTimeFormat.forPattern("HH:mm") | |
| 39 | + ,fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 40 | + | |
| 37 | 41 | /** |
| 38 | 42 | * @Title: calcRealDate |
| 39 | 43 | * @Description: TODO(计算班次的真实执行日期) |
| ... | ... | @@ -45,22 +49,12 @@ public class SchAttrCalculator { |
| 45 | 49 | if (null == sch.getFcsjT()) |
| 46 | 50 | calcFcsjTime(sch); |
| 47 | 51 | |
| 48 | - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | |
| 49 | - /* | |
| 50 | - * 早于线路开始运营时间的,加一天 | |
| 51 | - * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25 | |
| 52 | - | |
| 53 | - | |
| 54 | - ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | |
| 55 | - long st = sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime(); | |
| 56 | - if (st > sch.getFcsjT()) | |
| 57 | - sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);*/ | |
| 58 | 52 | |
| 59 | 53 | if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ |
| 60 | 54 | sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); |
| 61 | 55 | } |
| 62 | 56 | |
| 63 | - sch.setRealExecDate(sdfyyyyMMdd.format(new Date(sch.getFcsjT()))); | |
| 57 | + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT())); | |
| 64 | 58 | } catch (Exception e) { |
| 65 | 59 | logger.error("", e); |
| 66 | 60 | } |
| ... | ... | @@ -77,12 +71,10 @@ public class SchAttrCalculator { |
| 77 | 71 | // 生成时间戳 |
| 78 | 72 | calcTimestamp(sch); |
| 79 | 73 | |
| 80 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 81 | 74 | // 计划终点时间 |
| 82 | 75 | if (sch.getBcsj() != null) { |
| 83 | - Date zdDate = new Date(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); | |
| 84 | - sch.setZdsjT(zdDate.getTime()); | |
| 85 | - sch.setZdsj(sdfHHmm.format(zdDate)); | |
| 76 | + sch.setZdsjT(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); | |
| 77 | + sch.setZdsj(fmtHHmm.print(sch.getZdsjT())); | |
| 86 | 78 | } |
| 87 | 79 | } catch (ParseException e) { |
| 88 | 80 | logger.error("", e); |
| ... | ... | @@ -178,8 +170,7 @@ public class SchAttrCalculator { |
| 178 | 170 | } |
| 179 | 171 | |
| 180 | 172 | public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { |
| 181 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 182 | - sch.setFcsjT(sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); | |
| 173 | + sch.setFcsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsj())); | |
| 183 | 174 | return this; |
| 184 | 175 | } |
| 185 | 176 | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| ... | ... | @@ -18,7 +18,7 @@ import com.bsth.entity.realcontrol.LineConfig; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * |
| 21 | - * @ClassName: refreshScheduleThread | |
| 21 | + * @ClassName: ScheduleRefreshThread | |
| 22 | 22 | * @Description: TODO(班次刷新线程,用于在营运开始时间切换到当日排班) |
| 23 | 23 | * @author PanZhao |
| 24 | 24 | * @date 2016年8月17日 下午1:23:34 |
| ... | ... | @@ -72,6 +72,7 @@ public class ScheduleRefreshThread extends Thread{ |
| 72 | 72 | logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | + | |
| 75 | 76 | } catch (Exception e) { |
| 76 | 77 | logger.error("", e); |
| 77 | 78 | } | ... | ... |
src/main/java/com/bsth/entity/Line.java
| ... | ... | @@ -116,6 +116,12 @@ public class Line implements Serializable { |
| 116 | 116 | /** 普通车辆数量 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ |
| 117 | 117 | private Integer ordCarNumber; |
| 118 | 118 | |
| 119 | + /** 权证车辆数量 报表需要的字段值 */ | |
| 120 | + private Integer warrantCar; | |
| 121 | + | |
| 122 | + /** 权证配车启用日期 报表需要的字段值 */ | |
| 123 | + private Integer warrantDate; | |
| 124 | + | |
| 119 | 125 | /** 停车场编码 老版本系统字段, 新版本系统业务需求暂时没用到该字段 ,这里暂时留着 int length(11) */ |
| 120 | 126 | private String carParkCode; |
| 121 | 127 | |
| ... | ... | @@ -139,6 +145,22 @@ public class Line implements Serializable { |
| 139 | 145 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 140 | 146 | private Date updateDate; |
| 141 | 147 | |
| 148 | + public Integer getWarrantCar() { | |
| 149 | + return warrantCar; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setWarrantCar(Integer warrantCar) { | |
| 153 | + this.warrantCar = warrantCar; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public Integer getWarrantDate() { | |
| 157 | + return warrantDate; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setWarrantDate(Integer warrantDate) { | |
| 161 | + this.warrantDate = warrantDate; | |
| 162 | + } | |
| 163 | + | |
| 142 | 164 | public Integer getLinePlayType() { |
| 143 | 165 | return linePlayType; |
| 144 | 166 | } | ... | ... |
src/main/java/com/bsth/entity/directive/D60.java
| ... | ... | @@ -17,251 +17,276 @@ import com.fasterxml.jackson.annotation.JsonIgnore; |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * | |
| 21 | - * @ClassName: D60 | |
| 22 | - * @Description: TODO(调度指令) | |
| 23 | 20 | * @author PanZhao |
| 24 | - * @date 2016年6月7日 上午10:21:59 | |
| 25 | - * | |
| 21 | + * @ClassName: D60 | |
| 22 | + * @Description: TODO(调度指令) | |
| 23 | + * @date 2016年6月7日 上午10:21:59 | |
| 26 | 24 | */ |
| 27 | 25 | @Entity |
| 28 | 26 | @Table(name = "bsth_v_directive_60") |
| 29 | 27 | @NamedEntityGraphs({ |
| 30 | - @NamedEntityGraph(name = "directive60_sch", attributeNodes = { | |
| 31 | - @NamedAttributeNode("sch") | |
| 32 | - }) | |
| 28 | + @NamedEntityGraph(name = "directive60_sch", attributeNodes = { | |
| 29 | + @NamedAttributeNode("sch") | |
| 30 | + }) | |
| 33 | 31 | }) |
| 34 | -public class D60 extends Directive{ | |
| 32 | +public class D60 extends Directive { | |
| 35 | 33 | |
| 36 | - @Id | |
| 34 | + @Id | |
| 37 | 35 | @GeneratedValue |
| 38 | - private Integer id; | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 数据 | |
| 42 | - */ | |
| 43 | - private D60Data data; | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 唯一标识 | |
| 47 | - */ | |
| 48 | - @Transient | |
| 49 | - private Integer msgId; | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 46上行 | |
| 53 | - */ | |
| 54 | - private Short reply46 = -1; | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 47上行 | |
| 58 | - */ | |
| 59 | - private Short reply47 = -1; | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * 是否是调度指令 | |
| 63 | - * 目前调度指令和消息短语都是短语下发,所以从协议上无法区分 | |
| 64 | - */ | |
| 65 | - private boolean isDispatch; | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 相关联的班次 | |
| 69 | - */ | |
| 70 | - @JsonIgnore | |
| 71 | - @ManyToOne(fetch = FetchType.LAZY) | |
| 72 | - private ScheduleRealInfo sch; | |
| 73 | - | |
| 74 | - @Embeddable | |
| 75 | - public static class D60Data { | |
| 76 | - // 公司代码 | |
| 77 | - private short companyCode; | |
| 78 | - | |
| 79 | - // 设备号 | |
| 80 | - @Transient | |
| 81 | - private String deviceId; | |
| 82 | - | |
| 83 | - // 时间戳 | |
| 84 | - @Transient | |
| 85 | - private Long timestamp; | |
| 86 | - | |
| 87 | - // 保留 默认0 | |
| 88 | - private short instructType = 0; | |
| 89 | - | |
| 90 | - /* | |
| 91 | - * 调度指令 调度指令。 | |
| 92 | - * 0X00表示信息短语 | |
| 93 | - * 0X01表示取消上次指令+调度指令(闹钟有效) | |
| 94 | - * 0x02表示为调度指令(闹钟有效) | |
| 95 | - * 0x03表示运营状态指令(闹钟无效) | |
| 96 | - * 0x04表示其他指令 | |
| 97 | - */ | |
| 98 | - private Short dispatchInstruct; | |
| 99 | - | |
| 100 | - // 唯一标识 | |
| 101 | - private int msgId; | |
| 102 | - | |
| 103 | - // 闹钟 | |
| 104 | - private Long alarmTime; | |
| 105 | - | |
| 106 | - // 多个运营状态字节 | |
| 107 | - private Long serviceState; | |
| 108 | - | |
| 109 | - // 消息文本 | |
| 110 | - private String txtContent; | |
| 111 | - | |
| 112 | - public short getCompanyCode() { | |
| 113 | - return companyCode; | |
| 114 | - } | |
| 115 | - | |
| 116 | - public void setCompanyCode(short companyCode) { | |
| 117 | - this.companyCode = companyCode; | |
| 118 | - } | |
| 119 | - | |
| 120 | - public String getDeviceId() { | |
| 121 | - return deviceId; | |
| 122 | - } | |
| 123 | - | |
| 124 | - public void setDeviceId(String deviceId) { | |
| 125 | - this.deviceId = deviceId; | |
| 126 | - } | |
| 127 | - | |
| 128 | - public Long getTimestamp() { | |
| 129 | - return timestamp; | |
| 130 | - } | |
| 131 | - | |
| 132 | - public void setTimestamp(Long timestamp) { | |
| 133 | - this.timestamp = timestamp; | |
| 134 | - } | |
| 135 | - | |
| 136 | - public short getInstructType() { | |
| 137 | - return instructType; | |
| 138 | - } | |
| 139 | - | |
| 140 | - public void setInstructType(short instructType) { | |
| 141 | - this.instructType = instructType; | |
| 142 | - } | |
| 143 | - | |
| 144 | - public Short getDispatchInstruct() { | |
| 145 | - return dispatchInstruct; | |
| 146 | - } | |
| 147 | - | |
| 148 | - public void setDispatchInstruct(Short dispatchInstruct) { | |
| 149 | - this.dispatchInstruct = dispatchInstruct; | |
| 150 | - } | |
| 151 | - | |
| 152 | - public int getMsgId() { | |
| 153 | - return msgId; | |
| 154 | - } | |
| 155 | - | |
| 156 | - public void setMsgId(int msgId) { | |
| 157 | - this.msgId = msgId; | |
| 158 | - } | |
| 159 | - | |
| 160 | - public Long getAlarmTime() { | |
| 161 | - return alarmTime; | |
| 162 | - } | |
| 163 | - | |
| 164 | - public void setAlarmTime(Long alarmTime) { | |
| 165 | - this.alarmTime = alarmTime; | |
| 166 | - } | |
| 167 | - | |
| 168 | - public Long getServiceState() { | |
| 169 | - return serviceState; | |
| 170 | - } | |
| 171 | - | |
| 172 | - public void setServiceState(Long serviceState) { | |
| 173 | - this.serviceState = serviceState; | |
| 174 | - } | |
| 175 | - | |
| 176 | - public String getTxtContent() { | |
| 177 | - return txtContent; | |
| 178 | - } | |
| 179 | - | |
| 180 | - public void setTxtContent(String txtContent) { | |
| 181 | - this.txtContent = txtContent; | |
| 182 | - } | |
| 183 | - } | |
| 184 | - | |
| 185 | - public Integer getId() { | |
| 186 | - return id; | |
| 187 | - } | |
| 188 | - | |
| 189 | - public void setId(Integer id) { | |
| 190 | - this.id = id; | |
| 191 | - } | |
| 192 | - | |
| 193 | - public short getOperCode() { | |
| 194 | - return operCode; | |
| 195 | - } | |
| 196 | - | |
| 197 | - public void setOperCode(short operCode) { | |
| 198 | - this.operCode = operCode; | |
| 199 | - } | |
| 200 | - | |
| 201 | - public D60Data getData() { | |
| 202 | - return data; | |
| 203 | - } | |
| 204 | - | |
| 205 | - public void setData(D60Data data) { | |
| 206 | - this.data = data; | |
| 207 | - } | |
| 208 | - | |
| 209 | - public Integer getMsgId() { | |
| 210 | - if(this.msgId != null) | |
| 211 | - return this.msgId; | |
| 212 | - else | |
| 213 | - return this.getData().getMsgId(); | |
| 214 | - } | |
| 215 | - | |
| 216 | - public void setMsgId(Integer msgId) { | |
| 217 | - this.msgId = msgId; | |
| 218 | - } | |
| 219 | - | |
| 220 | - @Override | |
| 221 | - public void setTimestamp(Long timestamp) { | |
| 222 | - if(this.data != null) | |
| 223 | - this.data.setTimestamp(timestamp); | |
| 224 | - | |
| 225 | - this.timestamp = timestamp; | |
| 226 | - } | |
| 227 | - | |
| 228 | - @Override | |
| 229 | - public void setDeviceId(String deviceId) { | |
| 230 | - if(this.data != null) | |
| 231 | - this.data.setDeviceId(deviceId); | |
| 232 | - | |
| 233 | - this.deviceId = deviceId; | |
| 234 | - } | |
| 235 | - | |
| 236 | - public Short getReply46() { | |
| 237 | - return reply46; | |
| 238 | - } | |
| 239 | - | |
| 240 | - public void setReply46(Short reply46) { | |
| 241 | - this.reply46 = reply46; | |
| 242 | - } | |
| 243 | - | |
| 244 | - public Short getReply47() { | |
| 245 | - return reply47; | |
| 246 | - } | |
| 247 | - | |
| 248 | - public void setReply47(Short reply47) { | |
| 249 | - this.reply47 = reply47; | |
| 250 | - } | |
| 251 | - | |
| 252 | - public boolean isDispatch() { | |
| 253 | - return isDispatch; | |
| 254 | - } | |
| 255 | - | |
| 256 | - public void setDispatch(boolean isDispatch) { | |
| 257 | - this.isDispatch = isDispatch; | |
| 258 | - } | |
| 259 | - | |
| 260 | - public ScheduleRealInfo getSch() { | |
| 261 | - return sch; | |
| 262 | - } | |
| 263 | - | |
| 264 | - public void setSch(ScheduleRealInfo sch) { | |
| 265 | - this.sch = sch; | |
| 266 | - } | |
| 36 | + private Integer id; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 数据 | |
| 40 | + */ | |
| 41 | + private D60Data data; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 唯一标识 | |
| 45 | + */ | |
| 46 | + @Transient | |
| 47 | + private Integer msgId; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 46上行 | |
| 51 | + */ | |
| 52 | + private Short reply46 = -1; | |
| 53 | + /** | |
| 54 | + * 46收到时间 | |
| 55 | + */ | |
| 56 | + private Long reply46Time; | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 47上行 | |
| 60 | + */ | |
| 61 | + private Short reply47 = -1; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 47收到时间 | |
| 65 | + */ | |
| 66 | + private Long reply47Time; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 是否是调度指令 | |
| 70 | + * 目前调度指令和消息短语都是短语下发,所以从协议上无法区分 | |
| 71 | + */ | |
| 72 | + private boolean isDispatch; | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 相关联的班次 | |
| 76 | + */ | |
| 77 | + @JsonIgnore | |
| 78 | + @ManyToOne(fetch = FetchType.LAZY) | |
| 79 | + private ScheduleRealInfo sch; | |
| 80 | + | |
| 81 | + public Long getReply46Time() { | |
| 82 | + return reply46Time; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setReply46Time(Long reply46Time) { | |
| 86 | + this.reply46Time = reply46Time; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public Long getReply47Time() { | |
| 90 | + return reply47Time; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setReply47Time(Long reply47Time) { | |
| 94 | + this.reply47Time = reply47Time; | |
| 95 | + } | |
| 96 | + | |
| 97 | + @Embeddable | |
| 98 | + public static class D60Data { | |
| 99 | + // 公司代码 | |
| 100 | + private short companyCode; | |
| 101 | + | |
| 102 | + // 设备号 | |
| 103 | + @Transient | |
| 104 | + private String deviceId; | |
| 105 | + | |
| 106 | + // 时间戳 | |
| 107 | + @Transient | |
| 108 | + private Long timestamp; | |
| 109 | + | |
| 110 | + // 保留 默认0 | |
| 111 | + private short instructType = 0; | |
| 112 | + | |
| 113 | + /* | |
| 114 | + * 调度指令 调度指令。 | |
| 115 | + * 0X00表示信息短语 | |
| 116 | + * 0X01表示取消上次指令+调度指令(闹钟有效) | |
| 117 | + * 0x02表示为调度指令(闹钟有效) | |
| 118 | + * 0x03表示运营状态指令(闹钟无效) | |
| 119 | + * 0x04表示其他指令 | |
| 120 | + */ | |
| 121 | + private Short dispatchInstruct; | |
| 122 | + | |
| 123 | + // 唯一标识 | |
| 124 | + private int msgId; | |
| 125 | + | |
| 126 | + // 闹钟 | |
| 127 | + private Long alarmTime; | |
| 128 | + | |
| 129 | + // 多个运营状态字节 | |
| 130 | + private Long serviceState; | |
| 131 | + | |
| 132 | + // 消息文本 | |
| 133 | + private String txtContent; | |
| 134 | + | |
| 135 | + public short getCompanyCode() { | |
| 136 | + return companyCode; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public void setCompanyCode(short companyCode) { | |
| 140 | + this.companyCode = companyCode; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public String getDeviceId() { | |
| 144 | + return deviceId; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public void setDeviceId(String deviceId) { | |
| 148 | + this.deviceId = deviceId; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public Long getTimestamp() { | |
| 152 | + return timestamp; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public void setTimestamp(Long timestamp) { | |
| 156 | + this.timestamp = timestamp; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public short getInstructType() { | |
| 160 | + return instructType; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public void setInstructType(short instructType) { | |
| 164 | + this.instructType = instructType; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public Short getDispatchInstruct() { | |
| 168 | + return dispatchInstruct; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public void setDispatchInstruct(Short dispatchInstruct) { | |
| 172 | + this.dispatchInstruct = dispatchInstruct; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public int getMsgId() { | |
| 176 | + return msgId; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public void setMsgId(int msgId) { | |
| 180 | + this.msgId = msgId; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public Long getAlarmTime() { | |
| 184 | + return alarmTime; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setAlarmTime(Long alarmTime) { | |
| 188 | + this.alarmTime = alarmTime; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public Long getServiceState() { | |
| 192 | + return serviceState; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setServiceState(Long serviceState) { | |
| 196 | + this.serviceState = serviceState; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public String getTxtContent() { | |
| 200 | + return txtContent; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public void setTxtContent(String txtContent) { | |
| 204 | + this.txtContent = txtContent; | |
| 205 | + } | |
| 206 | + } | |
| 207 | + | |
| 208 | + public Integer getId() { | |
| 209 | + return id; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public void setId(Integer id) { | |
| 213 | + this.id = id; | |
| 214 | + } | |
| 215 | + | |
| 216 | + public short getOperCode() { | |
| 217 | + return operCode; | |
| 218 | + } | |
| 219 | + | |
| 220 | + public void setOperCode(short operCode) { | |
| 221 | + this.operCode = operCode; | |
| 222 | + } | |
| 223 | + | |
| 224 | + public D60Data getData() { | |
| 225 | + return data; | |
| 226 | + } | |
| 227 | + | |
| 228 | + public void setData(D60Data data) { | |
| 229 | + this.data = data; | |
| 230 | + } | |
| 231 | + | |
| 232 | + public Integer getMsgId() { | |
| 233 | + if (this.msgId != null) | |
| 234 | + return this.msgId; | |
| 235 | + else | |
| 236 | + return this.getData().getMsgId(); | |
| 237 | + } | |
| 238 | + | |
| 239 | + public void setMsgId(Integer msgId) { | |
| 240 | + this.msgId = msgId; | |
| 241 | + } | |
| 242 | + | |
| 243 | + @Override | |
| 244 | + public void setTimestamp(Long timestamp) { | |
| 245 | + if (this.data != null) | |
| 246 | + this.data.setTimestamp(timestamp); | |
| 247 | + | |
| 248 | + this.timestamp = timestamp; | |
| 249 | + } | |
| 250 | + | |
| 251 | + @Override | |
| 252 | + public void setDeviceId(String deviceId) { | |
| 253 | + if (this.data != null) | |
| 254 | + this.data.setDeviceId(deviceId); | |
| 255 | + | |
| 256 | + this.deviceId = deviceId; | |
| 257 | + } | |
| 258 | + | |
| 259 | + public Short getReply46() { | |
| 260 | + return reply46; | |
| 261 | + } | |
| 262 | + | |
| 263 | + public void setReply46(Short reply46) { | |
| 264 | + this.reply46 = reply46; | |
| 265 | + } | |
| 266 | + | |
| 267 | + public Short getReply47() { | |
| 268 | + return reply47; | |
| 269 | + } | |
| 270 | + | |
| 271 | + public void setReply47(Short reply47) { | |
| 272 | + this.reply47 = reply47; | |
| 273 | + } | |
| 274 | + | |
| 275 | + public boolean isDispatch() { | |
| 276 | + return isDispatch; | |
| 277 | + } | |
| 278 | + | |
| 279 | + public void setDispatch(boolean isDispatch) { | |
| 280 | + this.isDispatch = isDispatch; | |
| 281 | + } | |
| 282 | + | |
| 283 | + public ScheduleRealInfo getSch() { | |
| 284 | + return sch; | |
| 285 | + } | |
| 286 | + | |
| 287 | + public void setSch(ScheduleRealInfo sch) { | |
| 288 | + this.sch = sch; | |
| 289 | + } | |
| 290 | + | |
| 291 | + | |
| 267 | 292 | } | ... | ... |
src/main/java/com/bsth/entity/directive/DC0_A3.java
| 1 | 1 | package com.bsth.entity.directive; |
| 2 | 2 | |
| 3 | -import javax.persistence.Embeddable; | |
| 4 | -import javax.persistence.Entity; | |
| 5 | -import javax.persistence.GeneratedValue; | |
| 6 | -import javax.persistence.Id; | |
| 7 | -import javax.persistence.Table; | |
| 8 | -import javax.persistence.Transient; | |
| 3 | +import javax.persistence.*; | |
| 9 | 4 | |
| 10 | 5 | /** |
| 11 | 6 | * |
| ... | ... | @@ -41,6 +36,7 @@ public class DC0_A3 extends Directive{ |
| 41 | 36 | /** 定时定距上报模式 */ |
| 42 | 37 | private short reportMode; |
| 43 | 38 | /** 定时上报时间间隔 */ |
| 39 | + @Column(name = "_interval") | |
| 44 | 40 | private int interval; |
| 45 | 41 | /** 定距上报距离间隔 */ |
| 46 | 42 | private String distance; | ... | ... |
src/main/java/com/bsth/entity/directive/DC0_A4.java
| 1 | 1 | package com.bsth.entity.directive; |
| 2 | 2 | |
| 3 | -import javax.persistence.Embeddable; | |
| 4 | -import javax.persistence.Entity; | |
| 5 | -import javax.persistence.GeneratedValue; | |
| 6 | -import javax.persistence.Id; | |
| 7 | -import javax.persistence.Table; | |
| 8 | -import javax.persistence.Transient; | |
| 3 | +import javax.persistence.*; | |
| 9 | 4 | |
| 10 | 5 | /** |
| 11 | 6 | * |
| ... | ... | @@ -41,6 +36,7 @@ public class DC0_A4 extends Directive{ |
| 41 | 36 | /** 定时定距上报模式 */ |
| 42 | 37 | private short reportMode; |
| 43 | 38 | /** 定时上报时间间隔 */ |
| 39 | + @Column(name = "_interval") | |
| 44 | 40 | private int interval; |
| 45 | 41 | /** 定距上报距离间隔 */ |
| 46 | 42 | private String distance; | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -6,9 +6,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore; |
| 6 | 6 | import javax.persistence.*; |
| 7 | 7 | |
| 8 | 8 | import org.apache.commons.lang3.StringUtils; |
| 9 | +import org.joda.time.format.DateTimeFormat; | |
| 10 | +import org.joda.time.format.DateTimeFormatter; | |
| 9 | 11 | |
| 10 | -import java.text.ParseException; | |
| 11 | -import java.text.SimpleDateFormat; | |
| 12 | 12 | import java.util.Date; |
| 13 | 13 | import java.util.HashSet; |
| 14 | 14 | import java.util.Set; |
| ... | ... | @@ -507,31 +507,28 @@ public class ScheduleRealInfo { |
| 507 | 507 | public void setDfsjT(Long dfsjT) { |
| 508 | 508 | this.dfsjT = dfsjT; |
| 509 | 509 | } |
| 510 | - | |
| 510 | + | |
| 511 | + | |
| 512 | + @Transient | |
| 513 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 514 | + @Transient | |
| 515 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 516 | + | |
| 511 | 517 | public void setDfsjAll(Long dfsjT) { |
| 512 | 518 | this.dfsjT = dfsjT; |
| 513 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 514 | - this.dfsj = sdfHHmm.format(new Date(this.dfsjT)); | |
| 519 | + this.dfsj = fmtHHmm.print(this.dfsjT); | |
| 515 | 520 | } |
| 516 | 521 | |
| 517 | 522 | public void setDfsjAll(String dfsj) { |
| 518 | - | |
| 519 | - try { | |
| 520 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 521 | - this.dfsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + dfsj).getTime(); | |
| 522 | - this.dfsj = dfsj; | |
| 523 | - } catch (ParseException e) { | |
| 524 | - e.printStackTrace(); | |
| 525 | - } | |
| 523 | + this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj); | |
| 524 | + this.dfsj = dfsj; | |
| 526 | 525 | } |
| 527 | 526 | |
| 528 | 527 | public void calcEndTime(){ |
| 529 | 528 | //计划终点时间 |
| 530 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 531 | 529 | if(this.getBcsj() != null){ |
| 532 | - Date zdDate = new Date(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); | |
| 533 | - this.setZdsjT(zdDate.getTime()); | |
| 534 | - this.setZdsj(sdfHHmm.format(zdDate)); | |
| 530 | + this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); | |
| 531 | + this.setZdsj(fmtHHmm.print(this.zdsjT)); | |
| 535 | 532 | } |
| 536 | 533 | } |
| 537 | 534 | |
| ... | ... | @@ -583,13 +580,8 @@ public class ScheduleRealInfo { |
| 583 | 580 | * @throws |
| 584 | 581 | */ |
| 585 | 582 | public void setFcsjAll(String fcsj){ |
| 586 | - try { | |
| 587 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 588 | - this.fcsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsj).getTime(); | |
| 589 | - this.fcsj = fcsj; | |
| 590 | - } catch (ParseException e) { | |
| 591 | - e.printStackTrace(); | |
| 592 | - } | |
| 583 | + this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj); | |
| 584 | + this.fcsj = fcsj; | |
| 593 | 585 | } |
| 594 | 586 | |
| 595 | 587 | /** |
| ... | ... | @@ -600,8 +592,7 @@ public class ScheduleRealInfo { |
| 600 | 592 | */ |
| 601 | 593 | public void setFcsjAll(Long fcsjT){ |
| 602 | 594 | this.fcsjT = fcsjT; |
| 603 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 604 | - this.fcsj = sdfHHmm.format(new Date(fcsjT)); | |
| 595 | + this.fcsj = fmtHHmm.print(fcsjT); | |
| 605 | 596 | } |
| 606 | 597 | |
| 607 | 598 | /** |
| ... | ... | @@ -611,15 +602,9 @@ public class ScheduleRealInfo { |
| 611 | 602 | * @throws |
| 612 | 603 | */ |
| 613 | 604 | public void setFcsjActualAll(String fcsjActual){ |
| 614 | - try { | |
| 615 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 616 | - this.fcsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsjActual).getTime(); | |
| 617 | - this.fcsjActual = fcsjActual; | |
| 618 | - | |
| 619 | - calcStatus(); | |
| 620 | - } catch (ParseException e) { | |
| 621 | - e.printStackTrace(); | |
| 622 | - } | |
| 605 | + this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual); | |
| 606 | + this.fcsjActual = fcsjActual; | |
| 607 | + calcStatus(); | |
| 623 | 608 | } |
| 624 | 609 | |
| 625 | 610 | /** |
| ... | ... | @@ -630,9 +615,8 @@ public class ScheduleRealInfo { |
| 630 | 615 | */ |
| 631 | 616 | public void setFcsjActualAll(Long t){ |
| 632 | 617 | this.fcsjActualTime = t; |
| 633 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 634 | - this.fcsjActual = sdfHHmm.format(new Date(t)); | |
| 635 | - | |
| 618 | + this.fcsjActual = fmtHHmm.print(t); | |
| 619 | + | |
| 636 | 620 | //更新班次状态 |
| 637 | 621 | calcStatus(); |
| 638 | 622 | } |
| ... | ... | @@ -645,12 +629,10 @@ public class ScheduleRealInfo { |
| 645 | 629 | */ |
| 646 | 630 | public void setZdsjActualAll(Long t){ |
| 647 | 631 | this.zdsjActualTime = t; |
| 648 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 649 | - this.zdsjActual = sdfHHmm.format(new Date(t)); | |
| 632 | + this.zdsjActual = fmtHHmm.print(t); | |
| 650 | 633 | |
| 651 | 634 | //更新班次状态 |
| 652 | 635 | calcStatus(); |
| 653 | - //this.synchroZdsj(); | |
| 654 | 636 | } |
| 655 | 637 | |
| 656 | 638 | /** |
| ... | ... | @@ -660,15 +642,10 @@ public class ScheduleRealInfo { |
| 660 | 642 | * @throws |
| 661 | 643 | */ |
| 662 | 644 | public void setZdsjActualAll(String zdsjActual){ |
| 663 | - try { | |
| 664 | - SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 665 | - this.zdsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + zdsjActual).getTime(); | |
| 666 | - this.zdsjActual = zdsjActual; | |
| 667 | - | |
| 668 | - calcStatus(); | |
| 669 | - } catch (ParseException e) { | |
| 670 | - e.printStackTrace(); | |
| 671 | - } | |
| 645 | + this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual); | |
| 646 | + this.zdsjActual = zdsjActual; | |
| 647 | + | |
| 648 | + calcStatus(); | |
| 672 | 649 | } |
| 673 | 650 | |
| 674 | 651 | public Long getSpId() { |
| ... | ... | @@ -713,17 +690,17 @@ public class ScheduleRealInfo { |
| 713 | 690 | return this.status == -1; |
| 714 | 691 | } |
| 715 | 692 | |
| 716 | - public boolean isNotDestroy(){ | |
| 693 | +/* public boolean isNotDestroy(){ | |
| 717 | 694 | return this.status != -1; |
| 718 | - } | |
| 695 | + }*/ | |
| 719 | 696 | |
| 720 | 697 | public Set<ChildTaskPlan> getcTasks() { |
| 721 | 698 | return cTasks; |
| 722 | 699 | } |
| 723 | 700 | |
| 724 | - public void setcTasks(Set<ChildTaskPlan> cTasks) { | |
| 701 | +/* public void setcTasks(Set<ChildTaskPlan> cTasks) { | |
| 725 | 702 | this.cTasks = cTasks; |
| 726 | - } | |
| 703 | + }*/ | |
| 727 | 704 | |
| 728 | 705 | public String getScheduleDateStr() { |
| 729 | 706 | return scheduleDateStr; | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| 1 | 1 | package com.bsth.service.directive; |
| 2 | 2 | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | 3 | import java.util.ArrayList; |
| 5 | 4 | import java.util.Collection; |
| 6 | 5 | import java.util.Collections; |
| ... | ... | @@ -11,6 +10,8 @@ import java.util.List; |
| 11 | 10 | import java.util.Map; |
| 12 | 11 | |
| 13 | 12 | import org.apache.commons.lang3.StringUtils; |
| 13 | +import org.joda.time.format.DateTimeFormat; | |
| 14 | +import org.joda.time.format.DateTimeFormatter; | |
| 14 | 15 | import org.slf4j.Logger; |
| 15 | 16 | import org.slf4j.LoggerFactory; |
| 16 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -73,7 +74,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 73 | 74 | @Autowired |
| 74 | 75 | DayOfSchedule dayOfSchedule; |
| 75 | 76 | |
| 76 | - static Long schDiff = 1000 * 60 * 60L; | |
| 77 | + //static Long schDiff = 1000 * 60 * 60L; | |
| 78 | + | |
| 79 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm") | |
| 80 | + ,fmtHHmm_CN = DateTimeFormat.forPattern("HH点mm分"); | |
| 77 | 81 | |
| 78 | 82 | @Override |
| 79 | 83 | public int send60Phrase(String nbbm, String text, String sender) { |
| ... | ... | @@ -111,10 +115,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 111 | 115 | logger.warn("烂班不允许发送调度指令...."); |
| 112 | 116 | return -1; |
| 113 | 117 | } |
| 114 | - //多线程下发指令时,SimpleDateFormat必须方法内初始化 | |
| 115 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH点mm分"); | |
| 116 | - | |
| 117 | - String text = "已完成" + finish + "个班次,下一发车时间" + sdfHHmm.format(new Date(sch.getDfsjT())) + ",由" | |
| 118 | + String text = "已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由" | |
| 118 | 119 | + sch.getQdzName() + "发往" + sch.getZdzName(); |
| 119 | 120 | |
| 120 | 121 | //下发0x02指令 调度指令(闹钟有效) |
| ... | ... | @@ -168,7 +169,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 168 | 169 | @Override |
| 169 | 170 | public void sendD60ToPage(ScheduleRealInfo sch) { |
| 170 | 171 | Map<String, Object> map = new HashMap<>(); |
| 171 | - map.put("fn", sch); | |
| 172 | + map.put("fn", "directive"); | |
| 172 | 173 | map.put("t", sch); |
| 173 | 174 | |
| 174 | 175 | ObjectMapper mapper = new ObjectMapper(); |
| ... | ... | @@ -402,11 +403,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 402 | 403 | |
| 403 | 404 | List<Directive> rs = list.subList(s, e); |
| 404 | 405 | |
| 405 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 406 | 406 | // 时间格式化,车辆自编号转换 |
| 407 | 407 | for (Directive d : rs) { |
| 408 | 408 | if (d.getTimeHHmm() == null) |
| 409 | - d.setTimeHHmm(sdfHHmm.format(new Date(d.getTimestamp()))); | |
| 409 | + d.setTimeHHmm(fmtHHmm.print(d.getTimestamp())); | |
| 410 | 410 | if (d.getNbbm() == null) |
| 411 | 411 | d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId())); |
| 412 | 412 | } |
| ... | ... | @@ -455,10 +455,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 455 | 455 | if (e > count) |
| 456 | 456 | e = count; |
| 457 | 457 | |
| 458 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 458 | + //SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 459 | 459 | List<D80> rs = d80s.subList(s, e); |
| 460 | 460 | for(D80 d80 : rs){ |
| 461 | - d80.setTimeStr(sdfHHmm.format(new Date(d80.getTimestamp()))); | |
| 461 | + d80.setTimeStr(fmtHHmm.print(d80.getTimestamp())); | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | Map<String, Object> rsMap = new HashMap<>(); | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java
| ... | ... | @@ -33,7 +33,7 @@ public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInf |
| 33 | 33 | @Transactional |
| 34 | 34 | public int updateGroupInfo(GroupInfoUpdate groupInfoUpdate) { |
| 35 | 35 | int type = groupInfoUpdate.getType(); |
| 36 | - int result; | |
| 36 | + int result = 0; | |
| 37 | 37 | if (type == 1) { |
| 38 | 38 | // 换车 |
| 39 | 39 | if (groupInfoUpdate.getUpdate().getClId() != groupInfoUpdate.getSrc().getClId()) { |
| ... | ... | @@ -128,6 +128,6 @@ public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInf |
| 128 | 128 | throw new RuntimeException("未知的更新类型,type=" + type); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return 0; | |
| 131 | + return result; | |
| 132 | 132 | } |
| 133 | 133 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
| ... | ... | @@ -127,8 +127,8 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 127 | 127 | DateTime today = new DateTime(new Date()); |
| 128 | 128 | DateTime tommorw = new DateTime(today.getYear(), today.getMonthOfYear(), today.getDayOfMonth(), 0, 0).plusDays(1); |
| 129 | 129 | Map<String, Object> param = new HashMap<>(); |
| 130 | - param.put("scheduleFromTime_le", tommorw); | |
| 131 | - param.put("scheduleToTime_ge", tommorw); | |
| 130 | + param.put("scheduleFromTime_le", tommorw.toDate()); | |
| 131 | + param.put("scheduleToTime_ge", tommorw.toDate() ); | |
| 132 | 132 | Iterator<SchedulePlan> schedulePlanIterator = this.list(param).iterator(); |
| 133 | 133 | if (schedulePlanIterator.hasNext()) { |
| 134 | 134 | return schedulePlanIterator.next(); | ... | ... |
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.websocket.handler; |
| 3 | 3 | import java.io.IOException; |
| 4 | 4 | import java.util.ArrayList; |
| 5 | 5 | import java.util.HashMap; |
| 6 | +import java.util.Iterator; | |
| 6 | 7 | import java.util.List; |
| 7 | 8 | import java.util.Map; |
| 8 | 9 | import java.util.Set; |
| ... | ... | @@ -83,7 +84,7 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 83 | 84 | default: |
| 84 | 85 | break; |
| 85 | 86 | } |
| 86 | - System.out.println(msg); | |
| 87 | + logger.info(msg.getPayload().toString()); | |
| 87 | 88 | } |
| 88 | 89 | |
| 89 | 90 | @Override |
| ... | ... | @@ -104,7 +105,7 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 104 | 105 | * 给所有在线用户发送消息 |
| 105 | 106 | * |
| 106 | 107 | * @param message |
| 107 | - */ | |
| 108 | + | |
| 108 | 109 | public synchronized void sendMessageToUsers(TextMessage message) { |
| 109 | 110 | for (WebSocketSession user : users) { |
| 110 | 111 | try { |
| ... | ... | @@ -115,14 +116,14 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 115 | 116 | e.printStackTrace(); |
| 116 | 117 | } |
| 117 | 118 | } |
| 118 | - } | |
| 119 | + }*/ | |
| 119 | 120 | |
| 120 | 121 | /** |
| 121 | 122 | * 给某些用户发送消息 |
| 122 | 123 | * |
| 123 | 124 | * @param userId |
| 124 | 125 | * @param message |
| 125 | - */ | |
| 126 | + | |
| 126 | 127 | public synchronized void sendMessageToUser(Set<String> uids, String msg) { |
| 127 | 128 | TextMessage message = new TextMessage(msg.getBytes()); |
| 128 | 129 | for (WebSocketSession user : users) { |
| ... | ... | @@ -136,31 +137,29 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 136 | 137 | } |
| 137 | 138 | } |
| 138 | 139 | } |
| 139 | - } | |
| 140 | + }*/ | |
| 140 | 141 | |
| 141 | 142 | /** |
| 142 | 143 | * 根据线路推送消息 |
| 143 | - * | |
| 144 | - * @param userId | |
| 145 | - * @param message | |
| 146 | 144 | */ |
| 147 | 145 | public synchronized void sendMessageToLine(String lineCode, String msg) { |
| 148 | - //Set<String> uids = BasicData.lineCode2SocketUserMap.get(lineCode); | |
| 149 | - //if(null == uids || uids.size() == 0) | |
| 150 | - // return; | |
| 151 | 146 | |
| 152 | 147 | TextMessage message = new TextMessage(msg.getBytes()); |
| 153 | 148 | |
| 154 | - List<WebSocketSession> sessList = listenMap.get(lineCode); | |
| 149 | + Iterator<WebSocketSession> iterator = listenMap.get(lineCode).iterator(); | |
| 155 | 150 | |
| 156 | - for (WebSocketSession user : sessList) { | |
| 151 | + WebSocketSession user; | |
| 152 | + while(iterator.hasNext()){ | |
| 153 | + user = iterator.next(); | |
| 157 | 154 | try { |
| 158 | 155 | if (user.isOpen()) { |
| 159 | 156 | user.sendMessage(message); |
| 160 | 157 | } |
| 161 | - } catch (IOException e) { | |
| 158 | + } catch (Exception e) { | |
| 159 | + logger.error("sendMessageToLine error ...."+msg); | |
| 162 | 160 | logger.error("sendMessageToLine error ....", e); |
| 163 | 161 | } |
| 162 | + | |
| 164 | 163 | } |
| 165 | 164 | } |
| 166 | 165 | } | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -6,9 +6,9 @@ spring.jpa.hibernate.ddl-auto= update |
| 6 | 6 | spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 7 | 7 | #DATABASE |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | -spring.jpa.show-sql= true | |
| 9 | +spring.jpa.show-sql= false | |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.168.201:3306/mh_control | |
| 11 | +spring.datasource.url= jdbc:mysql://192.168.168.201:3306/qp_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | 13 | spring.datasource.password= 123456 |
| 14 | 14 | #DATASOURCE | ... | ... |
src/main/resources/application-prod.properties
| ... | ... | @@ -8,7 +8,7 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= true |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.40.100:3306/qp_control | |
| 11 | +spring.datasource.url= jdbc:mysql://192.168.40.100:3306/qp_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | 13 | spring.datasource.password= root@JSP2jsp |
| 14 | 14 | #DATASOURCE | ... | ... |
src/main/resources/ms-jdbc.properties
| 1 | 1 | #ms.mysql.driver= com.mysql.jdbc.Driver |
| 2 | -#ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 2 | +#ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 3 | 3 | #ms.mysql.username= root |
| 4 | 4 | #ms.mysql.password= 123456 |
| 5 | 5 | |
| 6 | 6 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 7 | +ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 8 | 8 | ms.mysql.username= root |
| 9 | 9 | ms.mysql.password= 123456 | ... | ... |
src/main/resources/static/assets/plugins/fileinput/canvas-to-blob.min.js
0 → 100644
| 1 | +!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){a(d&&b.toDataURL&&f?f(this.toDataURL(c,d)):this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define(function(){return f}):a.dataURLtoBlob=f}(window); | |
| 0 | 2 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/fileinput/css/fileinput.min.css
0 → 100644
| 1 | +/*! | |
| 2 | + * bootstrap-fileinput v4.3.6 | |
| 3 | + * http://plugins.krajee.com/file-input | |
| 4 | + * | |
| 5 | + * Author: Kartik Visweswaran | |
| 6 | + * Copyright: 2014 - 2016, Kartik Visweswaran, Krajee.com | |
| 7 | + * | |
| 8 | + * Licensed under the BSD 3-Clause | |
| 9 | + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md | |
| 10 | + */.file-loading{top:0;right:0;width:25px;height:25px;font-size:999px;text-align:right;color:#fff;background:transparent url('../img/loading.gif') top left no-repeat;border:0}.file-object{margin:0 0 -5px 0;padding:0}.btn-file{position:relative;overflow:hidden}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;text-align:right;opacity:0;background:none repeat scroll 0 0 transparent;cursor:inherit;display:block}.file-caption-name{display:inline-block;overflow:hidden;height:20px;word-break:break-all}.input-group-lg .file-caption-name{height:25px}.file-zoom-dialog{text-align:left}.file-error-message{color:#a94442;background-color:#f2dede;margin:5px;border:1px solid #ebccd1;border-radius:4px;padding:15px}.file-error-message pre,.file-error-message ul{margin:0;text-align:left}.file-error-message pre{margin:5px 0}.file-caption-disabled{background-color:#eee;cursor:not-allowed;opacity:1}.file-preview{border-radius:5px;border:1px solid #ddd;padding:5px;width:100%;margin-bottom:5px}.file-preview-frame{position:relative;display:table;margin:8px;height:160px;border:1px solid #ddd;box-shadow:1px 1px 5px 0 #a2958a;padding:6px;float:left;text-align:center;vertical-align:middle}.file-preview-frame:not(.file-preview-error):hover{box-shadow:3px 3px 5px 0 #333}.file-preview-image{vertical-align:middle;image-orientation:from-image}.file-preview-text{display:block;color:#428bca;border:1px solid #ddd;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;outline:0;padding:8px;resize:none}.file-preview-html{border:1px solid #ddd;padding:8px;overflow:auto}.file-zoom-dialog .file-preview-text{font-size:1.2em}.file-preview-other{left:0;top:0;right:0;bottom:0;margin:auto;text-align:center;vertical-align:middle;padding:10px}.file-preview-other:hover{opacity:.8}.file-actions,.file-other-error{text-align:left}.file-other-icon{font-size:4.8em}.file-zoom-dialog .file-other-icon{font-size:8em;font-size:55vmin}.file-input-new .file-preview,.file-input-new .close,.file-input-new .glyphicon-file,.file-input-new .fileinput-remove-button,.file-input-new .fileinput-upload-button,.file-input-ajax-new .fileinput-remove-button,.file-input-ajax-new .fileinput-upload-button{display:none}.file-caption-main{width:100%}.file-input-ajax-new .no-browse .input-group-btn,.file-input-new .no-browse .input-group-btn{display:none}.file-input-ajax-new .no-browse .form-control,.file-input-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px}.file-thumb-loading{background:transparent url('../img/loading.gif') no-repeat scroll center center content-box!important}.file-actions{margin-top:15px}.file-footer-buttons{float:right}.file-upload-indicator{display:inline;cursor:default;opacity:.8;width:60%}.file-upload-indicator:hover{font-weight:bold;opacity:1}.file-footer-caption{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:160px;text-align:center;padding-top:4px;font-size:11px;color:#777;margin:5px auto}.file-preview-error{opacity:.65;box-shadow:none}.file-preview-frame:not(.file-preview-error) .file-footer-caption:hover{color:#000}.file-drop-zone{border:1px dashed #aaa;border-radius:4px;height:100%;text-align:center;vertical-align:middle;margin:12px 15px 12px 12px;padding:5px}.file-drop-zone-title{color:#aaa;font-size:1.6em;padding:85px 10px;cursor:default}.file-preview .clickable,.clickable .file-drop-zone-title{cursor:pointer}.file-drop-zone.clickable:hover{border:2px dashed #999}.file-drop-zone.clickable:focus{border:2px solid #5acde2}.file-drop-zone .file-preview-thumbnails{cursor:default}.file-highlighted{border:2px dashed #999!important;background-color:#f0f0f0}.file-uploading{background:url('../img/loading-sm.gif') no-repeat center bottom 10px;opacity:.65}.file-thumb-progress{height:10px}.file-thumb-progress .progress,.file-thumb-progress .progress-bar{height:10px;font-size:9px;line-height:10px}.file-thumbnail-footer{position:relative}.file-thumb-progress{position:absolute;top:35px;left:0;right:0}.file-zoom-fullscreen.modal{position:fixed;top:0;right:0;bottom:0;left:0}.file-zoom-fullscreen .modal-dialog{position:fixed;margin:0;width:100%;height:100%;padding:0}.file-zoom-fullscreen .modal-content{border-radius:0;box-shadow:none}.file-zoom-fullscreen .modal-body{overflow-y:auto}.file-zoom-dialog .modal-body{position:relative!important}.file-zoom-dialog .btn-navigate{position:absolute;padding:0;margin:0;background:transparent;text-decoration:none;outline:0;opacity:.7;top:45%;font-size:4em;color:#1c94c4}.file-zoom-dialog .floating-buttons{position:absolute;top:5px;right:10px}.floating-buttons,.floating-buttons .btn{z-index:3000}.file-zoom-dialog .kv-zoom-actions .btn,.floating-buttons .btn{margin-left:3px}.file-zoom-dialog .btn-navigate:not([disabled]):hover,.file-zoom-dialog .btn-navigate:not([disabled]):focus{outline:0;box-shadow:none;opacity:.5}.file-zoom-dialog .btn-navigate[disabled]{opacity:.3}.file-zoom-dialog .btn-prev{left:1px}.file-zoom-dialog .btn-next{right:1px}.file-drag-handle{display:inline;margin-right:2px;font-size:16px;cursor:move;cursor:-webkit-grabbing}.file-drag-handle:hover{opacity:.7}.file-zoom-content{height:480px;text-align:center}.file-preview-initial.sortable-chosen{background-color:#d9edf7}.file-preview-frame.sortable-ghost{background-color:#eee}.btn-file ::-ms-browse{width:100%;height:100%} | |
| 0 | 11 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/fileinput/fileinput.min.js
0 → 100644
| 1 | +/*! | |
| 2 | + * bootstrap-fileinput v4.3.6 | |
| 3 | + * http://plugins.krajee.com/file-input | |
| 4 | + * | |
| 5 | + * Author: Kartik Visweswaran | |
| 6 | + * Copyright: 2014 - 2016, Kartik Visweswaran, Krajee.com | |
| 7 | + * | |
| 8 | + * Licensed under the BSD 3-Clause | |
| 9 | + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md | |
| 10 | + */!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";a.fn.fileinputLocales={},a.fn.fileinputThemes={};var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa;b=".fileinput",c="kvFileinputModal",d='style="width:{width};height:{height};"',e='<param name="controller" value="true" />\n<param name="allowFullScreen" value="true" />\n<param name="allowScriptAccess" value="always" />\n<param name="autoPlay" value="false" />\n<param name="autoStart" value="false" />\n<param name="quality" value="high" />\n',f='<div class="file-preview-other">\n<span class="{previewFileIconClass}">{previewFileIcon}</span>\n</div>',g=window.URL||window.webkitURL,h=function(a,b,c){return void 0!==a&&(c?a===b:a.match(b))},i=function(a){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===a)return new RegExp("msie\\s"+a,"i").test(navigator.userAgent);var c,b=document.createElement("div");return b.innerHTML="<!--[if IE "+a+"]> <i></i> <![endif]-->",c=b.getElementsByTagName("i").length,document.body.appendChild(b),b.parentNode.removeChild(b),c},j=function(a,c,d,e){var f=e?c:c.split(" ").join(b+" ")+b;a.off(f).on(f,d)},k={data:{},init:function(a){var b=a.initialPreview,c=a.id;b.length>0&&!ea(b)&&(b=b.split(a.initialPreviewDelimiter)),k.data[c]={content:b,config:a.initialPreviewConfig,tags:a.initialPreviewThumbTags,delimiter:a.initialPreviewDelimiter,previewFileType:a.initialPreviewFileType,previewAsData:a.initialPreviewAsData,template:a.previewGenericTemplate,showZoom:a.fileActionSettings.showZoom,showDrag:a.fileActionSettings.showDrag,getSize:function(b){return a._getSize(b)},parseTemplate:function(b,c,d,e,f,g,h){var i=" file-preview-initial";return a._generatePreviewTemplate(b,c,d,e,f,!1,null,i,g,h)},msg:function(b){return a._getMsgSelected(b)},initId:a.previewInitId,footer:a._getLayoutTemplate("footer").replace(/\{progress}/g,a._renderThumbProgress()),isDelete:a.initialPreviewShowDelete,caption:a.initialCaption,actions:function(b,c,d,e,f,g,h){return a._renderFileActions(b,c,d,e,f,g,h,!0)}}},fetch:function(a){return k.data[a].content.filter(function(a){return null!==a})},count:function(a,b){return k.data[a]&&k.data[a].content?b?k.data[a].content.length:k.fetch(a).length:0},get:function(b,c,d){var j,l,n,o,p,q,e="init_"+c,f=k.data[b],g=f.config[c],h=f.content[c],i=f.initId+"-"+e,m=" file-preview-initial",r=fa("previewAsData",g,f.previewAsData);return d=void 0===d||d,h?(g&&g.frameClass&&(m+=" "+g.frameClass),r?(n=f.previewAsData?fa("type",g,f.previewFileType||"generic"):"generic",o=fa("caption",g),p=k.footer(b,c,d,g&&g.size||null),q=fa("filetype",g,n),j=f.parseTemplate(n,h,o,q,i,p,e,null)):j=f.template.replace(/\{previewId}/g,i).replace(/\{frameClass}/g,m).replace(/\{fileindex}/g,e).replace(/\{content}/g,f.content[c]).replace(/\{template}/g,fa("type",g,f.previewFileType)).replace(/\{footer}/g,k.footer(b,c,d,g&&g.size||null)),f.tags.length&&f.tags[c]&&(j=ia(j,f.tags[c])),da(g)||da(g.frameAttr)||(l=a(document.createElement("div")).html(j),l.find(".file-preview-initial").attr(g.frameAttr),j=l.html(),l.remove()),j):""},add:function(b,c,d,e,f){var h,g=a.extend(!0,{},k.data[b]);return ea(c)||(c=c.split(g.delimiter)),f?(h=g.content.push(c)-1,g.config[h]=d,g.tags[h]=e):(h=c.length-1,g.content=c,g.config=d,g.tags=e),k.data[b]=g,h},set:function(b,c,d,e,f){var h,i,g=a.extend(!0,{},k.data[b]);if(c&&c.length&&(ea(c)||(c=c.split(g.delimiter)),i=c.filter(function(a){return null!==a}),i.length)){if(void 0===g.content&&(g.content=[]),void 0===g.config&&(g.config=[]),void 0===g.tags&&(g.tags=[]),f){for(h=0;h<c.length;h++)c[h]&&g.content.push(c[h]);for(h=0;h<d.length;h++)d[h]&&g.config.push(d[h]);for(h=0;h<e.length;h++)e[h]&&g.tags.push(e[h])}else g.content=c,g.config=d,g.tags=e;k.data[b]=g}},unset:function(a,b){var c=k.count(a.id);if(c){if(1===c)return k.data[a.id].content=[],k.data[a.id].config=[],k.data[a.id].tags=[],a.initialPreview=[],a.initialPreviewConfig=[],void(a.initialPreviewThumbTags=[]);k.data[a.id].content[b]=null,k.data[a.id].config[b]=null,k.data[a.id].tags[b]=null}},out:function(a){var d,b="",c=k.data[a],e=k.count(a,!0);if(0===e)return{content:"",caption:""};for(var f=0;f<e;f++)b+=k.get(a,f);return d=c.msg(k.count(a)),{content:'<div class="file-initial-thumbs">'+b+"</div>",caption:d}},footer:function(a,b,c,d){var e=k.data[a];if(c=void 0===c||c,0===e.config.length||da(e.config[b]))return"";var f=e.config[b],g=fa("caption",f),h=fa("width",f,"auto"),i=fa("url",f,!1),j=fa("key",f,null),l=fa("showDelete",f,!0),m=fa("showZoom",f,e.showZoom),n=fa("showDrag",f,e.showDrag),o=i===!1&&c,p=e.isDelete?e.actions(!1,l,m,n,o,i,j):"",q=e.footer.replace(/\{actions}/g,p);return q.replace(/\{caption}/g,g).replace(/\{size}/g,e.getSize(d)).replace(/\{width}/g,h).replace(/\{indicator}/g,"").replace(/\{indicatorTitle}/g,"")}},l=function(a,b){return b=b||0,"number"==typeof a?a:("string"==typeof a&&(a=parseFloat(a)),isNaN(a)?b:a)},m=function(){return!(!window.File||!window.FileReader)},n=function(){var a=document.createElement("div");return!i(9)&&(void 0!==a.draggable||void 0!==a.ondragstart&&void 0!==a.ondrop)},o=function(){return m()&&window.FormData},p=function(a,b){a.removeClass(b).addClass(b)},X={showRemove:!0,showUpload:!0,showZoom:!0,showDrag:!0,removeIcon:'<i class="glyphicon glyphicon-trash text-danger"></i>',removeClass:"btn btn-xs btn-default",removeTitle:"Remove file",uploadIcon:'<i class="glyphicon glyphicon-upload text-info"></i>',uploadClass:"btn btn-xs btn-default",uploadTitle:"Upload file",zoomIcon:'<i class="glyphicon glyphicon-zoom-in"></i>',zoomClass:"btn btn-xs btn-default",zoomTitle:"View Details",dragIcon:'<i class="glyphicon glyphicon-menu-hamburger"></i>',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'<i class="glyphicon glyphicon-hand-down text-warning"></i>',indicatorSuccess:'<i class="glyphicon glyphicon-ok-sign text-success"></i>',indicatorError:'<i class="glyphicon glyphicon-exclamation-sign text-danger"></i>',indicatorLoading:'<i class="glyphicon glyphicon-hand-up text-muted"></i>',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."},q='{preview}\n<div class="kv-upload-progress hide"></div>\n<div class="input-group {class}">\n {caption}\n <div class="input-group-btn">\n {remove}\n {cancel}\n {upload}\n {browse}\n </div>\n</div>',r='{preview}\n<div class="kv-upload-progress hide"></div>\n{remove}\n{cancel}\n{upload}\n{browse}\n',s='<div class="file-preview {class}">\n {close} <div class="{dropClass}">\n <div class="file-preview-thumbnails">\n </div>\n <div class="clearfix"></div> <div class="file-preview-status text-center text-success"></div>\n <div class="kv-fileinput-error"></div>\n </div>\n</div>',u='<div class="close fileinput-remove">×</div>\n',t='<i class="glyphicon glyphicon-file kv-caption-icon"></i>',v='<div tabindex="500" class="form-control file-caption {class}">\n <div class="file-caption-name"></div>\n</div>\n',w='<button type="{type}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</button>',x='<a href="{href}" tabindex="500" title="{title}" class="{css}" {status}>{icon} {label}</a>',y='<div tabindex="500" class="{css}" {status}>{icon} {label}</div>',z='<div id="'+c+'" class="file-zoom-dialog modal fade" tabindex="-1" aria-labelledby="'+c+'Label"></div>',A='<div class="modal-dialog modal-lg" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <div class="kv-zoom-actions pull-right">{toggleheader}{fullscreen}{borderless}{close}</div>\n <h3 class="modal-title">{heading} <small><span class="kv-zoom-title"></span></small></h3>\n </div>\n <div class="modal-body">\n <div class="floating-buttons"></div>\n <div class="kv-zoom-body file-zoom-content"></div>\n{prev} {next}\n </div>\n </div>\n</div>\n',B='<div class="progress">\n <div class="{class}" role="progressbar" aria-valuenow="{percent}" aria-valuemin="0" aria-valuemax="100" style="width:{percent}%;">\n {percent}%\n </div>\n</div>',C=" <br><samp>({sizeText})</samp>",D='<div class="file-thumbnail-footer">\n <div class="file-footer-caption" title="{caption}">{caption}{size}</div>\n {progress} {actions}\n</div>',E='<div class="file-actions">\n <div class="file-footer-buttons">\n {upload} {delete} {zoom} {other} </div>\n {drag}\n <div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>\n <div class="clearfix"></div>\n</div>',F='<button type="button" class="kv-file-remove {removeClass}" title="{removeTitle}" {dataUrl}{dataKey}>{removeIcon}</button>\n',G='<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">{uploadIcon}</button>',H='<button type="button" class="kv-file-zoom {zoomClass}" title="{zoomTitle}">{zoomIcon}</button>',I='<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>',J='<div class="file-preview-frame{frameClass}" id="{previewId}" data-fileindex="{fileindex}" data-template="{template}"',K=J+'><div class="kv-file-content">\n',L=J+' title="{caption}" '+d+'><div class="kv-file-content">\n',M="</div>{footer}\n</div>\n",N="{content}\n",O='<div class="kv-preview-data file-preview-html" title="{caption}" '+d+">{data}</div>\n",P='<img src="{data}" class="kv-preview-data file-preview-image" title="{caption}" alt="{caption}" '+d+">\n",Q='<textarea class="kv-preview-data file-preview-text" title="{caption}" readonly '+d+">{data}</textarea>\n",R='<video class="kv-preview-data" width="{width}" height="{height}" controls>\n<source src="{data}" type="{type}">\n'+f+"\n</video>\n",S='<audio class="kv-preview-data" controls>\n<source src="{data}" type="{type}">\n'+f+"\n</audio>\n",T='<object class="kv-preview-data file-object" type="application/x-shockwave-flash" width="{width}" height="{height}" data="{data}">\n'+e+" "+f+"\n</object>\n",U='<object class="kv-preview-data file-object" data="{data}" type="{type}" width="{width}" height="{height}">\n<param name="movie" value="{caption}" />\n'+e+" "+f+"\n</object>\n",V='<embed class="kv-preview-data" src="{data}" width="{width}" height="{height}" type="application/pdf">\n',W='<div class="kv-preview-data file-preview-other-frame">\n'+f+"\n</div>\n",Y={main1:q,main2:r,preview:s,close:u,fileIcon:t,caption:v,modalMain:z,modal:A,progress:B,size:C,footer:D,actions:E,actionDelete:F,actionUpload:G,actionZoom:H,actionDrag:I,btnDefault:w,btnLink:x,btnBrowse:y},Z={generic:K+N+M,html:K+O+M,image:K+P+M,text:K+Q+M,video:L+R+M,audio:L+S+M,flash:L+T+M,object:L+U+M,pdf:L+V+M,other:L+W+M},_=["image","html","text","video","audio","flash","pdf","object"],ba={image:{width:"auto",height:"160px"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},video:{width:"213px",height:"160px"},audio:{width:"213px",height:"80px"},flash:{width:"213px",height:"160px"},object:{width:"160px",height:"160px"},pdf:{width:"160px",height:"160px"},other:{width:"160px",height:"160px"}},$={image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"100%",height:"100%","min-height":"480px"},text:{width:"100%",height:"100%","min-height":"480px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"100%","min-height":"480px"},pdf:{width:"100%",height:"100%","min-height":"480px"},other:{width:"auto",height:"100%","min-height":"480px"}},ca={image:function(a,b){return h(a,"image.*")||h(b,/\.(gif|png|jpe?g)$/i)},html:function(a,b){return h(a,"text/html")||h(b,/\.(htm|html)$/i)},text:function(a,b){return h(a,"text.*")||h(b,/\.(xml|javascript)$/i)||h(b,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(a,b){return h(a,"video.*")&&(h(a,/(ogg|mp4|mp?g|webm|3gp)$/i)||h(b,/\.(og?|mp4|webm|mp?g|3gp)$/i))},audio:function(a,b){return h(a,"audio.*")&&(h(b,/(ogg|mp3|mp?g|wav)$/i)||h(b,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(a,b){return h(a,"application/x-shockwave-flash",!0)||h(b,/\.(swf)$/i)},pdf:function(a,b){return h(a,"application/pdf",!0)||h(b,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},da=function(b,c){return void 0===b||null===b||0===b.length||c&&""===a.trim(b)},ea=function(a){return Array.isArray(a)||"[object Array]"===Object.prototype.toString.call(a)},fa=function(a,b,c){return c=c||"",b&&"object"==typeof b&&a in b?b[a]:c},aa=function(b,c,d){return da(b)||da(b[c])?d:a(b[c])},ga=function(){return Math.round((new Date).getTime()+100*Math.random())},ha=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},ia=function(b,c){var d=b;return c?(a.each(c,function(a,b){"function"==typeof b&&(b=b()),d=d.split(a).join(b)}),d):d},ja=function(a){var b=a.is("img")?a.attr("src"):a.find("source").attr("src");g.revokeObjectURL(b)},ka=function(a){var b=a.lastIndexOf("/");return b===-1&&(b=a.lastIndexOf("\\")),a.split(a.substring(b,b+1)).pop()},la=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},ma=function(a){a&&!la()?document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.msRequestFullscreen?document.documentElement.msRequestFullscreen():document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},na=function(a,b,c){if(c>=a.length)for(var d=c-a.length;d--+1;)a.push(void 0);return a.splice(c,0,a.splice(b,1)[0]),a},oa=function(b,c){var d=this;d.$element=a(b),d._validate()&&(d.isPreviewable=m(),d.isIE9=i(9),d.isIE10=i(10),d.isPreviewable||d.isIE9?(d._init(c),d._listen()):d.$element.removeClass("file-loading"))},oa.prototype={constructor:oa,_init:function(b){var e,c=this,d=c.$element;a.each(b,function(a,b){switch(a){case"minFileCount":case"maxFileCount":case"maxFileSize":c[a]=l(b);break;default:c[a]=b}}),c.fileInputCleared=!1,c.fileBatchCompleted=!0,c.isPreviewable||(c.showPreview=!1),c.uploadFileAttr=da(d.attr("name"))?"file_data":d.attr("name"),c.reader=null,c.formdata={},c.clearStack(),c.uploadCount=0,c.uploadStatus={},c.uploadLog=[],c.uploadAsyncCount=0,c.loadedImages=[],c.totalImagesCount=0,c.ajaxRequests=[],c.isError=!1,c.ajaxAborted=!1,c.cancelling=!1,e=c._getLayoutTemplate("progress"),c.progressTemplate=e.replace("{class}",c.progressClass),c.progressCompleteTemplate=e.replace("{class}",c.progressCompleteClass),c.progressErrorTemplate=e.replace("{class}",c.progressErrorClass),c.dropZoneEnabled=n()&&c.dropZoneEnabled,c.isDisabled=c.$element.attr("disabled")||c.$element.attr("readonly"),c.isUploadable=o()&&!da(c.uploadUrl),c.isClickable=c.browseOnZoneClick&&c.showPreview&&(c.isUploadable&&c.dropZoneEnabled||!da(c.defaultPreviewContent)),c.slug="function"==typeof b.slugCallback?b.slugCallback:c._slugDefault,c.mainTemplate=c.showCaption?c._getLayoutTemplate("main1"):c._getLayoutTemplate("main2"),c.captionTemplate=c._getLayoutTemplate("caption"),c.previewGenericTemplate=c._getPreviewTemplate("generic"),c.resizeImage&&(c.maxImageWidth||c.maxImageHeight)&&(c.imageCanvas=document.createElement("canvas"),c.imageCanvasContext=c.imageCanvas.getContext("2d")),da(c.$element.attr("id"))&&c.$element.attr("id",ga()),void 0===c.$container?c.$container=c._createContainer():c._refreshContainer(),c.$dropZone=c.$container.find(".file-drop-zone"),c.$progress=c.$container.find(".kv-upload-progress"),c.$btnUpload=c.$container.find(".fileinput-upload"),c.$captionContainer=aa(b,"elCaptionContainer",c.$container.find(".file-caption")),c.$caption=aa(b,"elCaptionText",c.$container.find(".file-caption-name")),c.$previewContainer=aa(b,"elPreviewContainer",c.$container.find(".file-preview")),c.$preview=aa(b,"elPreviewImage",c.$container.find(".file-preview-thumbnails")),c.$previewStatus=aa(b,"elPreviewStatus",c.$container.find(".file-preview-status")),c.$errorContainer=aa(b,"elErrorContainer",c.$previewContainer.find(".kv-fileinput-error")),da(c.msgErrorClass)||p(c.$errorContainer,c.msgErrorClass),c.$errorContainer.hide(),c.fileActionSettings=a.extend(!0,X,b.fileActionSettings),c.previewInitId="preview-"+ga(),c.id=c.$element.attr("id"),k.init(c),c._initPreview(!0),c._initPreviewActions(),c.options=b,c._setFileDropZoneTitle(),c.$element.removeClass("file-loading"),c.$element.attr("disabled")&&c.disable(),c._initZoom()},_validate:function(){var b,a=this;return"file"===a.$element.attr("type")||(b='<div class="help-block alert alert-warning"><h4>Invalid Input Type</h4>You must set an input <code>type = file</code> for <b>bootstrap-fileinput</b> plugin to initialize.</div>',a.$element.after(b),!1)},_errorsExist:function(){var c,b=this;return!!b.$errorContainer.find("li").length||(c=a(document.createElement("div")).html(b.$errorContainer.html()),c.find("span.kv-error-close").remove(),c.find("ul").remove(),!!a.trim(c.text()).length)},_errorHandler:function(a,b){var c=this,d=a.target.error;d.code===d.NOT_FOUND_ERR?c._showError(c.msgFileNotFound.replace("{name}",b)):d.code===d.SECURITY_ERR?c._showError(c.msgFileSecured.replace("{name}",b)):d.code===d.NOT_READABLE_ERR?c._showError(c.msgFileNotReadable.replace("{name}",b)):d.code===d.ABORT_ERR?c._showError(c.msgFilePreviewAborted.replace("{name}",b)):c._showError(c.msgFilePreviewError.replace("{name}",b))},_addError:function(a){var b=this,c=b.$errorContainer;a&&c.length&&(c.html(b.errorCloseButton+a),j(c.find(".kv-error-close"),"click",function(){c.fadeOut("slow")}))},_resetErrors:function(a){var b=this,c=b.$errorContainer;b.isError=!1,b.$container.removeClass("has-error"),c.html(""),a?c.fadeOut("slow"):c.hide()},_showFolderError:function(a){var d,b=this,c=b.$errorContainer;a&&(d=b.msgFoldersNotAllowed.replace(/\{n}/g,a),b._addError(d),p(b.$container,"has-error"),c.fadeIn(800),b._raise("filefoldererror",[a,d]))},_showUploadError:function(a,b,c){var d=this,e=d.$errorContainer,f=c||"fileuploaderror",g=b&&b.id?'<li data-file-id="'+b.id+'">'+a+"</li>":"<li>"+a+"</li>";return 0===e.find("ul").length?d._addError("<ul>"+g+"</ul>"):e.find("ul").append(g),e.fadeIn(800),d._raise(f,[b,a]),d.$container.removeClass("file-input-new"),p(d.$container,"has-error"),!0},_showError:function(a,b,c){var d=this,e=d.$errorContainer,f=c||"fileerror";return b=b||{},b.reader=d.reader,d._addError(a),e.fadeIn(800),d._raise(f,[b,a]),d.isUploadable||d._clearFileInput(),d.$container.removeClass("file-input-new"),p(d.$container,"has-error"),d.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(a){var b=this,c=b.minFileCount>1?b.filePlural:b.fileSingle,d=b.msgFilesTooLess.replace("{n}",b.minFileCount).replace("{files}",c),e=b.$errorContainer;b._addError(d),b.isError=!0,b._updateFileDetails(0),e.fadeIn(800),b._raise("fileerror",[a,d]),b._clearFileInput(),p(b.$container,"has-error")},_parseError:function(b,c,d){var e=this,f=a.trim(c+""),g="."===f.slice(-1)?"":".",h=void 0!==b.responseJSON&&void 0!==b.responseJSON.error?b.responseJSON.error:b.responseText;return e.cancelling&&e.msgUploadAborted&&(f=e.msgUploadAborted),e.showAjaxErrorDetails&&h?(h=a.trim(h.replace(/\n\s*\n/g,"\n")),h=h.length>0?"<pre>"+h+"</pre>":"",f+=g+h):f+=g,e.cancelling=!1,d?"<b>"+d+": </b>"+f:f},_parseFileType:function(a){var c,d,e,f,b=this;for(f=0;f<_.length;f+=1)if(e=_[f],c=fa(e,b.fileTypeSettings,ca[e]),d=c(a.type,a.name)?e:"",!da(d))return d;return"other"},_parseFilePreviewIcon:function(b,c){var e,f,d=this,g=d.previewFileIcon;return c&&c.indexOf(".")>-1&&(f=c.split(".").pop(),d.previewFileIconSettings&&d.previewFileIconSettings[f]&&(g=d.previewFileIconSettings[f]),d.previewFileExtSettings&&a.each(d.previewFileExtSettings,function(a,b){return d.previewFileIconSettings[a]&&b(f)?void(g=d.previewFileIconSettings[a]):void(e=!0)})),b.indexOf("{previewFileIcon}")>-1?b.replace(/\{previewFileIconClass}/g,d.previewFileIconClass).replace(/\{previewFileIcon}/g,g):b},_raise:function(b,c){var d=this,e=a.Event(b);if(void 0!==c?d.$element.trigger(e,c):d.$element.trigger(e),e.isDefaultPrevented())return!1;if(!e.result)return e.result;switch(b){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:d.ajaxAborted=e.result}return!0},_listenFullScreen:function(a){var d,e,b=this,c=b.$modal;c&&c.length&&(d=c&&c.find(".btn-fullscreen"),e=c&&c.find(".btn-borderless"),d.length&&e.length&&(d.removeClass("active").attr("aria-pressed","false"),e.removeClass("active").attr("aria-pressed","false"),a?d.addClass("active").attr("aria-pressed","true"):e.addClass("active").attr("aria-pressed","true"),c.hasClass("file-zoom-fullscreen")?b._maximizeZoomDialog():a?b._maximizeZoomDialog():e.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var b=this,c=b.$element,d=c.closest("form"),e=b.$container;j(c,"change",a.proxy(b._change,b)),b.showBrowse&&j(b.$btnFile,"click",a.proxy(b._browse,b)),j(d,"reset",a.proxy(b.reset,b)),j(e.find(".fileinput-remove:not([disabled])"),"click",a.proxy(b.clear,b)),j(e.find(".fileinput-cancel"),"click",a.proxy(b.cancel,b)),b._initDragDrop(),b.isUploadable||j(d,"submit",a.proxy(b._submitForm,b)),j(b.$container.find(".fileinput-upload"),"click",a.proxy(b._uploadClick,b)),j(a(window),"resize",function(){b._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),j(a(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){b._listenFullScreen(la())}),b._initClickable()},_initClickable:function(){var c,b=this;b.isClickable&&(c=b.isUploadable?b.$dropZone:b.$preview.find(".file-default-preview"),p(c,"clickable"),c.attr("tabindex",-1),j(c,"click",function(d){var e=a(d.target);e.parents(".file-preview-thumbnails").length&&!e.parents(".file-default-preview").length||(b.$element.trigger("click"),c.blur())}))},_initDragDrop:function(){var b=this,c=b.$dropZone;b.isUploadable&&b.dropZoneEnabled&&b.showPreview&&(j(c,"dragenter dragover",a.proxy(b._zoneDragEnter,b)),j(c,"dragleave",a.proxy(b._zoneDragLeave,b)),j(c,"drop",a.proxy(b._zoneDrop,b)),j(a(document),"dragenter dragover drop",b._zoneDragDropInit))},_zoneDragDropInit:function(a){a.stopPropagation(),a.preventDefault()},_zoneDragEnter:function(b){var c=this,d=a.inArray("Files",b.originalEvent.dataTransfer.types)>-1;return c._zoneDragDropInit(b),c.isDisabled||!d?(b.originalEvent.dataTransfer.effectAllowed="none",void(b.originalEvent.dataTransfer.dropEffect="none")):void p(c.$dropZone,"file-highlighted")},_zoneDragLeave:function(a){var b=this;b._zoneDragDropInit(a),b.isDisabled||b.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(a){var b=this;a.preventDefault(),b.isDisabled||da(a.originalEvent.dataTransfer.files)||(b._change(a,"dragdrop"),b.$dropZone.removeClass("file-highlighted"))},_uploadClick:function(a){var d,b=this,c=b.$container.find(".fileinput-upload"),e=!c.hasClass("disabled")&&da(c.attr("disabled"));if(!a||!a.isDefaultPrevented()){if(!b.isUploadable)return void(e&&"submit"!==c.attr("type")&&(d=c.closest("form"),d.length&&d.trigger("submit"),a.preventDefault()));a.preventDefault(),e&&b.upload()}},_submitForm:function(){var a=this,b=a.$element,c=b.get(0).files;return c&&a.minFileCount>0&&a._getFileCount(c.length)<a.minFileCount?(a._noFilesError({}),!1):!a._abort({})},_clearPreview:function(){var a=this,b=a.showUploadedThumbs?a.$preview.find(".file-preview-frame:not(.file-preview-success)"):a.$preview.find(".file-preview-frame");b.remove(),a.$preview.find(".file-preview-frame").length&&a.showPreview||a._resetUpload(),a._validateDefaultPreview()},_initSortable:function(){var d,e,b=this,c=b.$preview;window.KvSortable&&(d=c.find(".file-initial-thumbs"),e={handle:".drag-handle-init",dataIdAttr:"data-preview-id",draggable:".file-preview-initial",onSort:function(c){var d=c.oldIndex,e=c.newIndex;b.initialPreview=na(b.initialPreview,d,e),b.initialPreviewConfig=na(b.initialPreviewConfig,d,e),k.init(b);for(var f=0;f<b.initialPreviewConfig.length;f++)if(null!==b.initialPreviewConfig[f]){var g=b.initialPreviewConfig[f].key,h=a(".kv-file-remove[data-key='"+g+"']");h=h.closest(".file-preview-frame"),h.attr("data-fileindex","init_"+f),h.data("fileindex","init_"+f)}b._raise("filesorted",{previewId:a(c.item).attr("id"),oldIndex:d,newIndex:e,stack:b.initialPreviewConfig})}},d.data("kvsortable")&&d.kvsortable("destroy"),a.extend(!0,e,b.fileActionSettings.dragSettings),d.kvsortable(e))},_initPreview:function(a){var d,b=this,c=b.initialCaption||"";return k.count(b.id)?(d=k.out(b.id),c=a&&b.initialCaption?b.initialCaption:d.caption,b.$preview.html(d.content),b._setCaption(c),b._initSortable(),void(da(d.content)||b.$container.removeClass("file-input-new"))):(b._clearPreview(),void(a?b._setCaption(c):b._initCaption()))},_getZoomButton:function(a){var b=this,c=b.previewZoomButtonIcons[a],d=b.previewZoomButtonClasses[a],e=' title="'+(b.previewZoomButtonTitles[a]||"")+'" ',f=e+("close"===a?' data-dismiss="modal" aria-hidden="true"':"");return"fullscreen"!==a&&"borderless"!==a&&"toggleheader"!==a||(f+=' data-toggle="button" aria-pressed="false" autocomplete="off"'),'<button type="button" class="'+d+" btn-"+a+'"'+f+">"+c+"</button>"},_getModalContent:function(){var a=this;return a._getLayoutTemplate("modal").replace(/\{heading}/g,a.msgZoomModalHeading).replace(/\{prev}/g,a._getZoomButton("prev")).replace(/\{next}/g,a._getZoomButton("next")).replace(/\{toggleheader}/g,a._getZoomButton("toggleheader")).replace(/\{fullscreen}/g,a._getZoomButton("fullscreen")).replace(/\{borderless}/g,a._getZoomButton("borderless")).replace(/\{close}/g,a._getZoomButton("close"))},_listenModalEvent:function(a){var b=this,c=b.$modal,d=function(a){return{sourceEvent:a,previewId:c.data("previewId"),modal:c}};c.on(a+".bs.modal",function(e){var f=c.find(".btn-fullscreen"),g=c.find(".btn-borderless");b._raise("filezoom"+a,d(e)),"shown"===a&&(g.removeClass("active").attr("aria-pressed","false"),f.removeClass("active").attr("aria-pressed","false"),c.hasClass("file-zoom-fullscreen")&&(b._maximizeZoomDialog(),la()?f.addClass("active").attr("aria-pressed","true"):g.addClass("active").attr("aria-pressed","true")))})},_initZoom:function(){var d,b=this,e=b._getLayoutTemplate("modalMain"),f="#"+c;b.$modal=a(f),b.$modal&&b.$modal.length||(d=a(document.createElement("div")).html(e).insertAfter(b.$container),b.$modal=a("#"+c).insertBefore(d),d.remove()),b.$modal.html(b._getModalContent()),b._listenModalEvent("show"),b._listenModalEvent("shown"),b._listenModalEvent("hide"),b._listenModalEvent("hidden"),b._listenModalEvent("loaded")},_initZoomButtons:function(){var d,e,b=this,c=b.$modal.data("previewId")||"",f=b.$preview.find(".file-preview-frame").toArray(),g=f.length,h=b.$modal.find(".btn-prev"),i=b.$modal.find(".btn-next");g&&(d=a(f[0]),e=a(f[g-1]),h.removeAttr("disabled"),i.removeAttr("disabled"),d.length&&d.attr("id")===c&&h.attr("disabled",!0),e.length&&e.attr("id")===c&&i.attr("disabled",!0))},_maximizeZoomDialog:function(){var b=this,c=b.$modal,d=c.find(".modal-header:visible"),e=c.find(".modal-footer:visible"),f=c.find(".modal-body"),g=a(window).height(),h=0;c.addClass("file-zoom-fullscreen"),d&&d.length&&(g-=d.outerHeight(!0)),e&&e.length&&(g-=e.outerHeight(!0)),f&&f.length&&(h=f.outerHeight(!0)-f.height(),g-=h),c.find(".kv-zoom-body").height(g)},_resizeZoomDialog:function(a){var b=this,c=b.$modal,d=c.find(".btn-fullscreen"),e=c.find(".btn-borderless");if(c.hasClass("file-zoom-fullscreen"))ma(!1),a?d.hasClass("active")||(c.removeClass("file-zoom-fullscreen"),b._resizeZoomDialog(!0),e.hasClass("active")&&e.removeClass("active").attr("aria-pressed","false")):d.hasClass("active")?d.removeClass("active").attr("aria-pressed","false"):(c.removeClass("file-zoom-fullscreen"),b.$modal.find(".kv-zoom-body").css("height",b.zoomModalHeight));else{if(!a)return void b._maximizeZoomDialog();ma(!0)}c.focus()},_setZoomContent:function(b,c){var e,f,g,h,i,k,l,r,d=this,m=b.attr("id"),n=d.$modal,o=n.find(".btn-prev"),q=n.find(".btn-next"),s=n.find(".btn-fullscreen"),t=n.find(".btn-borderless"),u=n.find(".btn-toggleheader");f=b.data("template")||"generic",e=b.find(".kv-file-content"),g=e.length?e.html():"",h=b.find(".file-footer-caption").text()||"",n.find(".kv-zoom-title").html(h),i=n.find(".kv-zoom-body"),c?(r=i.clone().insertAfter(i),i.html(g).hide(),r.fadeOut("fast",function(){i.fadeIn("fast"),r.remove()})):i.html(g),l=d.previewZoomSettings[f],l&&(k=i.find(".kv-preview-data"),p(k,"file-zoom-detail"),a.each(l,function(a,b){k.css(a,b),(k.attr("width")&&"width"===a||k.attr("height")&&"height"===a)&&k.removeAttr(a)})),n.data("previewId",m),j(o,"click",function(){d._zoomSlideShow("prev",m)}),j(q,"click",function(){d._zoomSlideShow("next",m)}),j(s,"click",function(){d._resizeZoomDialog(!0)}),j(t,"click",function(){d._resizeZoomDialog(!1)}),j(u,"click",function(){var c,a=n.find(".modal-header"),b=n.find(".modal-body .floating-buttons"),e=a.find(".kv-zoom-actions"),f=function(b){var c=d.$modal.find(".kv-zoom-body"),e=d.zoomModalHeight;n.hasClass("file-zoom-fullscreen")&&(e=c.outerHeight(!0),b||(e-=a.outerHeight(!0))),c.css("height",b?e+b:e)};a.is(":visible")?(c=a.outerHeight(!0),a.slideUp("slow",function(){e.find(".btn").appendTo(b),f(c)})):(b.find(".btn").appendTo(e),a.slideDown("slow",function(){f()})),n.focus()}),j(n,"keydown",function(a){var b=a.which||a.keyCode;37!==b||o.attr("disabled")||d._zoomSlideShow("prev",m),39!==b||q.attr("disabled")||d._zoomSlideShow("next",m)})},_zoomPreview:function(a){var c,b=this;if(!a.length)throw"Cannot zoom to detailed preview!";b.$modal.html(b._getModalContent()),c=a.closest(".file-preview-frame"),b._setZoomContent(c),b.$modal.modal("show"),b._initZoomButtons()},_zoomSlideShow:function(b,c){var f,g,j,d=this,e=d.$modal.find(".kv-zoom-actions .btn-"+b),h=d.$preview.find(".file-preview-frame").toArray(),i=h.length;if(!e.attr("disabled")){for(g=0;g<i;g++)if(a(h[g]).attr("id")===c){j="prev"===b?g-1:g+1;break}j<0||j>=i||!h[j]||(f=a(h[j]),f.length&&d._setZoomContent(f,!0),d._initZoomButtons(),d._raise("filezoom"+b,{previewId:c,modal:d.$modal}))}},_initZoomButton:function(){var b=this;b.$preview.find(".kv-file-zoom").each(function(){var c=a(this);j(c,"click",function(){b._zoomPreview(c)})})},_initPreviewActions:function(){var b=this,c=b.deleteExtraData||{},d=function(){var a=b.isUploadable?k.count(b.id):b.$element.get(0).files.length;0!==b.$preview.find(".kv-file-remove").length||a||(b.reset(),b.initialCaption="")};b._initZoomButton(),b.$preview.find(".kv-file-remove").each(function(){var e=a(this),f=e.data("url")||b.deleteUrl,g=e.data("key");if(!da(f)&&void 0!==g){var l,m,o,q,h=e.closest(".file-preview-frame"),i=k.data[b.id],n=h.data("fileindex");n=parseInt(n.replace("init_","")),o=da(i.config)&&da(i.config[n])?null:i.config[n],q=da(o)||da(o.extra)?c:o.extra,"function"==typeof q&&(q=q()),m={id:e.attr("id"),key:g,extra:q},l=a.extend(!0,{},{url:f,type:"POST",dataType:"json",data:a.extend(!0,{},{key:g},q),beforeSend:function(a){b.ajaxAborted=!1,b._raise("filepredelete",[g,a,q]),b.ajaxAborted?a.abort():(p(h,"file-uploading"),p(e,"disabled"))},success:function(a,c,f){var i,j;return da(a)||da(a.error)?(k.init(b),n=parseInt(h.data("fileindex").replace("init_","")),k.unset(b,n),i=k.count(b.id), | |
| 11 | + j=i>0?b._getMsgSelected(i):"",b._raise("filedeleted",[g,f,q]),b._setCaption(j),h.removeClass("file-uploading").addClass("file-deleted"),void h.fadeOut("slow",function(){b._clearObjects(h),h.remove(),d(),i||0!==b.getFileStack().length||(b._setCaption(""),b.reset())})):(m.jqXHR=f,m.response=a,b._showError(a.error,m,"filedeleteerror"),h.removeClass("file-uploading"),e.removeClass("disabled"),void d())},error:function(a,c,e){var f=b._parseError(a,e);m.jqXHR=a,m.response={},b._showError(f,m,"filedeleteerror"),h.removeClass("file-uploading"),d()}},b.ajaxDeleteSettings),j(e,"click",function(){return!!b._validateMinCount()&&void a.ajax(l)})}})},_clearObjects:function(b){b.find("video audio").each(function(){this.pause(),a(this).remove()}),b.find("img object div").each(function(){a(this).remove()})},_clearFileInput:function(){var d,e,f,b=this,c=b.$element;b.fileInputCleared=!0,da(c.val())||(b.isIE9||b.isIE10?(d=c.closest("form"),e=a(document.createElement("form")),f=a(document.createElement("div")),c.before(f),d.length?d.after(e):f.after(e),e.append(c).trigger("reset"),f.before(c).remove(),e.remove()):c.val(""))},_resetUpload:function(){var a=this;a.uploadCache={content:[],config:[],tags:[],append:!0},a.uploadCount=0,a.uploadStatus={},a.uploadLog=[],a.uploadAsyncCount=0,a.loadedImages=[],a.totalImagesCount=0,a.$btnUpload.removeAttr("disabled"),a._setProgress(0),p(a.$progress,"hide"),a._resetErrors(!1),a.ajaxAborted=!1,a.ajaxRequests=[],a._resetCanvas()},_resetCanvas:function(){var a=this;a.canvas&&a.imageCanvasContext&&a.imageCanvasContext.clearRect(0,0,a.canvas.width,a.canvas.height)},_hasInitialPreview:function(){var a=this;return!a.overwriteInitial&&k.count(a.id)},_resetPreview:function(){var b,c,a=this;k.count(a.id)?(b=k.out(a.id),a.$preview.html(b.content),c=a.initialCaption?a.initialCaption:b.caption,a._setCaption(c)):(a._clearPreview(),a._initCaption()),a.showPreview&&(a._initZoom(),a._initSortable())},_clearDefaultPreview:function(){var a=this;a.$preview.find(".file-default-preview").remove()},_validateDefaultPreview:function(){var a=this;a.showPreview&&!da(a.defaultPreviewContent)&&(a.$preview.html('<div class="file-default-preview">'+a.defaultPreviewContent+"</div>"),a.$container.removeClass("file-input-new"),a._initClickable())},_resetPreviewThumbs:function(a){var c,b=this;return a?(b._clearPreview(),void b.clearStack()):void(b._hasInitialPreview()?(c=k.out(b.id),b.$preview.html(c.content),b._setCaption(c.caption),b._initPreviewActions()):b._clearPreview())},_getLayoutTemplate:function(a){var b=this,c=fa(a,b.layoutTemplates,Y[a]);return da(b.customLayoutTags)?c:ia(c,b.customLayoutTags)},_getPreviewTemplate:function(a){var b=this,c=fa(a,b.previewTemplates,Z[a]);return da(b.customPreviewTags)?c:ia(c,b.customPreviewTags)},_getOutData:function(a,b,c){var d=this;return a=a||{},b=b||{},c=c||d.filestack.slice(0)||{},{form:d.formdata,files:c,filenames:d.filenames,filescount:d.getFilesCount(),extra:d._getExtraData(),response:b,reader:d.reader,jqXHR:a}},_getMsgSelected:function(a){var b=this,c=1===a?b.fileSingle:b.filePlural;return a>0?b.msgSelected.replace("{n}",a).replace("{files}",c):b.msgNoFilesSelected},_getThumbs:function(a){return a=a||"",this.$preview.find(".file-preview-frame:not(.file-preview-initial)"+a)},_getExtraData:function(a,b){var c=this,d=c.uploadExtraData;return"function"==typeof c.uploadExtraData&&(d=c.uploadExtraData(a,b)),d},_initXhr:function(a,b,c){var d=this;return a.upload&&a.upload.addEventListener("progress",function(a){var e=0,f=a.total,g=a.loaded||a.position;a.lengthComputable&&(e=Math.floor(g/f*100)),b?d._setAsyncUploadStatus(b,e,c):d._setProgress(e)},!1),a},_ajaxSubmit:function(b,c,d,e,f,g){var i,h=this;h._raise("filepreajax",[f,g]),h._uploadExtra(f,g),i=a.extend(!0,{},{xhr:function(){var b=a.ajaxSettings.xhr();return h._initXhr(b,f,h.getFileStack().length)},url:h.uploadUrl,type:"POST",dataType:"json",data:h.formdata,cache:!1,processData:!1,contentType:!1,beforeSend:b,success:c,complete:d,error:e},h.ajaxSettings),h.ajaxRequests.push(a.ajax(i))},_initUploadSuccess:function(b,c,d){var f,g,h,i,j,l,m,n,e=this,o=function(a,b){e[a]instanceof Array||(e[a]=[]),b&&b.length&&(e[a]=e[a].concat(b))};e.showPreview&&"object"==typeof b&&!a.isEmptyObject(b)&&void 0!==b.initialPreview&&b.initialPreview.length>0&&(e.hasInitData=!0,j=b.initialPreview||[],l=b.initialPreviewConfig||[],m=b.initialPreviewThumbTags||[],f=!(void 0!==b.append&&!b.append),j.length>0&&!ea(j)&&(j=j.split(e.initialPreviewDelimiter)),e.overwriteInitial=!1,o("initialPreview",j),o("initialPreviewConfig",l),o("initialPreviewThumbTags",m),void 0!==c?d?(n=c.attr("data-fileindex"),e.uploadCache.content[n]=j[0],e.uploadCache.config[n]=l[0]||[],e.uploadCache.tags[n]=m[0]||[],e.uploadCache.append=f):(h=k.add(e.id,j,l[0],m[0],f),g=k.get(e.id,h,!1),i=a(g).hide(),c.after(i).fadeOut("slow",function(){i.fadeIn("slow").css("display:inline-block"),e._initPreviewActions(),e._clearFileInput(),c.remove()})):(k.set(e.id,j,l,m,f),e._initPreview(),e._initPreviewActions()))},_initSuccessThumbs:function(){var b=this;b.showPreview&&b._getThumbs(".file-preview-success").each(function(){var c=a(this),d=c.find(".kv-file-remove");d.removeAttr("disabled"),j(d,"click",function(){var a=b._raise("filesuccessremove",[c.attr("id"),c.data("fileindex")]);ja(c),a!==!1&&c.fadeOut("slow",function(){c.remove(),b.$preview.find(".file-preview-frame").length||b.reset()})})})},_checkAsyncComplete:function(){var c,d,b=this;for(d=0;d<b.filestack.length;d++)if(b.filestack[d]&&(c=b.previewInitId+"-"+d,a.inArray(c,b.uploadLog)===-1))return!1;return b.uploadAsyncCount===b.uploadLog.length},_uploadExtra:function(b,c){var d=this,e=d._getExtraData(b,c);0!==e.length&&a.each(e,function(a,b){d.formdata.append(a,b)})},_uploadSingle:function(b,c,d){var h,j,l,m,n,q,r,s,t,u,e=this,f=e.getFileStack().length,g=new FormData,i=e.previewInitId+"-"+b,o=e.filestack.length>0||!a.isEmptyObject(e.uploadExtraData),v={id:i,index:b};e.formdata=g,e.showPreview&&(j=a("#"+i+":not(.file-preview-initial)"),m=j.find(".kv-file-upload"),n=j.find(".kv-file-remove"),a("#"+i).find(".file-thumb-progress").removeClass("hide")),0===f||!o||m&&m.hasClass("disabled")||e._abort(v)||(u=function(a,b){e.updateStack(a,void 0),e.uploadLog.push(b),e._checkAsyncComplete()&&(e.fileBatchCompleted=!0)},l=function(){var a=e.uploadCache;e.fileBatchCompleted&&setTimeout(function(){e.showPreview&&(k.set(e.id,a.content,a.config,a.tags,a.append),e.hasInitData&&(e._initPreview(),e._initPreviewActions())),e.unlock(),e._clearFileInput(),e._raise("filebatchuploadcomplete",[e.filestack,e._getExtraData()]),e.uploadCount=0,e.uploadStatus={},e.uploadLog=[],e._setProgress(101)},100)},q=function(c){h=e._getOutData(c),e.fileBatchCompleted=!1,e.showPreview&&(j.hasClass("file-preview-success")||(e._setThumbStatus(j,"Loading"),p(j,"file-uploading")),m.attr("disabled",!0),n.attr("disabled",!0)),d||e.lock(),e._raise("filepreupload",[h,i,b]),a.extend(!0,v,h),e._abort(v)&&(c.abort(),e._setProgressCancelled())},r=function(c,f,g){var k=e.showPreview&&j.attr("id")?j.attr("id"):i;h=e._getOutData(g,c),a.extend(!0,v,h),setTimeout(function(){da(c)||da(c.error)?(e.showPreview&&(e._setThumbStatus(j,"Success"),m.hide(),e._initUploadSuccess(c,j,d)),e._raise("fileuploaded",[h,k,b]),d?u(b,k):e.updateStack(b,void 0)):(e._showUploadError(c.error,v),e._setPreviewError(j,b),d&&u(b,k))},100)},s=function(){setTimeout(function(){e.showPreview&&(m.removeAttr("disabled"),n.removeAttr("disabled"),j.removeClass("file-uploading"),e._setProgress(101,a("#"+i).find(".file-thumb-progress"))),d?l():(e.unlock(!1),e._clearFileInput()),e._initSuccessThumbs()},100)},t=function(f,g,h){var k=e._parseError(f,h,d?c[b].name:null);setTimeout(function(){d&&u(b,i),e.uploadStatus[i]=100,e._setPreviewError(j,b),a.extend(!0,v,e._getOutData(f)),e._showUploadError(k,v)},100)},g.append(e.uploadFileAttr,c[b],e.filenames[b]),g.append("file_id",b),e._ajaxSubmit(q,r,s,t,i,b))},_uploadBatch:function(){var f,g,h,i,k,b=this,c=b.filestack,d=c.length,e={},j=b.filestack.length>0||!a.isEmptyObject(b.uploadExtraData);b.formdata=new FormData,0!==d&&j&&!b._abort(e)&&(k=function(){a.each(c,function(a){b.updateStack(a,void 0)}),b._clearFileInput()},f=function(c){b.lock();var d=b._getOutData(c);b.showPreview&&b._getThumbs().each(function(){var c=a(this),d=c.find(".kv-file-upload"),e=c.find(".kv-file-remove");c.hasClass("file-preview-success")||(b._setThumbStatus(c,"Loading"),p(c,"file-uploading")),d.attr("disabled",!0),e.attr("disabled",!0)}),b._raise("filebatchpreupload",[d]),b._abort(d)&&(c.abort(),b._setProgressCancelled())},g=function(c,d,e){var f=b._getOutData(e,c),g=b._getThumbs(":not(.file-preview-error)"),h=0,i=da(c)||da(c.errorkeys)?[]:c.errorkeys;da(c)||da(c.error)?(b._raise("filebatchuploadsuccess",[f]),k(),b.showPreview?(g.each(function(){var c=a(this),d=c.find(".kv-file-upload");c.find(".kv-file-upload").hide(),b._setThumbStatus(c,"Success"),c.removeClass("file-uploading"),d.removeAttr("disabled")}),b._initUploadSuccess(c)):b.reset()):(b.showPreview&&(g.each(function(){var c=a(this),d=c.find(".kv-file-remove"),e=c.find(".kv-file-upload");return c.removeClass("file-uploading"),e.removeAttr("disabled"),d.removeAttr("disabled"),0===i.length?void b._setPreviewError(c):(a.inArray(h,i)!==-1?b._setPreviewError(c):(c.find(".kv-file-upload").hide(),b._setThumbStatus(c,"Success"),b.updateStack(h,void 0)),void h++)}),b._initUploadSuccess(c)),b._showUploadError(c.error,f,"filebatchuploaderror"))},i=function(){b._setProgress(101),b.unlock(),b._initSuccessThumbs(),b._clearFileInput(),b._raise("filebatchuploadcomplete",[b.filestack,b._getExtraData()])},h=function(c,e,f){var g=b._getOutData(c),h=b._parseError(c,f);b._showUploadError(h,g,"filebatchuploaderror"),b.uploadFileCount=d-1,b.showPreview&&(b._getThumbs().each(function(){var c=a(this),d=c.attr("data-fileindex");c.removeClass("file-uploading"),void 0!==b.filestack[d]&&b._setPreviewError(c)}),b._getThumbs().removeClass("file-uploading"),b._getThumbs(" .kv-file-upload").removeAttr("disabled"),b._getThumbs(" .kv-file-delete").removeAttr("disabled"))},a.each(c,function(a,d){da(c[a])||b.formdata.append(b.uploadFileAttr,d,b.filenames[a])}),b._ajaxSubmit(f,g,i,h))},_uploadExtraOnly:function(){var c,d,e,f,a=this,b={};a.formdata=new FormData,a._abort(b)||(c=function(c){a.lock();var d=a._getOutData(c);a._raise("filebatchpreupload",[d]),a._setProgress(50),b.data=d,b.xhr=c,a._abort(b)&&(c.abort(),a._setProgressCancelled())},d=function(b,c,d){var e=a._getOutData(d,b);da(b)||da(b.error)?(a._raise("filebatchuploadsuccess",[e]),a._clearFileInput(),a._initUploadSuccess(b)):a._showUploadError(b.error,e,"filebatchuploaderror")},e=function(){a._setProgress(101),a.unlock(),a._clearFileInput(),a._raise("filebatchuploadcomplete",[a.filestack,a._getExtraData()])},f=function(c,d,e){var f=a._getOutData(c),g=a._parseError(c,e);b.data=f,a._showUploadError(g,f,"filebatchuploaderror")},a._ajaxSubmit(c,d,e,f))},_initFileActions:function(){var b=this;b.showPreview&&(b._initZoomButton(),b.$preview.find(".kv-file-remove").each(function(){var e,h,i,l,c=a(this),d=c.closest(".file-preview-frame"),f=d.attr("id"),g=d.attr("data-fileindex");j(c,"click",function(){return l=b._raise("filepreremove",[f,g]),!(l===!1||!b._validateMinCount())&&(e=d.hasClass("file-preview-error"),ja(d),void d.fadeOut("slow",function(){b.updateStack(g,void 0),b._clearObjects(d),d.remove(),f&&e&&b.$errorContainer.find('li[data-file-id="'+f+'"]').fadeOut("fast",function(){a(this).remove(),b._errorsExist()||b._resetErrors()}),b._clearFileInput();var c=b.getFileStack(!0),j=k.count(b.id),l=c.length,m=b.showPreview&&b.$preview.find(".file-preview-frame").length;0!==l||0!==j||m?(h=j+l,i=h>1?b._getMsgSelected(h):c[0]?b._getFileNames()[0]:"",b._setCaption(i)):b.reset(),b._raise("fileremoved",[f,g])}))})}),b.$preview.find(".kv-file-upload").each(function(){var c=a(this);j(c,"click",function(){var a=c.closest(".file-preview-frame"),d=a.attr("data-fileindex");a.hasClass("file-preview-error")||b._uploadSingle(d,b.filestack,!1)})}))},_hideFileIcon:function(){this.overwriteInitial&&this.$captionContainer.find(".kv-caption-icon").hide()},_showFileIcon:function(){this.$captionContainer.find(".kv-caption-icon").show()},_getSize:function(a){var b=this,c=parseFloat(a);if(!a||!c||isNaN(a)||isNaN(c))return b._getLayoutTemplate("size").replace("{sizeText}","0.00 KB");var d,f,g,e=b.fileSizeGetter;return"function"==typeof e?g=e(a):(d=Math.floor(Math.log(c)/Math.log(1024)),f=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],g=1*(c/Math.pow(1024,d)).toFixed(2)+" "+f[d]),b._getLayoutTemplate("size").replace("{sizeText}",g)},_generatePreviewTemplate:function(a,b,c,d,e,f,g,h,i,j){var m,n,k=this,l=k._getPreviewTemplate(a),o=h||"",p=fa(a,k.previewSettings,ba[a]),q=k.slug(c),r=i||k._renderFileFooter(q,g,p.width,f);return j=j||e.slice(e.lastIndexOf("-")+1),l=k._parseFilePreviewIcon(l,c),"text"===a||"html"===a?(n="text"===a?ha(b):b,m=l.replace(/\{previewId}/g,e).replace(/\{caption}/g,q).replace(/\{width}/g,p.width).replace(/\{height}/g,p.height).replace(/\{frameClass}/g,o).replace(/\{cat}/g,d).replace(/\{footer}/g,r).replace(/\{fileindex}/g,j).replace(/\{data}/g,n).replace(/\{template}/g,a)):m=l.replace(/\{previewId}/g,e).replace(/\{caption}/g,q).replace(/\{frameClass}/g,o).replace(/\{type}/g,d).replace(/\{fileindex}/g,j).replace(/\{width}/g,p.width).replace(/\{height}/g,p.height).replace(/\{footer}/g,r).replace(/\{data}/g,b).replace(/\{template}/g,a),m},_previewDefault:function(b,c,d){var e=this,f=e.$preview,h=f.find(".file-live-thumbs");if(e.showPreview){var k,i=b?b.name:"",j=b?b.type:"",l=d===!0&&!e.isUploadable,m=g.createObjectURL(b);e._clearDefaultPreview(),k=e._generatePreviewTemplate("other",m,i,j,c,l,b.size),h.length||(h=a(document.createElement("div")).addClass("file-live-thumbs").appendTo(f)),h.append("\n"+k),d===!0&&e.isUploadable&&e._setThumbStatus(a("#"+c),"Error")}},_previewFile:function(b,c,d,e,f){if(this.showPreview){var q,g=this,h=g._parseFileType(c),i=c?c.name:"",j=g.slug(i),k=g.allowedPreviewTypes,l=g.allowedPreviewMimeTypes,m=g.$preview,n=k&&k.indexOf(h)>=0,o=m.find(".file-live-thumbs"),p="text"===h||"html"===h||"image"===h?d.target.result:f,r=l&&l.indexOf(c.type)!==-1;o.length||(o=a(document.createElement("div")).addClass("file-live-thumbs").appendTo(m)),"html"===h&&g.purifyHtml&&window.DOMPurify&&(p=window.DOMPurify.sanitize(p)),n||r?(q=g._generatePreviewTemplate(h,p,i,c.type,e,!1,c.size),g._clearDefaultPreview(),o.append("\n"+q),g._validateImage(b,e,j,c.type)):g._previewDefault(c,e),g._initSortable()}},_slugDefault:function(a){return da(a)?"":String(a).replace(/[\-\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g,"_")},_readFiles:function(b){this.reader=new FileReader;var r,c=this,d=c.$element,e=c.$preview,f=c.reader,i=c.$previewContainer,j=c.$previewStatus,k=c.msgLoading,m=c.msgProgress,n=c.previewInitId,o=b.length,p=c.fileTypeSettings,q=c.filestack.length,s=c.maxFilePreviewSize&&parseFloat(c.maxFilePreviewSize),t=e.length&&(!s||isNaN(s)),u=function(d,e,f,g){var h=a.extend(!0,{},c._getOutData({},{},b),{id:f,index:g}),i={id:f,index:g,file:e,files:b};return c._previewDefault(e,f,!0),c.isUploadable&&(c.addToStack(void 0),setTimeout(function(){r(g+1)},100)),c._initFileActions(),c.removeFromPreviewOnError&&a("#"+f).remove(),c.isUploadable?c._showUploadError(d,h):c._showError(d,i)};c.loadedImages=[],c.totalImagesCount=0,a.each(b,function(a,b){var d=c.fileTypeSettings.image||ca.image;d&&d(b.type)&&c.totalImagesCount++}),r=function(a){if(da(d.attr("multiple"))&&(o=1),a>=o)return c.isUploadable&&c.filestack.length>0?c._raise("filebatchselected",[c.getFileStack()]):c._raise("filebatchselected",[b]),i.removeClass("file-thumb-loading"),void j.html("");var x,y,A,D,H,I,J,K,v=q+a,w=n+"-"+v,z=b[a],B=z.name?c.slug(z.name):"",C=(z.size||0)/1e3,E="",F=g.createObjectURL(z),G=0,L=c.allowedFileTypes,M=da(L)?"":L.join(", "),N=c.allowedFileExtensions,O=da(N)?"":N.join(", ");if(B===!1)return void r(a+1);if(0===B.length)return I=c.msgInvalidFileName.replace("{name}",ha(z.name)),void(c.isError=u(I,z,w,a));if(da(N)||(E=new RegExp("\\.("+N.join("|")+")$","i")),A=C.toFixed(2),c.maxFileSize>0&&C>c.maxFileSize)return I=c.msgSizeTooLarge.replace("{name}",B).replace("{size}",A).replace("{maxSize}",c.maxFileSize),void(c.isError=u(I,z,w,a));if(null!==c.minFileSize&&C<=l(c.minFileSize))return I=c.msgSizeTooSmall.replace("{name}",B).replace("{size}",A).replace("{minSize}",c.minFileSize),void(c.isError=u(I,z,w,a));if(!da(L)&&ea(L)){for(H=0;H<L.length;H+=1)J=L[H],D=p[J],K=void 0!==D&&D(z.type,B),G+=da(K)?0:K.length;if(0===G)return I=c.msgInvalidFileType.replace("{name}",B).replace("{types}",M),void(c.isError=u(I,z,w,a))}return 0!==G||da(N)||!ea(N)||da(E)||(K=h(B,E),G+=da(K)?0:K.length,0!==G)?c.showPreview?!t&&C>s?(c.addToStack(z),i.addClass("file-thumb-loading"),c._previewDefault(z,w),c._initFileActions(),c._updateFileDetails(o),void r(a+1)):(e.length&&void 0!==FileReader?(j.html(k.replace("{index}",a+1).replace("{files}",o)),i.addClass("file-thumb-loading"),f.onerror=function(a){c._errorHandler(a,B)},f.onload=function(b){c._previewFile(a,z,b,w,F),c._initFileActions()},f.onloadend=function(){I=m.replace("{index}",a+1).replace("{files}",o).replace("{percent}",50).replace("{name}",B),setTimeout(function(){j.html(I),c._updateFileDetails(o),r(a+1)},100),c._raise("fileloaded",[z,w,a,f])},f.onprogress=function(b){if(b.lengthComputable){var c=b.loaded/b.total*100,d=Math.ceil(c);I=m.replace("{index}",a+1).replace("{files}",o).replace("{percent}",d).replace("{name}",B),setTimeout(function(){j.html(I)},100)}},x=fa("text",p,ca.text),y=fa("image",p,ca.image),x(z.type,B)?f.readAsText(z,c.textEncoding):y(z.type,B)?f.readAsDataURL(z):f.readAsArrayBuffer(z)):(c._previewDefault(z,w),setTimeout(function(){r(a+1),c._updateFileDetails(o)},100),c._raise("fileloaded",[z,w,a,f])),void c.addToStack(z)):(c.addToStack(z),setTimeout(function(){r(a+1)},100),void c._raise("fileloaded",[z,w,a,f])):(I=c.msgInvalidFileExtension.replace("{name}",B).replace("{extensions}",O),void(c.isError=u(I,z,w,a)))},r(0),c._updateFileDetails(o,!1)},_updateFileDetails:function(a){var b=this,c=b.$element,d=b.getFileStack(),e=i(9)&&ka(c.val())||c[0].files[0]&&c[0].files[0].name||d.length&&d[0].name||"",f=b.slug(e),g=b.isUploadable?d.length:a,h=k.count(b.id)+g,j=g>1?b._getMsgSelected(h):f;b.isError?(b.$previewContainer.removeClass("file-thumb-loading"),b.$previewStatus.html(""),b.$captionContainer.find(".kv-caption-icon").hide()):b._showFileIcon(),b._setCaption(j,b.isError),b.$container.removeClass("file-input-new file-input-ajax-new"),1===arguments.length&&b._raise("fileselect",[a,f]),k.count(b.id)&&b._initPreviewActions()},_setThumbStatus:function(a,b){var c=this;if(c.showPreview){var d="indicator"+b,e=d+"Title",f="file-preview-"+b.toLowerCase(),g=a.find(".file-upload-indicator"),h=c.fileActionSettings;a.removeClass("file-preview-success file-preview-error file-preview-loading"),"Error"===b&&a.find(".kv-file-upload").attr("disabled",!0),"Success"===b&&(a.find(".file-drag-handle").remove(),g.css("margin-left",0)),g.html(h[d]),g.attr("title",h[e]),a.addClass(f)}},_setProgressCancelled:function(){var a=this;a._setProgress(101,a.$progress,a.msgCancelled)},_setProgress:function(a,b,c){var d=this,e=Math.min(a,100),f=e<100?d.progressTemplate:c?d.progressErrorTemplate:a<=100?d.progressTemplate:d.progressCompleteTemplate,g=d.progressUploadThreshold;if(b=b||d.$progress,!da(f)){if(g&&e>g&&a<=100){var h=f.replace("{percent}",g).replace("{percent}",g).replace("{percent}%",d.msgUploadThreshold);b.html(h)}else b.html(f.replace(/\{percent}/g,e));c&&b.find('[role="progressbar"]').html(c)}},_setFileDropZoneTitle:function(){var d,a=this,b=a.$container.find(".file-drop-zone"),c=a.dropZoneTitle;a.isClickable&&(d=da(a.$element.attr("multiple"))?a.fileSingle:a.filePlural,c+=a.dropZoneClickTitle.replace("{files}",d)),b.find("."+a.dropZoneTitleClass).remove(),a.isUploadable&&a.showPreview&&0!==b.length&&!(a.getFileStack().length>0)&&a.dropZoneEnabled&&(0===b.find(".file-preview-frame").length&&da(a.defaultPreviewContent)&&b.prepend('<div class="'+a.dropZoneTitleClass+'">'+c+"</div>"),a.$container.removeClass("file-input-new"),p(a.$container,"file-input-ajax-new"))},_setAsyncUploadStatus:function(b,c,d){var e=this,f=0;e._setProgress(c,a("#"+b).find(".file-thumb-progress")),e.uploadStatus[b]=c,a.each(e.uploadStatus,function(a,b){f+=b}),e._setProgress(Math.floor(f/d))},_validateMinCount:function(){var a=this,b=a.isUploadable?a.getFileStack().length:a.$element.get(0).files.length;return!(a.validateInitialCount&&a.minFileCount>0&&a._getFileCount(b-1)<a.minFileCount)||(a._noFilesError({}),!1)},_getFileCount:function(a){var b=this,c=0;return b.validateInitialCount&&!b.overwriteInitial&&(c=k.count(b.id),a+=c),a},_getFileName:function(a){return a&&a.name?this.slug(a.name):void 0},_getFileNames:function(a){var b=this;return b.filenames.filter(function(b){return a?void 0!==b:void 0!==b&&null!==b})},_setPreviewError:function(a,b,c){var d=this;void 0!==b&&d.updateStack(b,c),d.removeFromPreviewOnError?a.remove():d._setThumbStatus(a,"Error")},_checkDimensions:function(a,b,c,d,e,f,g){var i,j,m,n,h=this,k="Small"===b?"min":"max",l=h[k+"Image"+f];!da(l)&&c.length&&(m=c[0],j="Width"===f?m.naturalWidth||m.width:m.naturalHeight||m.height,n="Small"===b?j>=l:j<=l,n||(i=h["msgImage"+f+b].replace("{name}",e).replace("{size}",l),h._showUploadError(i,g),h._setPreviewError(d,a,null)))},_validateImage:function(a,b,c,d){var h,i,k,e=this,f=e.$preview,l=f.find("#"+b),m=l.find("img");c=c||"Untitled",m.length&&j(m,"load",function(){i=l.width(),k=f.width(),i>k&&(m.css("width","100%"),l.css("width","97%")),h={ind:a,id:b},e._checkDimensions(a,"Small",m,l,c,"Width",h),e._checkDimensions(a,"Small",m,l,c,"Height",h),e.resizeImage||(e._checkDimensions(a,"Large",m,l,c,"Width",h),e._checkDimensions(a,"Large",m,l,c,"Height",h)),e._raise("fileimageloaded",[b]),e.loadedImages.push({ind:a,img:m,thumb:l,pid:b,typ:d}),e._validateAllImages(),g.revokeObjectURL(m.attr("src"))})},_validateAllImages:function(){var b,c,d,e,f,g,i,a=this,h={};if(a.loadedImages.length===a.totalImagesCount&&(a._raise("fileimagesloaded"),a.resizeImage)){i=a.isUploadable?a._showUploadError:a._showError;var j={val:0};for(b=0;b<a.loadedImages.length;b++)c=a.loadedImages[b],d=c.img,e=c.thumb,f=c.pid,g=c.ind,h={id:f,index:g},a._getResizedImage(d[0],c.typ,f,g,j,a.loadedImages.length)||(i(a.msgImageResizeError,h,"fileimageresizeerror"),a._setPreviewError(e,g))}},_getResizedImage:function(a,b,c,d,e,f){var n,o,g=this,h=a.naturalWidth,i=a.naturalHeight,j=1,k=g.maxImageWidth||h,l=g.maxImageHeight||i,m=h&&i,p=g.imageCanvas,q=g.imageCanvasContext;if(!m)return e.val++,e.val===f&&g._raise("fileimagesresized"),!1;if(h===k&&i===l)return g._raise("fileimageresized",[c,d]),e.val++,e.val===f&&g._raise("fileimagesresized"),!0;b=b||g.resizeDefaultImageType,n=h>k,o=i>l,j="width"===g.resizePreference?n?k/h:o?l/i:1:o?l/i:n?k/h:1,g._resetCanvas(),h*=j,i*=j,p.width=h,p.height=i;try{return q.drawImage(a,0,0,h,i),p.toBlob(function(a){g.filestack[d]=a,g._raise("fileimageresized",[c,d]),e.val++,e.val===f&&g._raise("fileimagesresized",[void 0,void 0])},b,g.resizeQuality),!0}catch(a){return e.val++,e.val===f&&g._raise("fileimagesresized",[void 0,void 0]),!1}},_initBrowse:function(a){var b=this;b.showBrowse?(b.$btnFile=a.find(".btn-file"),b.$btnFile.append(b.$element)):b.$element.hide()},_initCaption:function(){var a=this,b=a.initialCaption||"";return a.overwriteInitial||da(b)?(a.$caption.html(""),!1):(a._setCaption(b),!0)},_setCaption:function(b,c){var e,f,g,h,d=this,i=d.getFileStack();if(d.$caption.length){if(c)e=a("<div>"+d.msgValidationError+"</div>").text(),g=i.length,h=g?1===g&&i[0]?d._getFileNames()[0]:d._getMsgSelected(g):d._getMsgSelected(d.msgNo),f='<span class="'+d.msgValidationErrorClass+'">'+d.msgValidationErrorIcon+(da(b)?h:b)+"</span>";else{if(da(b))return;e=a("<div>"+b+"</div>").text(),f=d._getLayoutTemplate("fileIcon")+e}d.$caption.html(f),d.$caption.attr("title",e),d.$captionContainer.find(".file-caption-ellipsis").attr("title",e)}},_createContainer:function(){var b=this,c=a(document.createElement("div")).attr({class:"file-input file-input-new"}).html(b._renderMain());return b.$element.before(c),b._initBrowse(c),b.theme&&c.addClass("theme-"+b.theme),c},_refreshContainer:function(){var a=this,b=a.$container;b.before(a.$element),b.html(a._renderMain()),a._initBrowse(b)},_renderMain:function(){var a=this,b=a.isUploadable&&a.dropZoneEnabled?" file-drop-zone":"file-drop-disabled",c=a.showClose?a._getLayoutTemplate("close"):"",d=a.showPreview?a._getLayoutTemplate("preview").replace(/\{class}/g,a.previewClass).replace(/\{dropClass}/g,b):"",e=a.isDisabled?a.captionClass+" file-caption-disabled":a.captionClass,f=a.captionTemplate.replace(/\{class}/g,e+" kv-fileinput-caption");return a.mainTemplate.replace(/\{class}/g,a.mainClass+(!a.showBrowse&&a.showCaption?" no-browse":"")).replace(/\{preview}/g,d).replace(/\{close}/g,c).replace(/\{caption}/g,f).replace(/\{upload}/g,a._renderButton("upload")).replace(/\{remove}/g,a._renderButton("remove")).replace(/\{cancel}/g,a._renderButton("cancel")).replace(/\{browse}/g,a._renderButton("browse"))},_renderButton:function(a){var b=this,c=b._getLayoutTemplate("btnDefault"),d=b[a+"Class"],e=b[a+"Title"],f=b[a+"Icon"],g=b[a+"Label"],h=b.isDisabled?" disabled":"",i="button";switch(a){case"remove":if(!b.showRemove)return"";break;case"cancel":if(!b.showCancel)return"";d+=" hide";break;case"upload":if(!b.showUpload)return"";b.isUploadable&&!b.isDisabled?c=b._getLayoutTemplate("btnLink").replace("{href}",b.uploadUrl):i="submit";break;case"browse":if(!b.showBrowse)return"";c=b._getLayoutTemplate("btnBrowse");break;default:return""}return d+="browse"===a?" btn-file":" fileinput-"+a+" fileinput-"+a+"-button",da(g)||(g=' <span class="'+b.buttonLabelClass+'">'+g+"</span>"),c.replace("{type}",i).replace("{css}",d).replace("{title}",e).replace("{status}",h).replace("{icon}",f).replace("{label}",g)},_renderThumbProgress:function(){return'<div class="file-thumb-progress hide">'+this.progressTemplate.replace(/\{percent}/g,"0")+"</div>"},_renderFileFooter:function(a,b,c,d){var k,e=this,f=e.fileActionSettings,g=f.showRemove,h=f.showDrag,i=f.showUpload,j=f.showZoom,l=e._getLayoutTemplate("footer"),m=d?f.indicatorError:f.indicatorNew,n=d?f.indicatorErrorTitle:f.indicatorNewTitle;return b=e._getSize(b),k=e.isUploadable?l.replace(/\{actions}/g,e._renderFileActions(i,g,j,h,!1,!1,!1)).replace(/\{caption}/g,a).replace(/\{size}/g,b).replace(/\{width}/g,c).replace(/\{progress}/g,e._renderThumbProgress()).replace(/\{indicator}/g,m).replace(/\{indicatorTitle}/g,n):l.replace(/\{actions}/g,e._renderFileActions(!1,!1,j,h,!1,!1,!1)).replace(/\{caption}/g,a).replace(/\{size}/g,b).replace(/\{width}/g,c).replace(/\{progress}/g,"").replace(/\{indicator}/g,m).replace(/\{indicatorTitle}/g,n),k=ia(k,e.previewThumbTags)},_renderFileActions:function(a,b,c,d,e,f,g,h){if(!(a||b||c||d))return"";var p,i=this,j=f===!1?"":' data-url="'+f+'"',k=g===!1?"":' data-key="'+g+'"',l="",m="",n="",o="",q=i._getLayoutTemplate("actions"),r=i.fileActionSettings,s=i.otherActionButtons.replace(/\{dataKey}/g,k),t=e?r.removeClass+" disabled":r.removeClass;return b&&(l=i._getLayoutTemplate("actionDelete").replace(/\{removeClass}/g,t).replace(/\{removeIcon}/g,r.removeIcon).replace(/\{removeTitle}/g,r.removeTitle).replace(/\{dataUrl}/g,j).replace(/\{dataKey}/g,k)),a&&(m=i._getLayoutTemplate("actionUpload").replace(/\{uploadClass}/g,r.uploadClass).replace(/\{uploadIcon}/g,r.uploadIcon).replace(/\{uploadTitle}/g,r.uploadTitle)),c&&(n=i._getLayoutTemplate("actionZoom").replace(/\{zoomClass}/g,r.zoomClass).replace(/\{zoomIcon}/g,r.zoomIcon).replace(/\{zoomTitle}/g,r.zoomTitle)),d&&h&&(p="drag-handle-init "+r.dragClass,o=i._getLayoutTemplate("actionDrag").replace(/\{dragClass}/g,p).replace(/\{dragTitle}/g,r.dragTitle).replace(/\{dragIcon}/g,r.dragIcon)),q.replace(/\{delete}/g,l).replace(/\{upload}/g,m).replace(/\{zoom}/g,n).replace(/\{drag}/g,o).replace(/\{other}/g,s)},_browse:function(a){var b=this;b._raise("filebrowse"),a&&a.isDefaultPrevented()||(b.isError&&!b.isUploadable&&b.clear(),b.$captionContainer.focus())},_change:function(b){var c=this,d=c.$element;if(!c.isUploadable&&da(d.val())&&c.fileInputCleared)return void(c.fileInputCleared=!1);c.fileInputCleared=!1;var e,f,g,l,m,n,h=arguments.length>1,i=c.isUploadable,j=0,o=h?b.originalEvent.dataTransfer.files:d.get(0).files,p=c.filestack.length,q=da(d.attr("multiple")),r=q&&p>0,s=0,t=function(b,d,e,f){var g=a.extend(!0,{},c._getOutData({},{},o),{id:e,index:f}),h={id:e,index:f,file:d,files:o};return c.isUploadable?c._showUploadError(b,g):c._showError(b,h)};if(c.reader=null,c._resetUpload(),c._hideFileIcon(),c.isUploadable&&c.$container.find(".file-drop-zone ."+c.dropZoneTitleClass).remove(),h)for(e=[];o[j];)l=o[j],l.type||l.size%4096!==0?e.push(l):s++,j++;else e=void 0===b.target.files?b.target&&b.target.value?[{name:b.target.value.replace(/^.+\\/,"")}]:[]:b.target.files;if(da(e)||0===e.length)return i||c.clear(),c._showFolderError(s),void c._raise("fileselectnone");if(c._resetErrors(),n=e.length,g=c._getFileCount(c.isUploadable?c.getFileStack().length+n:n),c.maxFileCount>0&&g>c.maxFileCount){if(!c.autoReplace||n>c.maxFileCount)return m=c.autoReplace&&n>c.maxFileCount?n:g,f=c.msgFilesTooMany.replace("{m}",c.maxFileCount).replace("{n}",m),c.isError=t(f,null,null,null),c.$captionContainer.find(".kv-caption-icon").hide(),c._setCaption("",!0),void c.$container.removeClass("file-input-new file-input-ajax-new");g>c.maxFileCount&&c._resetPreviewThumbs(i)}else!i||r?(c._resetPreviewThumbs(!1),r&&c.clearStack()):!i||0!==p||k.count(c.id)&&!c.overwriteInitial||c._resetPreviewThumbs(!0);c.isPreviewable?c._readFiles(e):c._updateFileDetails(1),c._showFolderError(s)},_abort:function(b){var d,c=this;return!(!c.ajaxAborted||"object"!=typeof c.ajaxAborted||void 0===c.ajaxAborted.message)&&(d=a.extend(!0,{},c._getOutData(),b),d.abortData=c.ajaxAborted.data||{},d.abortMessage=c.ajaxAborted.message,c.cancel(),c._setProgress(101,c.$progress,c.msgCancelled),c._showUploadError(c.ajaxAborted.message,d,"filecustomerror"),!0)},_resetFileStack:function(){var b=this,c=0,d=[],e=[];b._getThumbs().each(function(){var f=a(this),g=f.attr("data-fileindex"),h=b.filestack[g];g!==-1&&(void 0!==h?(d[c]=h,e[c]=b._getFileName(h),f.attr({id:b.previewInitId+"-"+c,"data-fileindex":c}),c++):f.attr({id:"uploaded-"+ga(),"data-fileindex":"-1"}))}),b.filestack=d,b.filenames=e},clearStack:function(){var a=this;return a.filestack=[],a.filenames=[],a.$element},updateStack:function(a,b){var c=this;return c.filestack[a]=b,c.filenames[a]=c._getFileName(b),c.$element},addToStack:function(a){var b=this;return b.filestack.push(a),b.filenames.push(b._getFileName(a)),b.$element},getFileStack:function(a){var b=this;return b.filestack.filter(function(b){return a?void 0!==b:void 0!==b&&null!==b})},getFilesCount:function(){var a=this,b=a.isUploadable?a.getFileStack().length:a.$element.get(0).files.length;return a._getFileCount(b)},lock:function(){var a=this;return a._resetErrors(),a.disable(),a.showRemove&&p(a.$container.find(".fileinput-remove"),"hide"),a.showCancel&&a.$container.find(".fileinput-cancel").removeClass("hide"),a._raise("filelock",[a.filestack,a._getExtraData()]),a.$element},unlock:function(a){var b=this;return void 0===a&&(a=!0),b.enable(),b.showCancel&&p(b.$container.find(".fileinput-cancel"),"hide"),b.showRemove&&b.$container.find(".fileinput-remove").removeClass("hide"),a&&b._resetFileStack(),b._raise("fileunlock",[b.filestack,b._getExtraData()]),b.$element},cancel:function(){var e,b=this,c=b.ajaxRequests,d=c.length;if(d>0)for(e=0;e<d;e+=1)b.cancelling=!0,c[e].abort();return b._setProgressCancelled(),b._getThumbs().each(function(){var c=a(this),d=c.attr("data-fileindex");c.removeClass("file-uploading"),void 0!==b.filestack[d]&&(c.find(".kv-file-upload").removeClass("disabled").removeAttr("disabled"),c.find(".kv-file-remove").removeClass("disabled").removeAttr("disabled")), | |
| 12 | + b.unlock()}),b.$element},clear:function(){var c,b=this;return b.$btnUpload.removeAttr("disabled"),b._getThumbs().find("video,audio,img").each(function(){ja(a(this))}),b._resetUpload(),b.clearStack(),b._clearFileInput(),b._resetErrors(!0),b._raise("fileclear"),b._hasInitialPreview()?(b._showFileIcon(),b._resetPreview(),b._initPreviewActions(),b.$container.removeClass("file-input-new")):(b._getThumbs().each(function(){b._clearObjects(a(this))}),b.isUploadable&&(k.data[b.id]={}),b.$preview.html(""),c=!b.overwriteInitial&&b.initialCaption.length>0?b.initialCaption:"",b.$caption.html(c),b.$caption.attr("title",""),p(b.$container,"file-input-new"),b._validateDefaultPreview()),0===b.$container.find(".file-preview-frame").length&&(b._initCaption()||b.$captionContainer.find(".kv-caption-icon").hide()),b._hideFileIcon(),b._raise("filecleared"),b.$captionContainer.focus(),b._setFileDropZoneTitle(),b.$element},reset:function(){var a=this;return a._resetPreview(),a.$container.find(".fileinput-filename").text(""),a._raise("filereset"),p(a.$container,"file-input-new"),(a.$preview.find(".file-preview-frame").length||a.isUploadable&&a.dropZoneEnabled)&&a.$container.removeClass("file-input-new"),a._setFileDropZoneTitle(),a.clearStack(),a.formdata={},a.$element},disable:function(){var a=this;return a.isDisabled=!0,a._raise("filedisabled"),a.$element.attr("disabled","disabled"),a.$container.find(".kv-fileinput-caption").addClass("file-caption-disabled"),a.$container.find(".btn-file, .fileinput-remove, .fileinput-upload, .file-preview-frame button").attr("disabled",!0),a._initDragDrop(),a.$element},enable:function(){var a=this;return a.isDisabled=!1,a._raise("fileenabled"),a.$element.removeAttr("disabled"),a.$container.find(".kv-fileinput-caption").removeClass("file-caption-disabled"),a.$container.find(".btn-file, .fileinput-remove, .fileinput-upload, .file-preview-frame button").removeAttr("disabled"),a._initDragDrop(),a.$element},upload:function(){var e,f,g,b=this,c=b.getFileStack().length,d={},h=!a.isEmptyObject(b._getExtraData());if(b.minFileCount>0&&b._getFileCount(c)<b.minFileCount)return void b._noFilesError(d);if(b.isUploadable&&!b.isDisabled&&(0!==c||h)){if(b._resetUpload(),b.$progress.removeClass("hide"),b.uploadCount=0,b.uploadStatus={},b.uploadLog=[],b.lock(),b._setProgress(2),0===c&&h)return void b._uploadExtraOnly();if(g=b.filestack.length,b.hasInitData=!1,!b.uploadAsync)return b._uploadBatch(),b.$element;for(f=b._getOutData(),b._raise("filebatchpreupload",[f]),b.fileBatchCompleted=!1,b.uploadCache={content:[],config:[],tags:[],append:!0},b.uploadAsyncCount=b.getFileStack().length,e=0;e<g;e++)b.uploadCache.content[e]=null,b.uploadCache.config[e]=null,b.uploadCache.tags[e]=null;for(e=0;e<g;e++)void 0!==b.filestack[e]&&b._uploadSingle(e,b.filestack,!0)}},destroy:function(){var a=this,c=a.$container;return c.find(".file-drop-zone").off(),a.$element.insertBefore(c).off(b).removeData(),c.off().remove(),a.$element},refresh:function(b){var c=this,d=c.$element;return b=b?a.extend(!0,{},c.options,b):c.options,c.destroy(),d.fileinput(b),d.val()&&d.trigger("change.fileinput"),d}},a.fn.fileinput=function(b){if(m()||i(9)){var c=Array.apply(null,arguments),d=[];switch(c.shift(),this.each(function(){var l,e=a(this),f=e.data("fileinput"),g="object"==typeof b&&b,h=g.theme||e.data("theme"),i={},j={},k=g.language||e.data("language")||"en";f||(h&&(j=a.fn.fileinputThemes[h]||{}),"en"===k||da(a.fn.fileinputLocales[k])||(i=a.fn.fileinputLocales[k]||{}),l=a.extend(!0,{},a.fn.fileinput.defaults,j,a.fn.fileinputLocales.en,i,g,e.data()),f=new oa(this,l),e.data("fileinput",f)),"string"==typeof b&&d.push(f[b].apply(f,c))}),d.length){case 0:return this;case 1:return d[0];default:return d}}},a.fn.fileinput.defaults={language:"en",showCaption:!0,showBrowse:!0,showPreview:!0,showRemove:!0,showUpload:!0,showCancel:!0,showClose:!0,showUploadedThumbs:!0,browseOnZoneClick:!1,autoReplace:!1,previewClass:"",captionClass:"",mainClass:"file-caption-main",mainTemplate:null,purifyHtml:!0,fileSizeGetter:null,initialCaption:"",initialPreview:[],initialPreviewDelimiter:"*$$*",initialPreviewAsData:!1,initialPreviewFileType:"image",initialPreviewConfig:[],initialPreviewThumbTags:[],previewThumbTags:{},initialPreviewShowDelete:!0,removeFromPreviewOnError:!1,deleteUrl:"",deleteExtraData:{},overwriteInitial:!0,layoutTemplates:Y,previewTemplates:Z,previewZoomSettings:$,previewZoomButtonIcons:{prev:'<i class="glyphicon glyphicon-triangle-left"></i>',next:'<i class="glyphicon glyphicon-triangle-right"></i>',toggleheader:'<i class="glyphicon glyphicon-resize-vertical"></i>',fullscreen:'<i class="glyphicon glyphicon-fullscreen"></i>',borderless:'<i class="glyphicon glyphicon-resize-full"></i>',close:'<i class="glyphicon glyphicon-remove"></i>'},previewZoomButtonClasses:{prev:"btn btn-navigate",next:"btn btn-navigate",toggleheader:"btn btn-default btn-header-toggle",fullscreen:"btn btn-default",borderless:"btn btn-default",close:"btn btn-default"},allowedPreviewTypes:_,allowedPreviewMimeTypes:null,allowedFileTypes:null,allowedFileExtensions:null,defaultPreviewContent:null,customLayoutTags:{},customPreviewTags:{},previewSettings:ba,fileTypeSettings:ca,previewFileIcon:'<i class="glyphicon glyphicon-file"></i>',previewFileIconClass:"file-other-icon",previewFileIconSettings:{},previewFileExtSettings:{},buttonLabelClass:"hidden-xs",browseIcon:'<i class="glyphicon glyphicon-folder-open"></i> ',browseClass:"btn btn-primary",removeIcon:'<i class="glyphicon glyphicon-trash"></i>',removeClass:"btn btn-default",cancelIcon:'<i class="glyphicon glyphicon-ban-circle"></i>',cancelClass:"btn btn-default",uploadIcon:'<i class="glyphicon glyphicon-upload"></i>',uploadClass:"btn btn-default",uploadUrl:null,uploadAsync:!0,uploadExtraData:{},zoomModalHeight:480,minImageWidth:null,minImageHeight:null,maxImageWidth:null,maxImageHeight:null,resizeImage:!1,resizePreference:"width",resizeQuality:.92,resizeDefaultImageType:"image/jpeg",minFileSize:0,maxFileSize:0,maxFilePreviewSize:25600,minFileCount:0,maxFileCount:0,validateInitialCount:!1,msgValidationErrorClass:"text-danger",msgValidationErrorIcon:'<i class="glyphicon glyphicon-exclamation-sign"></i> ',msgErrorClass:"file-error-message",progressThumbClass:"progress-bar progress-bar-success progress-bar-striped active",progressClass:"progress-bar progress-bar-success progress-bar-striped active",progressCompleteClass:"progress-bar progress-bar-success",progressErrorClass:"progress-bar progress-bar-danger",progressUploadThreshold:99,previewFileType:"image",elCaptionContainer:null,elCaptionText:null,elPreviewContainer:null,elPreviewImage:null,elPreviewStatus:null,elErrorContainer:null,errorCloseButton:'<span class="close kv-error-close">×</span>',slugCallback:null,dropZoneEnabled:!0,dropZoneTitleClass:"file-drop-zone-title",fileActionSettings:{},otherActionButtons:"",textEncoding:"UTF-8",ajaxSettings:{},ajaxDeleteSettings:{},showAjaxErrorDetails:!0},a.fn.fileinputLocales.en={fileSingle:"file",filePlural:"files",browseLabel:"Browse …",removeLabel:"Remove",removeTitle:"Clear selected files",cancelLabel:"Cancel",cancelTitle:"Abort ongoing upload",uploadLabel:"Upload",uploadTitle:"Upload selected files",msgNo:"No",msgNoFilesSelected:"No files selected",msgCancelled:"Cancelled",msgZoomModalHeading:"Detailed Preview",msgSizeTooSmall:'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',msgSizeTooLarge:'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.',msgFilesTooLess:"You must select at least <b>{n}</b> {files} to upload.",msgFilesTooMany:"Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.",msgFileNotFound:'File "{name}" not found!',msgFileSecured:'Security restrictions prevent reading the file "{name}".',msgFileNotReadable:'File "{name}" is not readable.',msgFilePreviewAborted:'File preview aborted for "{name}".',msgFilePreviewError:'An error occurred while reading the file "{name}".',msgInvalidFileName:'Invalid or unsupported characters in file name "{name}".',msgInvalidFileType:'Invalid type for file "{name}". Only "{types}" files are supported.',msgInvalidFileExtension:'Invalid extension for file "{name}". Only "{extensions}" files are supported.',msgUploadAborted:"The file upload was aborted",msgUploadThreshold:"Processing...",msgValidationError:"Validation Error",msgLoading:"Loading file {index} of {files} …",msgProgress:"Loading file {index} of {files} - {name} - {percent}% completed.",msgSelected:"{n} {files} selected",msgFoldersNotAllowed:"Drag & drop files only! {n} folder(s) dropped were skipped.",msgImageWidthSmall:'Width of image file "{name}" must be at least {size} px.',msgImageHeightSmall:'Height of image file "{name}" must be at least {size} px.',msgImageWidthLarge:'Width of image file "{name}" cannot exceed {size} px.',msgImageHeightLarge:'Height of image file "{name}" cannot exceed {size} px.',msgImageResizeError:"Could not get the image dimensions to resize.",msgImageResizeException:"Error while resizing the image.<pre>{errors}</pre>",dropZoneTitle:"Drag & drop files here …",dropZoneClickTitle:"<br>(or click to select {files})",previewZoomButtonTitles:{prev:"View previous file",next:"View next file",toggleheader:"Toggle header",fullscreen:"Toggle full screen",borderless:"Toggle borderless mode",close:"Close detailed preview"}},a.fn.fileinput.Constructor=oa,a(document).ready(function(){var b=a("input.file[type=file]");b.length&&b.fileinput()})}); | |
| 0 | 13 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/fileinput/fileinput_locale_zh.js
0 → 100644
| 1 | +/*! | |
| 2 | + * FileInput Chinese Translations | |
| 3 | + * | |
| 4 | + * This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or | |
| 5 | + * any HTML markup tags in the messages must not be converted or translated. | |
| 6 | + * | |
| 7 | + * @see http://github.com/kartik-v/bootstrap-fileinput | |
| 8 | + * @author kangqf <kangqingfei@gmail.com> | |
| 9 | + * | |
| 10 | + * NOTE: this file must be saved in UTF-8 encoding. | |
| 11 | + */ | |
| 12 | +(function ($) { | |
| 13 | + "use strict"; | |
| 14 | + | |
| 15 | + $.fn.fileinputLocales['zh'] = { | |
| 16 | + fileSingle: '文件', | |
| 17 | + filePlural: '个文件', | |
| 18 | + browseLabel: '打开 …', | |
| 19 | + removeLabel: '移除', | |
| 20 | + removeTitle: '清除选中文件', | |
| 21 | + cancelLabel: '取消', | |
| 22 | + cancelTitle: '取消进行中的上传', | |
| 23 | + uploadLabel: '上传', | |
| 24 | + uploadTitle: '上传选中文件', | |
| 25 | + msgNo: '没有', | |
| 26 | + msgNoFilesSelected: '', | |
| 27 | + msgCancelled: '取消', | |
| 28 | + msgZoomModalHeading: '详细预览', | |
| 29 | + msgSizeTooSmall: 'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.', | |
| 30 | + msgSizeTooLarge: '文件 "{name}" (<b>{size} KB</b>) 超过了允许大小 <b>{maxSize} KB</b>.', | |
| 31 | + msgFilesTooLess: '你必须选择最少 <b>{n}</b> {files} 来上传. ', | |
| 32 | + msgFilesTooMany: '选择的上传文件个数 <b>({n})</b> 超出最大文件的限制个数 <b>{m}</b>.', | |
| 33 | + msgFileNotFound: '文件 "{name}" 未找到!', | |
| 34 | + msgFileSecured: '安全限制,为了防止读取文件 "{name}".', | |
| 35 | + msgFileNotReadable: '文件 "{name}" 不可读.', | |
| 36 | + msgFilePreviewAborted: '取消 "{name}" 的预览.', | |
| 37 | + msgFilePreviewError: '读取 "{name}" 时出现了一个错误.', | |
| 38 | + msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', | |
| 39 | + msgInvalidFileType: '不正确的类型 "{name}". 只支持 "{types}" 类型的文件.', | |
| 40 | + msgInvalidFileExtension: '不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.', | |
| 41 | + msgUploadAborted: '该文件上传被中止', | |
| 42 | + msgUploadThreshold: 'Processing...', | |
| 43 | + msgValidationError: '验证错误', | |
| 44 | + msgLoading: '加载第 {index} 文件 共 {files} …', | |
| 45 | + msgProgress: '加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.', | |
| 46 | + msgSelected: '{n} {files} 选中', | |
| 47 | + msgFoldersNotAllowed: '只支持拖拽文件! 跳过 {n} 拖拽的文件夹.', | |
| 48 | + msgImageWidthSmall: '宽度的图像文件的"{name}"的必须是至少{size}像素.', | |
| 49 | + msgImageHeightSmall: '图像文件的"{name}"的高度必须至少为{size}像素.', | |
| 50 | + msgImageWidthLarge: '宽度的图像文件"{name}"不能超过{size}像素.', | |
| 51 | + msgImageHeightLarge: '图像文件"{name}"的高度不能超过{size}像素.', | |
| 52 | + msgImageResizeError: '无法获取的图像尺寸调整。', | |
| 53 | + msgImageResizeException: '错误而调整图像大小。<pre>{errors}</pre>', | |
| 54 | + dropZoneTitle: '拖拽文件到这里 …<br>支持多文件同时上传', | |
| 55 | + dropZoneClickTitle: '<br>(或点击{files}按钮选择文件)', | |
| 56 | + fileActionSettings: { | |
| 57 | + removeTitle: '删除文件', | |
| 58 | + uploadTitle: '上传文件', | |
| 59 | + zoomTitle: '查看详情', | |
| 60 | + dragTitle: '移动 / 重置', | |
| 61 | + indicatorNewTitle: '没有上传', | |
| 62 | + indicatorSuccessTitle: '上传', | |
| 63 | + indicatorErrorTitle: '上传错误', | |
| 64 | + indicatorLoadingTitle: '上传 ...' | |
| 65 | + }, | |
| 66 | + previewZoomButtonTitles: { | |
| 67 | + prev: '预览上一个文件', | |
| 68 | + next: '预览下一个文件', | |
| 69 | + toggleheader: '缩放', | |
| 70 | + fullscreen: '全屏', | |
| 71 | + borderless: '无边界模式', | |
| 72 | + close: '关闭当前预览' | |
| 73 | + } | |
| 74 | + }; | |
| 75 | +})(window.jQuery); | |
| 0 | 76 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/fileinput/img/loading-sm.gif
0 → 100644
2.61 KB
src/main/resources/static/assets/plugins/fileinput/img/loading.gif
0 → 100644
847 Bytes
src/main/resources/static/assets/plugins/fileinput/purify.min.js
0 → 100644
| 1 | +(function(e){"use strict";var t=typeof window==="undefined"?null:window;if(typeof define==="function"&&define.amd){define(function(){return e(t)})}else if(typeof module!=="undefined"){module.exports=e(t)}else{t.DOMPurify=e(t)}})(function e(t){"use strict";var r=function(t){return e(t)};r.version="0.7.4";if(!t||!t.document||t.document.nodeType!==9){r.isSupported=false;return r}var n=t.document;var a=n;var i=t.DocumentFragment;var o=t.HTMLTemplateElement;var l=t.NodeFilter;var s=t.NamedNodeMap||t.MozNamedAttrMap;var f=t.Text;var c=t.Comment;var u=t.DOMParser;if(typeof o==="function"){var d=n.createElement("template");if(d.content&&d.content.ownerDocument){n=d.content.ownerDocument}}var m=n.implementation;var p=n.createNodeIterator;var h=n.getElementsByTagName;var v=n.createDocumentFragment;var g=a.importNode;var y={};r.isSupported=typeof m.createHTMLDocument!=="undefined"&&n.documentMode!==9;var b=function(e,t){var r=t.length;while(r--){if(typeof t[r]==="string"){t[r]=t[r].toLowerCase()}e[t[r]]=true}return e};var T=function(e){var t={};var r;for(r in e){if(e.hasOwnProperty(r)){t[r]=e[r]}}return t};var x=null;var k=b({},["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr","svg","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","switch","symbol","text","textpath","title","tref","tspan","view","vkern","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmuliscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mpspace","msqrt","mystyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","#text"]);var A=null;var w=b({},["accept","action","align","alt","autocomplete","background","bgcolor","border","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","coords","datetime","default","dir","disabled","download","enctype","face","for","headers","height","hidden","high","href","hreflang","id","ismap","label","lang","list","loop","low","max","maxlength","media","method","min","multiple","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","rows","rowspan","spellcheck","scope","selected","shape","size","span","srclang","start","src","step","style","summary","tabindex","title","type","usemap","valign","value","width","xmlns","accent-height","accumulate","additivive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mode","min","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","surfacescale","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","u1","u2","unicode","values","viewbox","visibility","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","y","y1","y2","z","zoomandpan","accent","accentunder","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","display","displaystyle","fence","frame","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]);var E=null;var S=null;var M=true;var O=false;var L=false;var D=false;var N=/\{\{[\s\S]*|[\s\S]*\}\}/gm;var _=/<%[\s\S]*|[\s\S]*%>/gm;var C=false;var z=false;var R=false;var F=false;var H=true;var B=true;var W=b({},["audio","head","math","script","style","svg","video"]);var j=b({},["audio","video","img","source"]);var G=b({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]);var I=null;var q=n.createElement("form");var P=function(e){if(typeof e!=="object"){e={}}x="ALLOWED_TAGS"in e?b({},e.ALLOWED_TAGS):k;A="ALLOWED_ATTR"in e?b({},e.ALLOWED_ATTR):w;E="FORBID_TAGS"in e?b({},e.FORBID_TAGS):{};S="FORBID_ATTR"in e?b({},e.FORBID_ATTR):{};M=e.ALLOW_DATA_ATTR!==false;O=e.ALLOW_UNKNOWN_PROTOCOLS||false;L=e.SAFE_FOR_JQUERY||false;D=e.SAFE_FOR_TEMPLATES||false;C=e.WHOLE_DOCUMENT||false;z=e.RETURN_DOM||false;R=e.RETURN_DOM_FRAGMENT||false;F=e.RETURN_DOM_IMPORT||false;H=e.SANITIZE_DOM!==false;B=e.KEEP_CONTENT!==false;if(D){M=false}if(R){z=true}if(e.ADD_TAGS){if(x===k){x=T(x)}b(x,e.ADD_TAGS)}if(e.ADD_ATTR){if(A===w){A=T(A)}b(A,e.ADD_ATTR)}if(B){x["#text"]=true}if(Object&&"freeze"in Object){Object.freeze(e)}I=e};var U=function(e){try{e.parentNode.removeChild(e)}catch(t){e.outerHTML=""}};var V=function(e){var t,r;try{t=(new u).parseFromString(e,"text/html")}catch(n){}if(!t){t=m.createHTMLDocument("");r=t.body;r.parentNode.removeChild(r.parentNode.firstElementChild);r.outerHTML=e}if(typeof t.getElementsByTagName==="function"){return t.getElementsByTagName(C?"html":"body")[0]}return h.call(t,C?"html":"body")[0]};var K=function(e){return p.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,function(){return l.FILTER_ACCEPT},false)};var J=function(e){if(e instanceof f||e instanceof c){return false}if(typeof e.nodeName!=="string"||typeof e.textContent!=="string"||typeof e.removeChild!=="function"||!(e.attributes instanceof s)||typeof e.removeAttribute!=="function"||typeof e.setAttribute!=="function"){return true}return false};var Q=function(e){var t,r;re("beforeSanitizeElements",e,null);if(J(e)){U(e);return true}t=e.nodeName.toLowerCase();re("uponSanitizeElement",e,{tagName:t});if(!x[t]||E[t]){if(B&&!W[t]&&typeof e.insertAdjacentHTML==="function"){try{e.insertAdjacentHTML("AfterEnd",e.innerHTML)}catch(n){}}U(e);return true}if(L&&!e.firstElementChild&&(!e.content||!e.content.firstElementChild)){e.innerHTML=e.textContent.replace(/</g,"<")}if(D&&e.nodeType===3){r=e.textContent;r=r.replace(N," ");r=r.replace(_," ");e.textContent=r}re("afterSanitizeElements",e,null);return false};var X=/^data-[\w.\u00B7-\uFFFF-]/;var Y=/^(?:(?:(?:f|ht)tps?|mailto|tel):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;var Z=/^(?:\w+script|data):/i;var $=/[\x00-\x20\xA0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;var ee=function(e){var r,a,i,o,l,s,f,c;re("beforeSanitizeAttributes",e,null);s=e.attributes;if(!s){return}f={attrName:"",attrValue:"",keepAttr:true};c=s.length;while(c--){r=s[c];a=r.name;i=r.value;o=a.toLowerCase();f.attrName=o;f.attrValue=i;f.keepAttr=true;re("uponSanitizeAttribute",e,f);i=f.attrValue;if(o==="name"&&e.nodeName==="IMG"&&s.id){l=s.id;s=Array.prototype.slice.apply(s);e.removeAttribute("id");e.removeAttribute(a);if(s.indexOf(l)>c){e.setAttribute("id",l.value)}}else{if(a==="id"){e.setAttribute(a,"")}e.removeAttribute(a)}if(!f.keepAttr){continue}if(H&&(o==="id"||o==="name")&&(i in t||i in n||i in q)){continue}if(D){i=i.replace(N," ");i=i.replace(_," ")}if(A[o]&&!S[o]&&(G[o]||Y.test(i.replace($,""))||o==="src"&&i.indexOf("data:")===0&&j[e.nodeName.toLowerCase()])||M&&X.test(o)||O&&!Z.test(i.replace($,""))){try{e.setAttribute(a,i)}catch(u){}}}re("afterSanitizeAttributes",e,null)};var te=function(e){var t;var r=K(e);re("beforeSanitizeShadowDOM",e,null);while(t=r.nextNode()){re("uponSanitizeShadowNode",t,null);if(Q(t)){continue}if(t.content instanceof i){te(t.content)}ee(t)}re("afterSanitizeShadowDOM",e,null)};var re=function(e,t,n){if(!y[e]){return}y[e].forEach(function(e){e.call(r,t,n,I)})};r.sanitize=function(e,n){var o,l,s,f,c;if(!e){e=""}if(typeof e!=="string"){if(typeof e.toString!=="function"){throw new TypeError("toString is not a function")}else{e=e.toString()}}if(!r.isSupported){if(typeof t.toStaticHTML==="object"||typeof t.toStaticHTML==="function"){return t.toStaticHTML(e)}return e}P(n);if(!z&&!C&&e.indexOf("<")===-1){return e}o=V(e);if(!o){return z?null:""}f=K(o);while(l=f.nextNode()){if(l.nodeType===3&&l===s){continue}if(Q(l)){continue}if(l.content instanceof i){te(l.content)}ee(l);s=l}if(z){if(R){c=v.call(o.ownerDocument);while(o.firstChild){c.appendChild(o.firstChild)}}else{c=o}if(F){c=g.call(a,c,true)}return c}return C?o.outerHTML:o.innerHTML};r.addHook=function(e,t){if(typeof t!=="function"){return}y[e]=y[e]||[];y[e].push(t)};r.removeHook=function(e){if(y[e]){y[e].pop()}};r.removeHooks=function(e){if(y[e]){y[e]=[]}};r.removeAllHooks=function(){y=[]};return r}); | |
| 2 | +//# sourceMappingURL=./dist/purify.min.js.map | |
| 0 | 3 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/plugins/fileinput/sortable.min.js
0 → 100644
| 1 | +/*! Sortable 1.4.2 - MIT | git://github.com/rubaxa/Sortable.git */ | |
| 2 | +!function(t){"use strict";"function"==typeof define&&define.amd?define(t):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=t():"undefined"!=typeof Package?KvSortable=t():window.KvSortable=t()}(function(){"use strict";function t(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"KvSortable: `el` must be HTMLElement, and not "+{}.toString.call(t);this.el=t,this.options=e=b({},e),t[j]=this;var n={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(t.nodeName)?"li":">*",ghostClass:"kvsortable-ghost",chosenClass:"kvsortable-chosen",ignore:"a, img",filter:null,animation:0,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"kvsortable-fallback",fallbackOnBody:!1};for(var i in n)!(i in e)&&(e[i]=n[i]);z(e);for(var r in this)"_"===r.charAt(0)&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:P,o(t,"mousedown",this._onTapStart),o(t,"touchstart",this._onTapStart),this.nativeDraggable&&(o(t,"dragover",this),o(t,"dragenter",this)),q.push(this._onDragOver),e.store&&this.sort(e.store.get(this))}function e(t){w&&w.state!==t&&(s(w,"display",t?"none":""),!t&&w.state&&S.insertBefore(w,_),w.state=t)}function n(t,e,n){if(t){n=n||U;do if(">*"===e&&t.parentNode===n||v(t,e))return t;while(t!==n&&(t=t.parentNode))}return null}function i(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.preventDefault()}function o(t,e,n){t.addEventListener(e,n,!1)}function r(t,e,n){t.removeEventListener(e,n,!1)}function a(t,e,n){if(t)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(M," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(M," ")}}function s(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return U.defaultView&&U.defaultView.getComputedStyle?n=U.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in i||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function l(t,e,n){if(t){var i=t.getElementsByTagName(e),o=0,r=i.length;if(n)for(;r>o;o++)n(i[o],o);return i}return[]}function d(t,e,n,i,o,r,a){var s=U.createEvent("Event"),l=(t||e[j]).options,d="on"+n.charAt(0).toUpperCase()+n.substr(1);s.initEvent(n,!0,!0),s.to=e,s.from=o||e,s.item=i||e,s.clone=w,s.oldIndex=r,s.newIndex=a,e.dispatchEvent(s),l[d]&&l[d].call(t,s)}function c(t,e,n,i,o,r){var a,s,l=t[j],d=l.options.onMove;return a=U.createEvent("Event"),a.initEvent("move",!0,!0),a.to=e,a.from=t,a.dragged=n,a.draggedRect=i,a.related=o||e,a.relatedRect=r||e.getBoundingClientRect(),t.dispatchEvent(a),d&&(s=d.call(l,a)),s}function u(t){t.draggable=!1}function h(){K=!1}function f(t,e){var n=t.lastElementChild,i=n.getBoundingClientRect();return(e.clientY-(i.top+i.height)>5||e.clientX-(i.right+i.width)>5)&&n}function p(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,i=0;n--;)i+=e.charCodeAt(n);return i.toString(36)}function g(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t&&(t=t.previousElementSibling);)"TEMPLATE"!==t.nodeName.toUpperCase()&&v(t,e)&&n++;return n}function v(t,e){if(t){e=e.split(".");var n=e.shift().toUpperCase(),i=new RegExp("\\s("+e.join("|")+")(?=\\s)","g");return!(""!==n&&t.nodeName.toUpperCase()!=n||e.length&&((" "+t.className+" ").match(i)||[]).length!=e.length)}return!1}function m(t,e){var n,i;return function(){void 0===n&&(n=arguments,i=this,setTimeout(function(){1===n.length?t.call(i,n[0]):t.apply(i,n),n=void 0},e))}}function b(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}if("undefined"==typeof window||"undefined"==typeof window.document)return function(){throw new Error("sortable.js requires a window with a document")};var _,D,y,w,S,T,C,E,x,N,B,k,O,X,Y,A,I,R={},M=/\s+/g,j="KvSortable"+(new Date).getTime(),L=window,U=L.document,H=L.parseInt,P=!!("draggable"in U.createElement("div")),W=function(t){return t=U.createElement("x"),t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}(),K=!1,F=Math.abs,q=([].slice,[]),V=m(function(t,e,n){if(n&&e.scroll){var i,o,r,a,s=e.scrollSensitivity,l=e.scrollSpeed,d=t.clientX,c=t.clientY,u=window.innerWidth,h=window.innerHeight;if(E!==n&&(C=e.scroll,E=n,C===!0)){C=n;do if(C.offsetWidth<C.scrollWidth||C.offsetHeight<C.scrollHeight)break;while(C=C.parentNode)}C&&(i=C,o=C.getBoundingClientRect(),r=(F(o.right-d)<=s)-(F(o.left-d)<=s),a=(F(o.bottom-c)<=s)-(F(o.top-c)<=s)),r||a||(r=(s>=u-d)-(s>=d),a=(s>=h-c)-(s>=c),(r||a)&&(i=L)),(R.vx!==r||R.vy!==a||R.el!==i)&&(R.el=i,R.vx=r,R.vy=a,clearInterval(R.pid),i&&(R.pid=setInterval(function(){i===L?L.scrollTo(L.pageXOffset+r*l,L.pageYOffset+a*l):(a&&(i.scrollTop+=a*l),r&&(i.scrollLeft+=r*l))},24)))}},30),z=function(t){var e=t.group;e&&"object"==typeof e||(e=t.group={name:e}),["pull","put"].forEach(function(t){t in e||(e[t]=!0)}),t.groups=" "+e.name+(e.put.join?" "+e.put.join(" "):"")+" "};return t.prototype={constructor:t,_onTapStart:function(t){var e=this,i=this.el,o=this.options,r=t.type,a=t.touches&&t.touches[0],s=(a||t).target,l=s,c=o.filter;if(!("mousedown"===r&&0!==t.button||o.disabled)&&(s=n(s,o.draggable,i))){if(k=g(s,o.draggable),"function"==typeof c){if(c.call(this,t,s,this))return d(e,l,"filter",s,i,k),void t.preventDefault()}else if(c&&(c=c.split(",").some(function(t){return t=n(l,t.trim(),i),t?(d(e,t,"filter",s,i,k),!0):void 0})))return void t.preventDefault();(!o.handle||n(l,o.handle,i))&&this._prepareDragStart(t,a,s)}},_prepareDragStart:function(t,e,n){var i,r=this,s=r.el,d=r.options,c=s.ownerDocument;n&&!_&&n.parentNode===s&&(Y=t,S=s,_=n,D=_.parentNode,T=_.nextSibling,X=d.group,i=function(){r._disableDelayedDrag(),_.draggable=!0,a(_,r.options.chosenClass,!0),r._triggerDragStart(e)},d.ignore.split(",").forEach(function(t){l(_,t.trim(),u)}),o(c,"mouseup",r._onDrop),o(c,"touchend",r._onDrop),o(c,"touchcancel",r._onDrop),d.delay?(o(c,"mouseup",r._disableDelayedDrag),o(c,"touchend",r._disableDelayedDrag),o(c,"touchcancel",r._disableDelayedDrag),o(c,"mousemove",r._disableDelayedDrag),o(c,"touchmove",r._disableDelayedDrag),r._dragStartTimer=setTimeout(i,d.delay)):i())},_disableDelayedDrag:function(){var t=this.el.ownerDocument;clearTimeout(this._dragStartTimer),r(t,"mouseup",this._disableDelayedDrag),r(t,"touchend",this._disableDelayedDrag),r(t,"touchcancel",this._disableDelayedDrag),r(t,"mousemove",this._disableDelayedDrag),r(t,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(t){t?(Y={target:_,clientX:t.clientX,clientY:t.clientY},this._onDragStart(Y,"touch")):this.nativeDraggable?(o(_,"dragend",this),o(S,"dragstart",this._onDragStart)):this._onDragStart(Y,!0);try{U.selection?U.selection.empty():window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(){S&&_&&(a(_,this.options.ghostClass,!0),t.active=this,d(this,S,"start",_,S,k))},_emulateDragOver:function(){if(A){if(this._lastX===A.clientX&&this._lastY===A.clientY)return;this._lastX=A.clientX,this._lastY=A.clientY,W||s(y,"display","none");var t=U.elementFromPoint(A.clientX,A.clientY),e=t,n=" "+this.options.group.name,i=q.length;if(e)do{if(e[j]&&e[j].options.groups.indexOf(n)>-1){for(;i--;)q[i]({clientX:A.clientX,clientY:A.clientY,target:t,rootEl:e});break}t=e}while(e=e.parentNode);W||s(y,"display","")}},_onTouchMove:function(e){if(Y){t.active||this._dragStarted(),this._appendGhost();var n=e.touches?e.touches[0]:e,i=n.clientX-Y.clientX,o=n.clientY-Y.clientY,r=e.touches?"translate3d("+i+"px,"+o+"px,0)":"translate("+i+"px,"+o+"px)";I=!0,A=n,s(y,"webkitTransform",r),s(y,"mozTransform",r),s(y,"msTransform",r),s(y,"transform",r),e.preventDefault()}},_appendGhost:function(){if(!y){var t,e=_.getBoundingClientRect(),n=s(_),i=this.options;y=_.cloneNode(!0),a(y,i.ghostClass,!1),a(y,i.fallbackClass,!0),s(y,"top",e.top-H(n.marginTop,10)),s(y,"left",e.left-H(n.marginLeft,10)),s(y,"width",e.width),s(y,"height",e.height),s(y,"opacity","0.8"),s(y,"position","fixed"),s(y,"zIndex","100000"),s(y,"pointerEvents","none"),i.fallbackOnBody&&U.body.appendChild(y)||S.appendChild(y),t=y.getBoundingClientRect(),s(y,"width",2*e.width-t.width),s(y,"height",2*e.height-t.height)}},_onDragStart:function(t,e){var n=t.dataTransfer,i=this.options;this._offUpEvents(),"clone"==X.pull&&(w=_.cloneNode(!0),s(w,"display","none"),S.insertBefore(w,_)),e?("touch"===e?(o(U,"touchmove",this._onTouchMove),o(U,"touchend",this._onDrop),o(U,"touchcancel",this._onDrop)):(o(U,"mousemove",this._onTouchMove),o(U,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(n&&(n.effectAllowed="move",i.setData&&i.setData.call(this,n,_)),o(U,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(t){var i,o,r,a=this.el,l=this.options,d=l.group,u=d.put,p=X===d,g=l.sort;if(void 0!==t.preventDefault&&(t.preventDefault(),!l.dragoverBubble&&t.stopPropagation()),I=!0,X&&!l.disabled&&(p?g||(r=!S.contains(_)):X.pull&&u&&(X.name===d.name||u.indexOf&&~u.indexOf(X.name)))&&(void 0===t.rootEl||t.rootEl===this.el)){if(V(t,l,this.el),K)return;if(i=n(t.target,l.draggable,a),o=_.getBoundingClientRect(),r)return e(!0),void(w||T?S.insertBefore(_,w||T):g||S.appendChild(_));if(0===a.children.length||a.children[0]===y||a===t.target&&(i=f(a,t))){if(i){if(i.animated)return;m=i.getBoundingClientRect()}e(p),c(S,a,_,o,i,m)!==!1&&(_.contains(a)||(a.appendChild(_),D=a),this._animate(o,_),i&&this._animate(m,i))}else if(i&&!i.animated&&i!==_&&void 0!==i.parentNode[j]){x!==i&&(x=i,N=s(i),B=s(i.parentNode));var v,m=i.getBoundingClientRect(),b=m.right-m.left,C=m.bottom-m.top,E=/left|right|inline/.test(N.cssFloat+N.display)||"flex"==B.display&&0===B["flex-direction"].indexOf("row"),k=i.offsetWidth>_.offsetWidth,O=i.offsetHeight>_.offsetHeight,Y=(E?(t.clientX-m.left)/b:(t.clientY-m.top)/C)>.5,A=i.nextElementSibling,R=c(S,a,_,o,i,m);if(R!==!1){if(K=!0,setTimeout(h,30),e(p),1===R||-1===R)v=1===R;else if(E){var M=_.offsetTop,L=i.offsetTop;v=M===L?i.previousElementSibling===_&&!k||Y&&k:L>M}else v=A!==_&&!O||Y&&O;_.contains(a)||(v&&!A?a.appendChild(_):i.parentNode.insertBefore(_,v?A:i)),D=_.parentNode,this._animate(o,_),this._animate(m,i)}}}},_animate:function(t,e){var n=this.options.animation;if(n){var i=e.getBoundingClientRect();s(e,"transition","none"),s(e,"transform","translate3d("+(t.left-i.left)+"px,"+(t.top-i.top)+"px,0)"),e.offsetWidth,s(e,"transition","all "+n+"ms"),s(e,"transform","translate3d(0,0,0)"),clearTimeout(e.animated),e.animated=setTimeout(function(){s(e,"transition",""),s(e,"transform",""),e.animated=!1},n)}},_offUpEvents:function(){var t=this.el.ownerDocument;r(U,"touchmove",this._onTouchMove),r(t,"mouseup",this._onDrop),r(t,"touchend",this._onDrop),r(t,"touchcancel",this._onDrop)},_onDrop:function(e){var n=this.el,i=this.options;clearInterval(this._loopId),clearInterval(R.pid),clearTimeout(this._dragStartTimer),r(U,"mousemove",this._onTouchMove),this.nativeDraggable&&(r(U,"drop",this),r(n,"dragstart",this._onDragStart)),this._offUpEvents(),e&&(I&&(e.preventDefault(),!i.dropBubble&&e.stopPropagation()),y&&y.parentNode.removeChild(y),_&&(this.nativeDraggable&&r(_,"dragend",this),u(_),a(_,this.options.ghostClass,!1),a(_,this.options.chosenClass,!1),S!==D?(O=g(_,i.draggable),O>=0&&(d(null,D,"sort",_,S,k,O),d(this,S,"sort",_,S,k,O),d(null,D,"add",_,S,k,O),d(this,S,"remove",_,S,k,O))):(w&&w.parentNode.removeChild(w),_.nextSibling!==T&&(O=g(_,i.draggable),O>=0&&(d(this,S,"update",_,S,k,O),d(this,S,"sort",_,S,k,O)))),t.active&&((null===O||-1===O)&&(O=k),d(this,S,"end",_,S,k,O),this.save()))),this._nulling()},_nulling:function(){S=_=D=y=T=w=C=E=Y=A=I=O=x=N=X=t.active=null},handleEvent:function(t){var e=t.type;"dragover"===e||"dragenter"===e?_&&(this._onDragOver(t),i(t)):("drop"===e||"dragend"===e)&&this._onDrop(t)},toArray:function(){for(var t,e=[],i=this.el.children,o=0,r=i.length,a=this.options;r>o;o++)t=i[o],n(t,a.draggable,this.el)&&e.push(t.getAttribute(a.dataIdAttr)||p(t));return e},sort:function(t){var e={},i=this.el;this.toArray().forEach(function(t,o){var r=i.children[o];n(r,this.options.draggable,i)&&(e[t]=r)},this),t.forEach(function(t){e[t]&&(i.removeChild(e[t]),i.appendChild(e[t]))})},save:function(){var t=this.options.store;t&&t.set(this)},closest:function(t,e){return n(t,e||this.options.draggable,this.el)},option:function(t,e){var n=this.options;return void 0===e?n[t]:(n[t]=e,void("group"===t&&z(n)))},destroy:function(){var t=this.el;t[j]=null,r(t,"mousedown",this._onTapStart),r(t,"touchstart",this._onTapStart),this.nativeDraggable&&(r(t,"dragover",this),r(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),q.splice(q.indexOf(this._onDragOver),1),this._onDrop(),this.el=t=null}},t.utils={on:o,off:r,css:s,find:l,is:function(t,e){return!!n(t,e,t)},extend:b,throttle:m,closest:n,toggleClass:a,index:g},t.create=function(e,n){return new t(e,n)},t.version="1.4.2",t}),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){"use strict";t.fn.kvsortable=function(e){var n,i=arguments;return this.each(function(){var o=t(this),r=o.data("kvsortable");if(r||!(e instanceof Object)&&e||(r=new KvSortable(this,e),o.data("kvsortable",r)),r){if("widget"===e)return r;"destroy"===e?(r.destroy(),o.removeData("kvsortable")):"function"==typeof r[e]?n=r[e].apply(r,[].slice.call(i,1)):e in r.options&&(n=r.option.apply(r,i))}}),void 0===n?this:n}}); | |
| 0 | 3 | \ No newline at end of file | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -32,6 +32,8 @@ |
| 32 | 32 | <link href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" /> |
| 33 | 33 | <!-- layer 弹层 插件 --> |
| 34 | 34 | <link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" rel="stylesheet" type="text/css" /> |
| 35 | +<!-- fileinput 上传 插件 --> | |
| 36 | +<link href="/assets/plugins/fileinput/css/fileinput.min.css" rel="stylesheet" type="text/css" /> | |
| 35 | 37 | <!-- iCheck 单选框和复选框 --> |
| 36 | 38 | <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" rel="stylesheet" type="text/css" /> |
| 37 | 39 | <!-- 日期控件 --> |
| ... | ... | @@ -290,6 +292,12 @@ tr.row-active td { |
| 290 | 292 | <script src="/assets/plugins/jquery.pjax.js"></script> |
| 291 | 293 | <!-- layer 弹层 --> |
| 292 | 294 | <script src="/assets/plugins/layer-v2.4/layer/layer.js" data-exclude=1></script> |
| 295 | +<!-- fileinput 上传 --> | |
| 296 | +<script src="/assets/plugins/fileinput/canvas-to-blob.min.js"></script> | |
| 297 | +<script src="/assets/plugins/fileinput/purify.min.js"></script> | |
| 298 | +<script src="/assets/plugins/fileinput/sortable.min.js"></script> | |
| 299 | +<script src="/assets/plugins/fileinput/fileinput.min.js"></script> | |
| 300 | +<script src="/assets/plugins/fileinput/fileinput_locale_zh.js"></script> | |
| 293 | 301 | <!-- jquery.purl URL解析 --> |
| 294 | 302 | <script src="/assets/plugins/purl.js"></script> |
| 295 | 303 | <!-- jquery.serializejson JSON序列化插件 --> | ... | ... |
src/main/resources/static/pages/device/connection_search.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 class="fa fa-circle"></i></li> | |
| 9 | + <li><span class="active">车载设备接入查询</span> <i class="fa fa-circle"></i></li> | |
| 10 | + <li><span class="active">车载设备接入查询</span></li> | |
| 11 | +</ul> | |
| 12 | + | |
| 13 | +<ul id="myTab" class="nav nav-tabs"> | |
| 14 | + <li class="active"> | |
| 15 | + <a href="#tab1" data-toggle="tab">单车信息</a> | |
| 16 | + </li> | |
| 17 | + <li> | |
| 18 | + <a href="#tab2" data-toggle="tab">清册查询</a> | |
| 19 | + </li> | |
| 20 | +</ul> | |
| 21 | +<div id="myTabContent" class="tab-content"> | |
| 22 | + <div class="tab-pane fade in active" id="tab1"> | |
| 23 | + <div class="row"> | |
| 24 | + <div class="col-md-12"> | |
| 25 | + <!-- Begin: life time stats --> | |
| 26 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 27 | + <div class="portlet-body"> | |
| 28 | + <div class="table-container" style="margin-top: 10px"> | |
| 29 | + <table | |
| 30 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 31 | + id="datatable_devicegps"> | |
| 32 | + <thead> | |
| 33 | + <tr role="row" class="heading"> | |
| 34 | + <th width="5%">#</th> | |
| 35 | + <th width="15%">识别码</th> | |
| 36 | + <th width="15%">线路ID</th> | |
| 37 | + <th width="10%">GPS</th> | |
| 38 | + <th width="20%">report</th> | |
| 39 | + <th width="15%">版本</th> | |
| 40 | + <th width="20%">操作</th> | |
| 41 | + </tr> | |
| 42 | + <tr role="row" class="filter"> | |
| 43 | + <td></td> | |
| 44 | + <td> | |
| 45 | + <input type="text" class="form-control form-filter input-sm" name="deviceId" id="deviceId"> | |
| 46 | + </td> | |
| 47 | + <td> | |
| 48 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | |
| 49 | + </td> | |
| 50 | + <td> | |
| 51 | + </td> | |
| 52 | + <td></td> | |
| 53 | + <td></td> | |
| 54 | + <td> | |
| 55 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | |
| 56 | + <i class="fa fa-search"></i> 搜索</button> | |
| 57 | + | |
| 58 | + <button class="btn btn-sm red btn-outline filter-cancel"> | |
| 59 | + <i class="fa fa-times"></i> 重置</button> | |
| 60 | + </td> | |
| 61 | + </tr> | |
| 62 | + </thead> | |
| 63 | + <tbody></tbody> | |
| 64 | + </table> | |
| 65 | + <div style="text-align: right;"> | |
| 66 | + <ul id="pagination" class="pagination"></ul> | |
| 67 | + </div> | |
| 68 | + </div> | |
| 69 | + </div> | |
| 70 | + </div> | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | + </div> | |
| 74 | + <div class="tab-pane fade" id="tab2"> | |
| 75 | + <div class="row"> | |
| 76 | + <div class="col-md-12"> | |
| 77 | + <!-- Begin: life time stats --> | |
| 78 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 79 | + <div class="portlet-body"> | |
| 80 | + <div class="row"> | |
| 81 | + <div class="col-md-6"> | |
| 82 | + <input id="fileinput" name="_txt_" type="file" class="file form-control"> | |
| 83 | + </div> | |
| 84 | + <div class="col-md-6"> | |
| 85 | + <div class="row"> | |
| 86 | + <div class="col-md-12"> | |
| 87 | + <label class="checkbox-inline"> | |
| 88 | + <input type="radio" name="filterOption" value="1" checked>全部 | |
| 89 | + | |
| 90 | + <input type="radio" name="filterOption" value="2">GPS无效 | |
| 91 | + | |
| 92 | + <input type="radio" name="filterOption" value="3">已接入 | |
| 93 | + | |
| 94 | + <input type="radio" name="filterOption" value="4">未接入 | |
| 95 | + </label> | |
| 96 | + </div> | |
| 97 | + <div class="col-md-12"> | |
| 98 | + <label class="checkbox-inline"> | |
| 99 | + <input type="radio" name="filterOption" value="5">版本不等于 | |
| 100 | + <input type="text" id="version" name="version" size="5"> | |
| 101 | + </label> | |
| 102 | + </div> | |
| 103 | + </div> | |
| 104 | + </div> | |
| 105 | + </div> | |
| 106 | + <div class="table-container" style="margin-top: 10px"> | |
| 107 | + <table | |
| 108 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 109 | + id="datatable_devicegps1"> | |
| 110 | + <thead> | |
| 111 | + <tr role="row" class="heading"> | |
| 112 | + <th width="5%">#</th> | |
| 113 | + <th width="10%">线路编码</th> | |
| 114 | + <th width="10%">线路名称</th> | |
| 115 | + <th width="10%">内部编码</th> | |
| 116 | + <th width="10%">识别号</th> | |
| 117 | + <th width="10%">线路</th> | |
| 118 | + <th width="10%">GPS</th> | |
| 119 | + <th width="15%">report</th> | |
| 120 | + <th width="10%">版本</th> | |
| 121 | + </tr> | |
| 122 | + </thead> | |
| 123 | + <tbody></tbody> | |
| 124 | + </table> | |
| 125 | + <div style="text-align: right;"> | |
| 126 | + <ul id="pagination" class="pagination"></ul> | |
| 127 | + </div> | |
| 128 | + </div> | |
| 129 | + </div> | |
| 130 | + </div> | |
| 131 | + </div> | |
| 132 | + </div> | |
| 133 | + </div> | |
| 134 | +</div> | |
| 135 | +<script id="devicegps_list_temp" type="text/html"> | |
| 136 | +{{each list as obj i}} | |
| 137 | +<tr> | |
| 138 | + <td style="vertical-align: middle;"> | |
| 139 | + {{i + 1}} | |
| 140 | + </td> | |
| 141 | + <td> | |
| 142 | + {{obj.deviceId}} | |
| 143 | + </td> | |
| 144 | + <td> | |
| 145 | + {{obj.lineId}} | |
| 146 | + </td> | |
| 147 | + <td> | |
| 148 | + {{if obj.valid==0}} | |
| 149 | + 有效 | |
| 150 | + {{else if obj.valid==1}} | |
| 151 | + 无效 | |
| 152 | + {{else}} | |
| 153 | + 无效 | |
| 154 | + {{/if}} | |
| 155 | + </td> | |
| 156 | + <td class="dt"> | |
| 157 | + {{obj.timestamp}} | |
| 158 | + </td> | |
| 159 | + <td> | |
| 160 | + {{obj.version}} | |
| 161 | + </td> | |
| 162 | + <td> | |
| 163 | + | |
| 164 | + </td> | |
| 165 | +</tr> | |
| 166 | +{{/each}} | |
| 167 | +{{if list.length == 0}} | |
| 168 | +<tr> | |
| 169 | + <td colspan=7><h6 class="muted">没有找到相关数据</h6></td> | |
| 170 | +</tr> | |
| 171 | +{{/if}} | |
| 172 | +</script> | |
| 173 | +<script id="devicegps_list_temp1" type="text/html"> | |
| 174 | +{{each list as obj i}} | |
| 175 | +<tr> | |
| 176 | + <td style="vertical-align: middle;"> | |
| 177 | + {{i + 1}} | |
| 178 | + </td> | |
| 179 | + <td> | |
| 180 | + {{obj.lineCode}} | |
| 181 | + </td> | |
| 182 | + <td> | |
| 183 | + {{obj.lineName}} | |
| 184 | + </td> | |
| 185 | + <td> | |
| 186 | + {{obj.inCode}} | |
| 187 | + </td> | |
| 188 | + <td> | |
| 189 | + {{obj.deviceId}} | |
| 190 | + </td> | |
| 191 | + {{if obj.detail==null}} | |
| 192 | + <td> | |
| 193 | + </td> | |
| 194 | + <td> | |
| 195 | + </td> | |
| 196 | + <td> | |
| 197 | + </td> | |
| 198 | + <td> | |
| 199 | + </td> | |
| 200 | + {{else}} | |
| 201 | + <td> | |
| 202 | + {{obj.detail.lineId}} | |
| 203 | + </td> | |
| 204 | + <td> | |
| 205 | + {{if obj.detail.valid==0}} | |
| 206 | + 有效 | |
| 207 | + {{else if obj.detail.valid==1}} | |
| 208 | + 无效 | |
| 209 | + {{else}} | |
| 210 | + 无效 | |
| 211 | + {{/if}} | |
| 212 | + </td> | |
| 213 | + <td class="dt1"> | |
| 214 | + {{obj.detail.timestamp}} | |
| 215 | + </td> | |
| 216 | + <td> | |
| 217 | + {{obj.detail.version}} | |
| 218 | + </td> | |
| 219 | + {{/if}} | |
| 220 | +</tr> | |
| 221 | +{{/each}} | |
| 222 | +{{if list.length == 0}} | |
| 223 | +<tr> | |
| 224 | + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td> | |
| 225 | +</tr> | |
| 226 | +{{/if}} | |
| 227 | +</script> | |
| 228 | +<script> | |
| 229 | +$(function(){ | |
| 230 | + var opened; | |
| 231 | + $('#myTab li:eq(0) a').tab('show'); | |
| 232 | + $('#fileinput').fileinput({ | |
| 233 | + 'showPreview' : false, | |
| 234 | + 'showRemove' : false, | |
| 235 | + 'showUpload' : false, | |
| 236 | + 'showCancel' : false, | |
| 237 | + 'previewFileType' : 'any', | |
| 238 | + 'language' : 'zh', | |
| 239 | + 'uploadUrl' : '/devicegps/open' | |
| 240 | + }).on('fileuploaded', function(e,data){ | |
| 241 | + var r = data.response; | |
| 242 | + if(r.errCode) layer.msg(r.msg); | |
| 243 | + else { | |
| 244 | + var bodyHtm = template('devicegps_list_temp1', {list: r.data}); | |
| 245 | + $('#datatable_devicegps1 tbody').html(bodyHtm); | |
| 246 | + $('.dt1').each(function(){ | |
| 247 | + $(this).html(moment(parseInt($(this).html())).format('YYYY-M-D HH:mm:ss')); | |
| 248 | + }); | |
| 249 | + opened = new Array(); | |
| 250 | + for (var j = 0,len = r.data.length;j < len;j++) { | |
| 251 | + var item = r.data[j]; | |
| 252 | + delete item.detail; | |
| 253 | + opened.push(item); | |
| 254 | + } | |
| 255 | + } | |
| 256 | + $(this).fileinput('clear').fileinput('enable'); | |
| 257 | + }).on('change', function(e){ | |
| 258 | + $(this).fileinput('upload'); | |
| 259 | + }); | |
| 260 | + | |
| 261 | + $('#open').on('click', function(e){ | |
| 262 | + $('#fileinput').fileinput('upload'); | |
| 263 | + }); | |
| 264 | + | |
| 265 | + $('input[type=radio][name=filterOption]').change(function() { | |
| 266 | + importDeviceSearch(); | |
| 267 | + }); | |
| 268 | + | |
| 269 | + function importDeviceSearch(){ | |
| 270 | + if (!opened) return false; | |
| 271 | + var params = { json : JSON.stringify(opened) }; | |
| 272 | + $post('/devicegps/open/filter', params, function(r){ | |
| 273 | + debugger; | |
| 274 | + if(r.errCode) layer.msg(r.msg); | |
| 275 | + else { | |
| 276 | + var filtered = new Array(), val = $('input[type=radio][name=filterOption]:checked').val(), version = $('#version').val(), i = 0,item = null; | |
| 277 | + switch(val) { | |
| 278 | + case '1': | |
| 279 | + filtered = r.data; | |
| 280 | + break; | |
| 281 | + case '2': | |
| 282 | + for (len = r.data.length;i < len;i++) { | |
| 283 | + item = r.data[i]; | |
| 284 | + if (item.detail && item.detail.valid) filtered.push(item); | |
| 285 | + } | |
| 286 | + break; | |
| 287 | + case '3': | |
| 288 | + for (len = r.data.length;i < len;i++) { | |
| 289 | + item = r.data[i]; | |
| 290 | + if (item.detail) filtered.push(item); | |
| 291 | + } | |
| 292 | + break; | |
| 293 | + case '4': | |
| 294 | + for (len = r.data.length;i < len;i++) { | |
| 295 | + item = r.data[i]; | |
| 296 | + if (!item.detail) filtered.push(item); | |
| 297 | + } | |
| 298 | + break; | |
| 299 | + case '5': | |
| 300 | + for (len = r.data.length;i < len;i++) { | |
| 301 | + item = r.data[i]; | |
| 302 | + if (item.detail && item.detail.version != version) filtered.push(item); | |
| 303 | + } | |
| 304 | + break; | |
| 305 | + default: | |
| 306 | + break; | |
| 307 | + } | |
| 308 | + var bodyHtm = template('devicegps_list_temp1', {list: filtered}); | |
| 309 | + $('#datatable_devicegps1 tbody').html(bodyHtm); | |
| 310 | + $('.dt1').each(function(){ | |
| 311 | + $(this).html(moment(parseInt($(this).html())).format('YYYY-M-D HH:mm:ss')); | |
| 312 | + }); | |
| 313 | + } | |
| 314 | + }); | |
| 315 | + } | |
| 316 | + | |
| 317 | + var page = 0, initPagination; | |
| 318 | + var icheckOptions = { | |
| 319 | + checkboxClass: 'icheckbox_flat-blue', | |
| 320 | + increaseArea: '20%' | |
| 321 | + } | |
| 322 | + | |
| 323 | + //jsDoQuery(null,true); | |
| 324 | + | |
| 325 | + //重置 | |
| 326 | + $('tr.filter .filter-cancel').on('click', function(){ | |
| 327 | + $('tr.filter input, select').val('').change(); | |
| 328 | + jsDoQuery(null, true); | |
| 329 | + }); | |
| 330 | + | |
| 331 | + //提交 | |
| 332 | + $('tr.filter .filter-submit').on('click', function(){ | |
| 333 | + var cells = $('tr.filter')[0].cells | |
| 334 | + ,params = {} | |
| 335 | + ,name; | |
| 336 | + $.each(cells, function(i, cell){ | |
| 337 | + var items = $('input,select', cell); | |
| 338 | + for(var j = 0, item; item = items[j++];){ | |
| 339 | + name = $(item).attr('name'); | |
| 340 | + if(name){ | |
| 341 | + params[name] = $(item).val(); | |
| 342 | + } | |
| 343 | + } | |
| 344 | + }); | |
| 345 | + page = 0; | |
| 346 | + jsDoQuery(params, true); | |
| 347 | + }); | |
| 348 | + | |
| 349 | + /* | |
| 350 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 351 | + */ | |
| 352 | + function jsDoQuery(p, pagination){ | |
| 353 | + var params = {}; | |
| 354 | + if(p) | |
| 355 | + params = p; | |
| 356 | + //更新时间排序 | |
| 357 | + //params['order'] = 'lastLoginDate'; | |
| 358 | + //params['page'] = page; | |
| 359 | + var i = layer.load(2), url = '/devicegps/real/all'; | |
| 360 | + if(params['line']) url = '/devicegps/real/line/' + params['line']; | |
| 361 | + | |
| 362 | + $get(url, params, function(data){ | |
| 363 | + var json = new Array(), deviceId = params['deviceId']; | |
| 364 | + if (deviceId) { | |
| 365 | + for (var j = 0,len = data.length;j < len;j++) { | |
| 366 | + var item = data[j]; | |
| 367 | + if(item.deviceId && item.deviceId.indexOf(deviceId) > -1) | |
| 368 | + json.push(data[j]); | |
| 369 | + } | |
| 370 | + } else { | |
| 371 | + json = data; | |
| 372 | + } | |
| 373 | + var bodyHtm = template('devicegps_list_temp', {list: json}); | |
| 374 | + $('#datatable_devicegps tbody').html(bodyHtm); | |
| 375 | + $('.dt').each(function(){ | |
| 376 | + $(this).html(moment(parseInt($(this).html())).format('YYYY-M-D HH:mm:ss')); | |
| 377 | + }); | |
| 378 | + layer.close(i); | |
| 379 | + }); | |
| 380 | + } | |
| 381 | + | |
| 382 | + //搜索线路 | |
| 383 | + $('#line').select2({ | |
| 384 | + ajax: { | |
| 385 | + url: '/realSchedule/findLine', | |
| 386 | + type: 'post', | |
| 387 | + dataType: 'json', | |
| 388 | + delay: 150, | |
| 389 | + data: function(params){ | |
| 390 | + return{line: params.term}; | |
| 391 | + }, | |
| 392 | + processResults: function (data) { | |
| 393 | + return { | |
| 394 | + results: data | |
| 395 | + }; | |
| 396 | + }, | |
| 397 | + cache: true | |
| 398 | + }, | |
| 399 | + templateResult: function(repo){ | |
| 400 | + if (repo.loading) return repo.text; | |
| 401 | + var h = '<span>'+repo.text+'</span>'; | |
| 402 | + return h; | |
| 403 | + }, | |
| 404 | + escapeMarkup: function (markup) { return markup; }, | |
| 405 | + minimumInputLength: 1, | |
| 406 | + templateSelection: function(repo){ | |
| 407 | + return repo.text; | |
| 408 | + }, | |
| 409 | + language: { | |
| 410 | + noResults: function(){ | |
| 411 | + return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | |
| 412 | + }, | |
| 413 | + inputTooShort : function(e) { | |
| 414 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | |
| 415 | + }, | |
| 416 | + searching : function() { | |
| 417 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | |
| 418 | + } | |
| 419 | + } | |
| 420 | + }); | |
| 421 | +}); | |
| 422 | +</script> | |
| 0 | 423 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/edit_report.html
| ... | ... | @@ -74,18 +74,18 @@ |
| 74 | 74 | <div class="form-group has-success has-feedback" ng-if="ctrl.type == 1"> |
| 75 | 75 | <label class="col-md-2 control-label">车辆配置-修改后*:</label> |
| 76 | 76 | <div class="col-md-3"> |
| 77 | - <sa-Select3 model="ctrl.groupInfo" | |
| 78 | - name="cl_after" | |
| 79 | - placeholder="请输拼音..." | |
| 80 | - dcvalue="{{ctrl.groupInfo.clId}}" | |
| 77 | + <sa-Select5 name="cl_after" | |
| 78 | + model="ctrl.groupInfo" | |
| 79 | + cmaps="{'clId' : 'id', 'clZbh': 'insideCode'}" | |
| 81 | 80 | dcname="clId" |
| 82 | 81 | icname="id" |
| 83 | - dcname2="clZbh" | |
| 84 | - icname2="insideCode" | |
| 85 | - icnames="insideCode" | |
| 86 | - datatype="cci3" | |
| 82 | + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'cci3' } | json }}" | |
| 83 | + iterobjname="item" | |
| 84 | + iterobjexp="item.insideCode" | |
| 85 | + searchph="请输拼音..." | |
| 86 | + searchexp="this.insideCode" | |
| 87 | 87 | required > |
| 88 | - </sa-Select3> | |
| 88 | + </sa-Select5> | |
| 89 | 89 | </div> |
| 90 | 90 | <!-- 隐藏块,显示验证信息 --> |
| 91 | 91 | <div class="alert alert-danger well-sm" ng-show="myForm.cl_after.$error.required"> |
| ... | ... | @@ -121,21 +121,18 @@ |
| 121 | 121 | <div class="form-group has-success has-feedback" ng-if="ctrl.type == 3"> |
| 122 | 122 | <label class="col-md-2 control-label">驾驶员-修改后*:</label> |
| 123 | 123 | <div class="col-md-3"> |
| 124 | - <sa-Select3 model="ctrl.groupInfo" | |
| 125 | - name="jsy" | |
| 126 | - placeholder="请输拼音..." | |
| 127 | - dcvalue="{{ctrl.groupInfo.jsy1Id}}" | |
| 124 | + <sa-Select5 name="jsy" | |
| 125 | + model="ctrl.groupInfo" | |
| 126 | + cmaps="{'jsy1Id' : 'id', 'jsy1Gh': 'jobCode', 'jsy1Name': 'personnelName'}" | |
| 128 | 127 | dcname="jsy1Id" |
| 129 | - icname="jsyId" | |
| 130 | - dcname2="jsy1Gh" | |
| 131 | - icname2="jsyGh" | |
| 132 | - dcname3="jsy1Name" | |
| 133 | - icname3="jsyName" | |
| 134 | - icnames="jsyName" | |
| 135 | - datatype="eci" | |
| 136 | - mlp="true" | |
| 128 | + icname="id" | |
| 129 | + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'ry' } | json }}" | |
| 130 | + iterobjname="item" | |
| 131 | + iterobjexp="item.personnelName + '(' + item.jobCode + ')'" | |
| 132 | + searchph="请输拼音..." | |
| 133 | + searchexp="this.personnelName + '(' + this.jobCode + ')'" | |
| 137 | 134 | required > |
| 138 | - </sa-Select3> | |
| 135 | + </sa-Select5> | |
| 139 | 136 | </div> |
| 140 | 137 | <!-- 隐藏块,显示验证信息 --> |
| 141 | 138 | <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required"> |
| ... | ... | @@ -145,26 +142,24 @@ |
| 145 | 142 | <div class="form-group" ng-if="ctrl.type == 3"> |
| 146 | 143 | <label class="col-md-2 control-label">售票员-修改前:</label> |
| 147 | 144 | <div class="col-md-3"> |
| 148 | - <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy1Name + '(' + ctrl.groupInfo_src.spy1Gh + ')'" readonly/> | |
| 145 | + <input type="text" class="form-control" name="spy_before" ng-value="ctrl.groupInfo_src.spy1Id == null ? '' : (ctrl.groupInfo_src.spy1Name + '(' + ctrl.groupInfo_src.spy1Gh + ')')" readonly/> | |
| 149 | 146 | </div> |
| 150 | 147 | </div> |
| 151 | 148 | <div class="form-group" ng-if="ctrl.type == 3"> |
| 152 | 149 | <label class="col-md-2 control-label">售票员-修改后:</label> |
| 153 | 150 | <div class="col-md-3"> |
| 154 | - <sa-Select3 model="ctrl.groupInfo" | |
| 155 | - name="spy" | |
| 156 | - placeholder="请输拼音..." | |
| 157 | - dcvalue="{{ctrl.groupInfo.spy1Id}}" | |
| 151 | + <sa-Select5 name="spy" | |
| 152 | + model="ctrl.groupInfo" | |
| 153 | + cmaps="{'spy1Id' : 'id', 'spy1Gh': 'jobCode', 'spy1Name': 'personnelName'}" | |
| 158 | 154 | dcname="spy1Id" |
| 159 | - icname="spyId" | |
| 160 | - dcname2="spy1Gh" | |
| 161 | - icname2="spyGh" | |
| 162 | - dcname3="spy1Name" | |
| 163 | - icname3="spyName" | |
| 164 | - icnames="spyName" | |
| 165 | - datatype="eci2" | |
| 166 | - mlp="true"> | |
| 167 | - </sa-Select3> | |
| 155 | + icname="id" | |
| 156 | + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'ry' } | json }}" | |
| 157 | + iterobjname="item" | |
| 158 | + iterobjexp="item.personnelName + '(' + item.jobCode + ')'" | |
| 159 | + searchph="请输拼音..." | |
| 160 | + searchexp="this.personnelName + '(' + this.jobCode + ')'" | |
| 161 | + > | |
| 162 | + </sa-Select5> | |
| 168 | 163 | </div> |
| 169 | 164 | </div> |
| 170 | 165 | |
| ... | ... | @@ -196,21 +191,18 @@ |
| 196 | 191 | <div class="form-group has-success has-feedback" ng-if="ctrl.type == 5"> |
| 197 | 192 | <label class="col-md-2 control-label">驾驶员-修改后*:</label> |
| 198 | 193 | <div class="col-md-3"> |
| 199 | - <sa-Select3 model="ctrl.groupInfo" | |
| 200 | - name="jsy" | |
| 201 | - placeholder="请输拼音..." | |
| 202 | - dcvalue="{{ctrl.groupInfo.jsy2Id}}" | |
| 194 | + <sa-Select5 name="jsy" | |
| 195 | + model="ctrl.groupInfo" | |
| 196 | + cmaps="{'jsy2Id' : 'id', 'jsy2Gh': 'jobCode', 'jsy2Name': 'personnelName'}" | |
| 203 | 197 | dcname="jsy2Id" |
| 204 | - icname="jsyId" | |
| 205 | - dcname2="jsy2Gh" | |
| 206 | - icname2="jsyGh" | |
| 207 | - dcname3="jsy2Name" | |
| 208 | - icname3="jsyName" | |
| 209 | - icnames="jsyName" | |
| 210 | - datatype="eci" | |
| 211 | - mlp="true" | |
| 198 | + icname="id" | |
| 199 | + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'ry' } | json }}" | |
| 200 | + iterobjname="item" | |
| 201 | + iterobjexp="item.personnelName + '(' + item.jobCode + ')'" | |
| 202 | + searchph="请输拼音..." | |
| 203 | + searchexp="this.personnelName + '(' + this.jobCode + ')'" | |
| 212 | 204 | required > |
| 213 | - </sa-Select3> | |
| 205 | + </sa-Select5> | |
| 214 | 206 | </div> |
| 215 | 207 | <!-- 隐藏块,显示验证信息 --> |
| 216 | 208 | <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required"> |
| ... | ... | @@ -220,26 +212,24 @@ |
| 220 | 212 | <div class="form-group" ng-if="ctrl.type == 5"> |
| 221 | 213 | <label class="col-md-2 control-label">售票员-修改前:</label> |
| 222 | 214 | <div class="col-md-3"> |
| 223 | - <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy2Name + '(' + ctrl.groupInfo_src.spy2Gh + ')'" readonly/> | |
| 215 | + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy2Id == null ? '' : (ctrl.groupInfo_src.spy2Name + '(' + ctrl.groupInfo_src.spy2Gh + ')')" readonly/> | |
| 224 | 216 | </div> |
| 225 | 217 | </div> |
| 226 | 218 | <div class="form-group" ng-if="ctrl.type == 5"> |
| 227 | 219 | <label class="col-md-2 control-label">售票员-修改后:</label> |
| 228 | 220 | <div class="col-md-3"> |
| 229 | - <sa-Select3 model="ctrl.groupInfo" | |
| 230 | - name="spy" | |
| 231 | - placeholder="请输拼音..." | |
| 232 | - dcvalue="{{ctrl.groupInfo.spy2Id}}" | |
| 221 | + <sa-Select5 name="spy" | |
| 222 | + model="ctrl.groupInfo" | |
| 223 | + cmaps="{'spy2Id' : 'id', 'spy2Gh': 'jobCode', 'spy2Name': 'personnelName'}" | |
| 233 | 224 | dcname="spy2Id" |
| 234 | - icname="spyId" | |
| 235 | - dcname2="spy2Gh" | |
| 236 | - icname2="spyGh" | |
| 237 | - dcname3="spy2Name" | |
| 238 | - icname3="spyName" | |
| 239 | - icnames="spyName" | |
| 240 | - datatype="eci2" | |
| 241 | - mlp="true"> | |
| 242 | - </sa-Select3> | |
| 225 | + icname="id" | |
| 226 | + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'ry' } | json }}" | |
| 227 | + iterobjname="item" | |
| 228 | + iterobjexp="item.personnelName + '(' + item.jobCode + ')'" | |
| 229 | + searchph="请输拼音..." | |
| 230 | + searchexp="this.personnelName + '(' + this.jobCode + ')'" | |
| 231 | + > | |
| 232 | + </sa-Select5> | |
| 243 | 233 | </div> |
| 244 | 234 | </div> |
| 245 | 235 | |
| ... | ... | @@ -252,7 +242,8 @@ |
| 252 | 242 | <div class="row"> |
| 253 | 243 | <div class="col-md-offset-3 col-md-4"> |
| 254 | 244 | <button type="submit" class="btn green" |
| 255 | - ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> | |
| 245 | + ng-disabled="!myForm.$valid" | |
| 246 | + ><i class="fa fa-check"></i> 提交</button> | |
| 256 | 247 | <a type="button" class="btn default" ui-sref="schedulePlanReportManage" ><i class="fa fa-times"></i> 取消</a> |
| 257 | 248 | </div> |
| 258 | 249 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list_report.html
| ... | ... | @@ -5,10 +5,10 @@ |
| 5 | 5 | <thead> |
| 6 | 6 | <tr role="row" class="heading"> |
| 7 | 7 | <th style="width: 50px;">序号</th> |
| 8 | - <th style="width: 230px;">线路</th> | |
| 8 | + <th style="width: 180px;">线路</th> | |
| 9 | 9 | <th style="width: 180px">日期</th> |
| 10 | - <th style="width: 60px">路牌</th> | |
| 11 | - <th style="width: 100px;">车辆</th> | |
| 10 | + <th style="width: 50px">路牌</th> | |
| 11 | + <th style="width: 130px;">车辆</th> | |
| 12 | 12 | <th style="width: 80px;">出场1</th> |
| 13 | 13 | <th style="width: 100px;">驾工1</th> |
| 14 | 14 | <th style="width: 100px;">驾1</th> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js
| ... | ... | @@ -215,7 +215,8 @@ angular.module('ScheduleApp').controller('SchedulePlanReportManageFormCtrl', [ |
| 215 | 215 | 'SchedulePlanReportManageService', |
| 216 | 216 | '$stateParams', |
| 217 | 217 | '$state', |
| 218 | - function(schedulePlanReportManageService, $stateParams, $state) { | |
| 218 | + '$scope', | |
| 219 | + function(schedulePlanReportManageService, $stateParams, $state, $scope) { | |
| 219 | 220 | var self = this; |
| 220 | 221 | |
| 221 | 222 | // 传过来的值 |
| ... | ... | @@ -238,14 +239,12 @@ angular.module('ScheduleApp').controller('SchedulePlanReportManageFormCtrl', [ |
| 238 | 239 | src: self.groupInfo_src, |
| 239 | 240 | update: self.groupInfo |
| 240 | 241 | }; |
| 242 | + | |
| 243 | + //console.log($scope); | |
| 244 | + //console.log(param); | |
| 241 | 245 | schedulePlanReportManageService.updateDetail(param).then( |
| 242 | 246 | function(result) { |
| 243 | - if (result.status == 'SUCCESS') { | |
| 244 | - alert("保存成功!"); | |
| 245 | - $state.go("schedulePlanReportManage"); | |
| 246 | - } else { | |
| 247 | - alert("保存异常!"); | |
| 248 | - } | |
| 247 | + $state.go("schedulePlanReportManage"); | |
| 249 | 248 | }, |
| 250 | 249 | function(result) { |
| 251 | 250 | alert("出错啦!"); | ... | ... |
src/main/resources/static/real_control_v2/css/line_schedule.css
| ... | ... | @@ -190,6 +190,10 @@ |
| 190 | 190 | font-weight: 600; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | +.schedule-body .ct_table dl._search_hide{ | |
| 194 | + display: none !important; | |
| 195 | +} | |
| 196 | + | |
| 193 | 197 | .context-menu-list.schedule-ct-menu { |
| 194 | 198 | /*font-size: 13px;*/ |
| 195 | 199 | font-family: 微软雅黑; |
| ... | ... | @@ -333,6 +337,12 @@ dd.tl-zzzx { |
| 333 | 337 | width: 100%; |
| 334 | 338 | } |
| 335 | 339 | |
| 340 | +.ct-form-modal span.uk-form-help-inline, | |
| 341 | +.ct-form-modal p.uk-form-help-block{ | |
| 342 | + color: #888888; | |
| 343 | + font-size: 13px; | |
| 344 | +} | |
| 345 | + | |
| 336 | 346 | |
| 337 | 347 | /** 批量待发调整 */ |
| 338 | 348 | |
| ... | ... | @@ -706,3 +716,47 @@ input.i-cbox[type=checkbox]{ |
| 706 | 716 | .sch-tzrc-table.ct_table>.ct_table_body dl.context-menu-active{ |
| 707 | 717 | background: #e6e6e6; |
| 708 | 718 | } |
| 719 | + | |
| 720 | +.search_sch_panel{ | |
| 721 | + float: right; | |
| 722 | +} | |
| 723 | + | |
| 724 | +.search_sch_panel .uk-form input[type=text]{ | |
| 725 | + width: 80px; | |
| 726 | + background: #fafafa; | |
| 727 | + border: 0; | |
| 728 | + border-bottom: 1px solid #ddd; | |
| 729 | + font-size: 14px; | |
| 730 | + height: 20px; | |
| 731 | + transition: all .3s ease; | |
| 732 | +} | |
| 733 | + | |
| 734 | +.search_sch_panel .uk-form div.uk-form-icon.active input[type=text]{ | |
| 735 | + width: 145px; | |
| 736 | +} | |
| 737 | + | |
| 738 | +.search_sch_panel .uk-form div.uk-form-icon i.cancel{ | |
| 739 | + position: absolute; | |
| 740 | + right: 8px; | |
| 741 | + font-size: 13px; | |
| 742 | + color: #c3b9ba; | |
| 743 | + cursor: pointer; | |
| 744 | + display: none; | |
| 745 | + padding: 0; | |
| 746 | + pointer-events: auto; | |
| 747 | + width: 18px; | |
| 748 | + text-indent: 0; | |
| 749 | +} | |
| 750 | + | |
| 751 | +/*.search_sch_panel .uk-form div.uk-form-icon i.cancel:before{*/ | |
| 752 | + | |
| 753 | +/*}*/ | |
| 754 | + | |
| 755 | +.search_sch_panel .uk-form div.uk-form-icon.active i.cancel{ | |
| 756 | + display: block; | |
| 757 | +} | |
| 758 | + | |
| 759 | +.search_sch_panel .uk-form input[type=text]::-webkit-input-placeholder{ | |
| 760 | + font-size: 12px; | |
| 761 | + color: #cecece; | |
| 762 | +} | ... | ... |
src/main/resources/static/real_control_v2/css/sch_autocomp_result.css
0 → 100644
| 1 | +.uk-autocomplete.sch-search-autocom .uk-dropdown { | |
| 2 | + width: 260px; | |
| 3 | + max-height: 500px; | |
| 4 | + overflow: auto; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.sch-search-results>li { | |
| 8 | + position: relative; | |
| 9 | + /*line-height: 18px;*/ | |
| 10 | +} | |
| 11 | + | |
| 12 | +.sch-search-results>li.uk-active small { | |
| 13 | + color: #ebeaea; | |
| 14 | +} | |
| 15 | + | |
| 16 | +.sch-search-results small { | |
| 17 | + /*display: block;*/ | |
| 18 | + /*color: #9b9797; | |
| 19 | + margin-left: 9px;*/ | |
| 20 | + color: #009dd8; | |
| 21 | +} | |
| 22 | + | |
| 23 | +.sch-search-results small.search-result-desc { | |
| 24 | + white-space: nowrap; | |
| 25 | + overflow: hidden; | |
| 26 | + display: block; | |
| 27 | + text-overflow: ellipsis; | |
| 28 | + margin-left: 0; | |
| 29 | + color: #9b9797; | |
| 30 | +} | |
| 31 | + | |
| 32 | + | |
| 33 | +/*.sch-search-results div.exec_sch_badge { | |
| 34 | + position: absolute; | |
| 35 | + top: 8px; | |
| 36 | + right: 3px; | |
| 37 | + background: #96f396; | |
| 38 | + text-indent: 0; | |
| 39 | + padding: 0 3px; | |
| 40 | + border-radius: 5px; | |
| 41 | + color: #7b5d5d; | |
| 42 | +}*/ | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
| ... | ... | @@ -7,6 +7,17 @@ |
| 7 | 7 | {{else}} |
| 8 | 8 | 下行/{{line.endStationName}} |
| 9 | 9 | {{/if}} |
| 10 | + <div class="search_sch_panel"> | |
| 11 | + <form class="uk-form" onsubmit="javascript:return false;"> | |
| 12 | + <div class="uk-autocomplete sch-search-autocom"> | |
| 13 | + <div class="uk-form-icon"> | |
| 14 | + <i class="uk-icon-search"></i> | |
| 15 | + <input type="text" placeholder="search"> | |
| 16 | + <i class="cancel uk-icon-times-circle" data-uk-tooltip="{pos:'right'}" title="取消过滤"></i> | |
| 17 | + </div> | |
| 18 | + </div> | |
| 19 | + </form> | |
| 20 | + </div> | |
| 10 | 21 | </h3> |
| 11 | 22 | <div class="schedule-body"> |
| 12 | 23 | <div class="ct_table_wrap"> | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/sys_mailbox.html
| ... | ... | @@ -16,9 +16,9 @@ |
| 16 | 16 | <div class="uk-width-medium-1-1 sys-note-42" id="{{domId}}"> |
| 17 | 17 | <div class="uk-panel uk-panel-box uk-panel-box-secondary"> |
| 18 | 18 | <h5 class="title"> |
| 19 | - {{t.fcsjActual}} {{t.clZbh}} 已由 {{t.qdzName}} 发出 | |
| 19 | + {{t.fcsjActual}} {{t.clZbh}} 已由 {{t.qdzName}} 发出,执行班次 {{t.dfsj}} | |
| 20 | 20 | </h5> |
| 21 | - <code>{{dataStr}}</code> | |
| 21 | + <code>{{t.fcsjActual}}</code> | |
| 22 | 22 | <div class="uk-button-group"> |
| 23 | 23 | <a class="uk-button uk-button-mini uk-button-primary" >确定</a> |
| 24 | 24 | </div> |
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | 已完成当日所有班次。 |
| 37 | 37 | {{/if}} |
| 38 | 38 | </h5> |
| 39 | - <code>{{dataStr}}</code> | |
| 39 | + <code>{{t.zdsjActual}}</code> | |
| 40 | 40 | <div class="uk-button-group"> |
| 41 | 41 | <a class="uk-button uk-button-mini uk-button-primary" >确定</a> |
| 42 | 42 | </div> | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/tts_config.html
0 → 100644
| 1 | +<div class="uk-modal ct-form-modal" id="tts-config-modal"> | |
| 2 | + <div class="uk-modal-dialog" style="width: 530px;"> | |
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | + <div class="uk-modal-header"> | |
| 5 | + <h2>TTS 语音设置</h2></div> | |
| 6 | + | |
| 7 | + <p style="border-bottom: 1px solid #efefef;color: grey;padding-bottom: 9px;"> | |
| 8 | + <small> | |
| 9 | + <i class="uk-icon-question-circle"> </i> | |
| 10 | + 设置项将会保存在本地客户端,清理缓存和更换电脑会重置.</small> | |
| 11 | + </p> | |
| 12 | + <form class="uk-form uk-form-horizontal"> | |
| 13 | + <div class="uk-grid"> | |
| 14 | + <div class="uk-width-2-3 uk-container-center"> | |
| 15 | + <div class="uk-form-row"> | |
| 16 | + <label class="uk-form-label">启用TTS</label> | |
| 17 | + <div class="uk-form-controls"> | |
| 18 | + <select name="enable"> | |
| 19 | + <option value="1">启用</option> | |
| 20 | + <option value="0">禁用</option> | |
| 21 | + </select> | |
| 22 | + </div> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + </div> | |
| 26 | + <div class="uk-grid"> | |
| 27 | + <div class="uk-width-2-3 uk-container-center"> | |
| 28 | + <div class="uk-form-row"> | |
| 29 | + <label class="uk-form-label">发音速度</label> | |
| 30 | + <div class="uk-form-controls"> | |
| 31 | + <input name="rate" max=10 data-fv-lessthan-inclusive="false" style="width: calc(100% - 80px);" /> | |
| 32 | + <span class="uk-form-help-inline">1 ~ 10</span> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + </div> | |
| 36 | + </div> | |
| 37 | + | |
| 38 | + <div class="uk-grid"> | |
| 39 | + <div class="uk-width-2-3 uk-container-center"> | |
| 40 | + <div class="uk-form-row"> | |
| 41 | + <label class="uk-form-label">播放队列</label> | |
| 42 | + <div class="uk-form-controls"> | |
| 43 | + <select name="queueModel"> | |
| 44 | + <option value="1">总是最新</option> | |
| 45 | + <option value="-1">按顺序完整播报</option> | |
| 46 | + </select> | |
| 47 | + <p class="uk-form-help-block"></p> | |
| 48 | + </div> | |
| 49 | + </div> | |
| 50 | + </div> | |
| 51 | + </div> | |
| 52 | + | |
| 53 | + <div class="uk-grid"> | |
| 54 | + <div class="uk-width-1-1" style="margin-top: 25px;"> | |
| 55 | + <div class="uk-panel uk-panel-box" style="font-size: 12px;color: grey;"> | |
| 56 | + 我能吞下玻璃而不伤身体 | |
| 57 | + <button class="uk-button uk-button-success uk-button-mini" type="button" id="tts-audition-btn"> | |
| 58 | + <i class="uk-icon-volume-down"> </i> 试听</button> | |
| 59 | + </div> | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | + | |
| 63 | + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;"> | |
| 64 | + <button type="button" class="uk-button uk-modal-close">取消</button> | |
| 65 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | |
| 66 | + </div> | |
| 67 | + </form> | |
| 68 | + </div> | |
| 69 | + | |
| 70 | + <script> | |
| 71 | + (function() { | |
| 72 | + var modal = '#tts-config-modal'; | |
| 73 | + var f = $('form', modal); | |
| 74 | + | |
| 75 | + $(modal).on('init', function(e, data) { | |
| 76 | + var config=gb_tts.defaultConfig(); | |
| 77 | + for(var name in config) | |
| 78 | + $('[name='+name+']', f).val(config[name]).trigger('change'); | |
| 79 | + | |
| 80 | + }); | |
| 81 | + | |
| 82 | + $('select[name=queueModel]', f).on('change', function(){ | |
| 83 | + var val=$(this).val() | |
| 84 | + ,$help=$(this).next('.uk-form-help-block'); | |
| 85 | + | |
| 86 | + if(val == 1) | |
| 87 | + $help.text('有新的语音,强制中断未结束的语音'); | |
| 88 | + else | |
| 89 | + $help.text('按照队列顺序依次完整播报'); | |
| 90 | + }); | |
| 91 | + | |
| 92 | + $('#tts-audition-btn', f).on('click', function(){ | |
| 93 | + var msg='我能吞下玻璃而不伤身体' | |
| 94 | + ,rate=$('[name=rate]',f).val(); | |
| 95 | + gb_tts.audition(msg, rate); | |
| 96 | + }); | |
| 97 | + | |
| 98 | + f.formValidation(gb_form_validation_opts); | |
| 99 | + f.on('success.form.fv', function(e) { | |
| 100 | + e.preventDefault(); | |
| 101 | + var data = $(this).serializeJSON(); | |
| 102 | + gb_tts.writeConfig(data); | |
| 103 | + UIkit.modal(modal).hide(); | |
| 104 | + notify_succ('TTS配置修改成功!'); | |
| 105 | + }); | |
| 106 | + | |
| 107 | + })(); | |
| 108 | + </script> | |
| 109 | +</div> | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_basic.js
| ... | ... | @@ -2,11 +2,12 @@ |
| 2 | 2 | |
| 3 | 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 | 7 | stationRoutes = routes; |
| 8 | 8 | lineCode2NameAll = code2Name; |
| 9 | 9 | lineInformations = informations; |
| 10 | + nbbm2deviceMap = nbbm2device; | |
| 10 | 11 | gb_main_ep.emitLater('data-basic'); |
| 11 | 12 | }); |
| 12 | 13 | |
| ... | ... | @@ -46,6 +47,11 @@ var gb_data_basic = (function() { |
| 46 | 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 | 55 | function findLineByCodes(codeArr){ |
| 50 | 56 | var rs=[]; |
| 51 | 57 | $.each(codeArr, function(){ |
| ... | ... | @@ -73,6 +79,7 @@ var gb_data_basic = (function() { |
| 73 | 79 | activeLines: activeLines, |
| 74 | 80 | line_idx: line_idx, |
| 75 | 81 | codeToLine: codeToLine, |
| 82 | + nbbm2deviceMap: function(){return nbbm2deviceMap;}, | |
| 76 | 83 | getLineInformation: getLineInformation, |
| 77 | 84 | stationRoutes: function(lineCode){return stationRoutes[lineCode]}, |
| 78 | 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 | 76 | return realData[deviceId]; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + var findGpsByNbbm = function(nbbm){ | |
| 80 | + return realData[gb_data_basic.nbbm2deviceMap()[nbbm]]; | |
| 81 | + } | |
| 82 | + | |
| 79 | 83 | return { |
| 80 | 84 | fixedTimeRefresh: fixedTimeRefresh, |
| 81 | 85 | registerCallback: registerCallback, |
| 82 | 86 | allGps: realData, |
| 83 | 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
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| ... | ... | @@ -5,12 +5,13 @@ var gb_schedule_table = (function() { |
| 5 | 5 | var temps; |
| 6 | 6 | //线路分组的班次数据 |
| 7 | 7 | var line2Schedule = {}; |
| 8 | - | |
| 8 | + //车辆应发未发车辆数 | |
| 9 | + var car_yfwf_map = {}; | |
| 9 | 10 | var schedule_sort = function(s1, s2) { |
| 10 | 11 | return s1.dfsjT - s2.dfsjT; |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | - var show = function() { | |
| 14 | + var show = function(cb) { | |
| 14 | 15 | //从服务器获取班次数据 |
| 15 | 16 | $.get('/realSchedule/lines', { |
| 16 | 17 | lines: gb_data_basic.line_idx |
| ... | ... | @@ -63,6 +64,8 @@ var gb_schedule_table = (function() { |
| 63 | 64 | gb_ct_table.enableSort($('.ct_table', content), reset_seq_no, gb_schedule_table_dbclick.init); |
| 64 | 65 | //dbclick event |
| 65 | 66 | gb_schedule_table_dbclick.init(); |
| 67 | + | |
| 68 | + cb && cb(); | |
| 66 | 69 | }); |
| 67 | 70 | } |
| 68 | 71 | |
| ... | ... | @@ -95,44 +98,44 @@ var gb_schedule_table = (function() { |
| 95 | 98 | } |
| 96 | 99 | |
| 97 | 100 | //新增一个班次,附带更新的班次 |
| 98 | - var insertSchedule=function(sch, upArr){ | |
| 99 | - line2Schedule[sch.xlBm][sch.id]=sch; | |
| 100 | - //update | |
| 101 | - if(isArray(upArr)){ | |
| 102 | - $.each(upArr, function(){ | |
| 103 | - line2Schedule[this.xlBm][this.id]=this; | |
| 104 | - }); | |
| 105 | - } | |
| 106 | - | |
| 107 | - //重新渲染表格 | |
| 108 | - var data=gb_common.get_vals(line2Schedule[sch.xlBm]).sort(schedule_sort) | |
| 109 | - ,dirData = gb_common.groupBy(data, 'xlDir') | |
| 110 | - ,tabCont=$('li.line_schedule[data-id='+sch.xlBm+']'); | |
| 111 | - | |
| 112 | - for (var upDown in dirData) { | |
| 113 | - htmlStr = temps['line-schedule-table-temp']({ | |
| 114 | - dir: upDown, | |
| 115 | - line: gb_data_basic.codeToLine[sch.xlBm], | |
| 116 | - list: dirData[upDown] | |
| 117 | - }); | |
| 118 | - $('.schedule-wrap .card-panel:eq(' + upDown + ')', tabCont).html(htmlStr); | |
| 119 | - } | |
| 120 | - calc_yfwf_num(sch.xlBm); | |
| 121 | - //定位到新添加的班次 | |
| 122 | - 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); | |
| 123 | 126 | } |
| 124 | 127 | |
| 125 | 128 | //删除一个班次 |
| 126 | - var deheteSchedule = function(sch){ | |
| 127 | - sch = line2Schedule[sch.xlBm][sch.id]; | |
| 128 | - if(sch){ | |
| 129 | - var dl = $('li.line_schedule[data-id=' + sch.xlBm + '] .ct_table_body dl[data-id=' + sch.id + ']') | |
| 130 | - ,dls=dl.parent().find('dl'); | |
| 131 | - delete line2Schedule[sch.xlBm][sch.id]; | |
| 132 | - dl.remove(); | |
| 133 | - reset_seq_no(dls); | |
| 134 | - calc_yfwf_num(sch.xlBm); | |
| 135 | - } | |
| 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 | + } | |
| 136 | 139 | } |
| 137 | 140 | |
| 138 | 141 | //更新班次 |
| ... | ... | @@ -148,7 +151,7 @@ var gb_schedule_table = (function() { |
| 148 | 151 | |
| 149 | 152 | //update dom |
| 150 | 153 | var updateDom = function(sch) { |
| 151 | - if(!sch) return; | |
| 154 | + if (!sch) return; | |
| 152 | 155 | var dl = $('li.line_schedule[data-id=' + sch.xlBm + '] .ct_table_body dl[data-id=' + sch.id + ']'); |
| 153 | 156 | var dds = $('dd', dl); |
| 154 | 157 | $(dds[1]).find('a').text(sch.lpName); |
| ... | ... | @@ -167,17 +170,17 @@ var gb_schedule_table = (function() { |
| 167 | 170 | calc_sch_real_shift(sch); |
| 168 | 171 | var sfsjDd = temps['line-schedule-sfsj-temp'](sch); |
| 169 | 172 | $(dds[7]).replaceWith(sfsjDd); |
| 170 | - if(sch.remarks) | |
| 171 | - $(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>'); | |
| 172 | 175 | else |
| 173 | - $(dds[8]).html(''); | |
| 176 | + $(dds[8]).html(''); | |
| 174 | 177 | } |
| 175 | 178 | |
| 176 | 179 | //拖拽选中... |
| 177 | 180 | var seq_nos = '.line-schedule-table .ct_table_body>dl>dd.seq_no'; |
| 178 | 181 | var drag_strat; |
| 179 | 182 | $(document).on('mousedown', seq_nos, function(e) { |
| 180 | - if(e.button != 0) return; | |
| 183 | + if (e.button != 0) return; | |
| 181 | 184 | var dl = $(this).parent(); |
| 182 | 185 | if (dl.hasClass('drag-active')) |
| 183 | 186 | dl.removeClass('drag-active'); |
| ... | ... | @@ -189,15 +192,20 @@ var gb_schedule_table = (function() { |
| 189 | 192 | drag_strat = null; |
| 190 | 193 | }).on('mouseover', seq_nos, function() { |
| 191 | 194 | if (drag_strat) { |
| 192 | - var drag_end = parseInt($(this).text()), | |
| 195 | + var e = parseInt($(this).text()), | |
| 193 | 196 | dls = $(this).parents('.ct_table_body').find('dl'); |
| 194 | 197 | |
| 195 | 198 | reset_drag_active_all(this); |
| 196 | - if (drag_end - drag_strat <= 1) | |
| 197 | - return; | |
| 198 | - | |
| 199 | - for (var i = drag_strat; i < drag_end; i++) | |
| 200 | - $(dls[i]).addClass('drag-active'); | |
| 199 | + //向上选中 | |
| 200 | + if (e <= drag_strat) { | |
| 201 | + for (var i = drag_strat; i > e - 2; i--) | |
| 202 | + $(dls[i]).addClass('drag-active'); | |
| 203 | + } | |
| 204 | + //向下选中 | |
| 205 | + else { | |
| 206 | + for (var j = drag_strat; j < e; j++) | |
| 207 | + $(dls[j]).addClass('drag-active'); | |
| 208 | + } | |
| 201 | 209 | } |
| 202 | 210 | }).on('click', seq_nos, function() { |
| 203 | 211 | reset_relevance_active(this); |
| ... | ... | @@ -213,22 +221,22 @@ var gb_schedule_table = (function() { |
| 213 | 221 | schArr = gb_common.get_vals(line2Schedule[lineCode]).filter(function(item) { |
| 214 | 222 | return item.clZbh == sch.clZbh; |
| 215 | 223 | }).sort(schedule_sort), |
| 216 | - nextSch,tempDL; | |
| 224 | + nextSch, tempDL; | |
| 217 | 225 | $.each(schArr, function(i) { |
| 218 | - tempDL=$('dl[data-id=' + this.id + ']', contWrap); | |
| 226 | + tempDL = $('dl[data-id=' + this.id + ']', contWrap); | |
| 219 | 227 | tempDL.addClass('relevance-active'); |
| 220 | - if (i < schArr.length - 1 && this.id == id){ | |
| 221 | - nextSch = schArr[i + 1]; | |
| 222 | - tempDL.addClass('intimity'); | |
| 228 | + if (i < schArr.length - 1 && this.id == id) { | |
| 229 | + nextSch = schArr[i + 1]; | |
| 230 | + tempDL.addClass('intimity'); | |
| 223 | 231 | } |
| 224 | 232 | }); |
| 225 | 233 | |
| 226 | - if(nextSch){ | |
| 227 | - $('dl[data-id=' + nextSch.id + ']', contWrap).addClass('intimity'); | |
| 228 | - if (nextSch.xlDir == sch.xlDir) | |
| 229 | - return; | |
| 230 | - //滚动到下一个班次 | |
| 231 | - 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); | |
| 232 | 240 | } |
| 233 | 241 | }); |
| 234 | 242 | |
| ... | ... | @@ -275,25 +283,33 @@ var gb_schedule_table = (function() { |
| 275 | 283 | $(dd).parents('.uk-grid.schedule-wrap').find('.relevance-active').removeClass('relevance-active intimity'); |
| 276 | 284 | } |
| 277 | 285 | |
| 278 | - //计算应发未发数量 | |
| 279 | - var calc_yfwf_num = function(lineCode){ | |
| 280 | 286 | |
| 281 | - var schArr=line2Schedule[lineCode] | |
| 282 | - ,yfwf_num=0 | |
| 283 | - ,t = new Date().valueOf(); | |
| 287 | + //计算应发未发数量 car_yfwf_map | |
| 288 | + var calc_yfwf_num = function(lineCode) { | |
| 284 | 289 | |
| 285 | - $.each(schArr, function(){ | |
| 286 | - if(this.fcsjT > t) | |
| 287 | - return false; | |
| 290 | + var schArr = gb_common.get_vals(line2Schedule[lineCode]).sort(schedule_sort), | |
| 291 | + yfwf_num = 0, | |
| 292 | + t = new Date().valueOf(); | |
| 288 | 293 | |
| 289 | - if(this.fcsjActual == null && this.fcsjActualTime == null && this.status != -1) | |
| 290 | - yfwf_num ++; | |
| 291 | - }); | |
| 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; | |
| 292 | 309 | |
| 293 | - $('#badge_yfwf_num_'+lineCode).text(yfwf_num); | |
| 310 | + $('#badge_yfwf_num_' + lineCode).text(yfwf_num); | |
| 294 | 311 | } |
| 295 | 312 | |
| 296 | - | |
| 297 | 313 | return { |
| 298 | 314 | show: show, |
| 299 | 315 | findScheduleByLine: findScheduleByLine, |
| ... | ... | @@ -301,6 +317,7 @@ var gb_schedule_table = (function() { |
| 301 | 317 | deheteSchedule: deheteSchedule, |
| 302 | 318 | insertSchedule: insertSchedule, |
| 303 | 319 | schedule_sort: schedule_sort, |
| 304 | - calc_yfwf_num: calc_yfwf_num | |
| 320 | + calc_yfwf_num: calc_yfwf_num, | |
| 321 | + car_yfwf_map: function(lineCode){return car_yfwf_map[lineCode];} | |
| 305 | 322 | }; |
| 306 | 323 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/search.js
0 → 100644
| 1 | +/** 班次搜索 */ | |
| 2 | +var gb_sch_search = (function() { | |
| 3 | + | |
| 4 | + //搜索结果模板,和art-template冲突。 用字符串渲染 | |
| 5 | + var result_template = '<script type="text/autocomplete">' + | |
| 6 | + ' <ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results sch-search-results">' + | |
| 7 | + ' {{~items}}' + | |
| 8 | + ' <li data-value="{{ $item.value }}">' + | |
| 9 | + ' <a>' + | |
| 10 | + ' {{ $item.value }}' + | |
| 11 | + ' <small >{{$item.exec}}</small>' + | |
| 12 | + ' <small class="search-result-desc">{{{ $item.desc }}}</small>' + | |
| 13 | + ' </a>' + | |
| 14 | + ' </li>' + | |
| 15 | + ' {{/items}}' + | |
| 16 | + ' </ul>' + | |
| 17 | + '</script>'; | |
| 18 | + | |
| 19 | + var ips = '.search_sch_panel input', | |
| 20 | + _input, schArr, lineCode, group_cars; | |
| 21 | + $(document) | |
| 22 | + .on('focus', ips, function() { | |
| 23 | + $(this).parent().addClass('active'); | |
| 24 | + lineCode = $(this).parents('li.line_schedule').data('id'); | |
| 25 | + schArr = gb_common.get_vals(gb_schedule_table.findScheduleByLine(lineCode)); | |
| 26 | + | |
| 27 | + group_cars = gb_common.groupBy(schArr, 'clZbh'); | |
| 28 | + _input = $(this); | |
| 29 | + }) | |
| 30 | + .on('blur', ips, function() { | |
| 31 | + if ($(this).val() == ''){ | |
| 32 | + reset_all(); | |
| 33 | + } | |
| 34 | + }); | |
| 35 | + | |
| 36 | + $(document).on('click', '.search_sch_panel i.cancel', function(){ | |
| 37 | + reset_all(); | |
| 38 | + }); | |
| 39 | + | |
| 40 | + var elements = '.search_sch_panel .sch-search-autocom'; | |
| 41 | + var init = function() { | |
| 42 | + $(elements).each(function() { | |
| 43 | + $(this).append(result_template); | |
| 44 | + constructor(this); | |
| 45 | + }); | |
| 46 | + }; | |
| 47 | + | |
| 48 | + var constructor = function(e) { | |
| 49 | + UIkit.autocomplete(e, { | |
| 50 | + minLength: 1, | |
| 51 | + delay: 10, | |
| 52 | + source: autocomplete_source | |
| 53 | + }).on('selectitem.uk.autocomplete', selectitem); | |
| 54 | + } | |
| 55 | + | |
| 56 | + var autocomplete_source = function(release) { | |
| 57 | + var rs = [], | |
| 58 | + v = _input.val().toUpperCase(), | |
| 59 | + gps, yfwf_map = gb_schedule_table.car_yfwf_map(lineCode); | |
| 60 | + | |
| 61 | + for (var car in group_cars) { | |
| 62 | + if (car.indexOf(v) != -1) { | |
| 63 | + //车辆对应的gps | |
| 64 | + gps = gb_data_gps.findGpsByNbbm(car) | |
| 65 | + rs.push({ | |
| 66 | + value: car, | |
| 67 | + desc: '应发未发:' + (yfwf_map[car] == null ? 0 : yfwf_map[car]), | |
| 68 | + exec: execSch(gps) | |
| 69 | + }); | |
| 70 | + } | |
| 71 | + } | |
| 72 | + | |
| 73 | + release && release(rs); | |
| 74 | + } | |
| 75 | + | |
| 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 | + } | |
| 102 | + | |
| 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 | + }); | |
| 112 | + } | |
| 113 | + | |
| 114 | + return { | |
| 115 | + init: init | |
| 116 | + }; | |
| 117 | +})(); | ... | ... |
src/main/resources/static/real_control_v2/js/main.js
| ... | ... | @@ -35,7 +35,10 @@ var gb_main_ep = new EventProxy(), |
| 35 | 35 | |
| 36 | 36 | //render schedule table |
| 37 | 37 | eq.once('render-sch-table', function() { |
| 38 | - gb_schedule_table.show(); | |
| 38 | + gb_schedule_table.show(function(){ | |
| 39 | + //搜索框 | |
| 40 | + gb_sch_search.init(); | |
| 41 | + }); | |
| 39 | 42 | |
| 40 | 43 | //嵌入地图页面 |
| 41 | 44 | $('li.map-panel','#main-tab-content').load('/real_control_v2/mapmonitor/real_monitor/real.html'); | ... | ... |
src/main/resources/static/real_control_v2/js/north/toolbar.js
| ... | ... | @@ -46,6 +46,9 @@ var gb_northToolbar = (function() { |
| 46 | 46 | }, |
| 47 | 47 | directive_history: function(){ |
| 48 | 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/utils/tts.js
0 → 100644
| 1 | +var gb_tts = (function() { | |
| 2 | + | |
| 3 | + var storage = window.localStorage; | |
| 4 | + var defaultConfig = { | |
| 5 | + //发音速度 1 ~ 10 | |
| 6 | + rate: 1.2, | |
| 7 | + //播放队列 1:覆盖式(总是播放最新) -1:完整的按顺序播报 | |
| 8 | + queueModel: 1, | |
| 9 | + enable: 1 | |
| 10 | + }; | |
| 11 | + | |
| 12 | + var readLocal = function() { | |
| 13 | + //从本地客户端读取配置信息 | |
| 14 | + var cofig = storage.getItem('tts_cofig'); | |
| 15 | + if (cofig) { | |
| 16 | + cofig = JSON.parse(cofig); | |
| 17 | + defaultConfig = cofig; | |
| 18 | + } | |
| 19 | + } | |
| 20 | + | |
| 21 | + var writeConfig = function(newConfig) { | |
| 22 | + storage.setItem('tts_cofig', JSON.stringify(newConfig)); | |
| 23 | + defaultConfig = newConfig; | |
| 24 | + } | |
| 25 | + | |
| 26 | + var synth = window.speechSynthesis; | |
| 27 | + readLocal(); | |
| 28 | + | |
| 29 | + var speak = function(t, lineCode) { | |
| 30 | + if (defaultConfig.enable != 1) | |
| 31 | + return; | |
| 32 | + if (defaultConfig.queueModel == 1) | |
| 33 | + synth.cancel(); | |
| 34 | + | |
| 35 | + t = gb_data_basic.codeToLine[lineCode].name + t; | |
| 36 | + //延迟100毫秒,防止中断旧语音时 将新的语音也中断 | |
| 37 | + setTimeout(function() { | |
| 38 | + var msg = new SpeechSynthesisUtterance(t); | |
| 39 | + msg.rate = defaultConfig.rate; | |
| 40 | + synth.speak(msg); | |
| 41 | + }, 100); | |
| 42 | + } | |
| 43 | + | |
| 44 | + var audition = function(t, rate) { | |
| 45 | + var msg = new SpeechSynthesisUtterance(t); | |
| 46 | + msg.rate = rate; | |
| 47 | + synth.speak(msg); | |
| 48 | + } | |
| 49 | + | |
| 50 | + return { | |
| 51 | + readLocal: readLocal, | |
| 52 | + writeConfig: writeConfig, | |
| 53 | + defaultConfig: function() { | |
| 54 | + return defaultConfig | |
| 55 | + }, | |
| 56 | + speak: speak, | |
| 57 | + audition: audition | |
| 58 | + }; | |
| 59 | +})(); | ... | ... |
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
| ... | ... | @@ -9,14 +9,7 @@ var gb_sch_websocket = (function() { |
| 9 | 9 | |
| 10 | 10 | schSock.onopen = function(e) { |
| 11 | 11 | console.log('webSocket[realcontrol] onopen'); |
| 12 | - setTimeout(function() { | |
| 13 | - //注册线路监听 | |
| 14 | - var data = { | |
| 15 | - operCode: 'register_line', | |
| 16 | - idx: gb_data_basic.line_idx | |
| 17 | - } | |
| 18 | - schSock.send(JSON.stringify(data)); | |
| 19 | - }, 500); | |
| 12 | + setTimeout(regListen, 500); | |
| 20 | 13 | }; |
| 21 | 14 | //接收消息 |
| 22 | 15 | schSock.onmessage = function(e) { |
| ... | ... | @@ -28,9 +21,22 @@ var gb_sch_websocket = (function() { |
| 28 | 21 | } |
| 29 | 22 | }; |
| 30 | 23 | |
| 24 | + function regListen (){ | |
| 25 | + //注册线路监听 | |
| 26 | + var data = { | |
| 27 | + operCode: 'register_line', | |
| 28 | + idx: gb_data_basic.line_idx | |
| 29 | + } | |
| 30 | + schSock.send(JSON.stringify(data)); | |
| 31 | + console.log('regListen....', data); | |
| 32 | + } | |
| 33 | + | |
| 31 | 34 | //断开 |
| 32 | 35 | schSock.onclose = function(e) { |
| 33 | 36 | alert('和服务器连接断开....'); |
| 37 | + console.log('和服务器连接断开....'); | |
| 38 | + regListen(); | |
| 39 | + | |
| 34 | 40 | }; |
| 35 | 41 | |
| 36 | 42 | //80协议上报 |
| ... | ... | @@ -38,7 +44,11 @@ var gb_sch_websocket = (function() { |
| 38 | 44 | msg.dateStr = moment(msg.timestamp).format('HH:mm'); |
| 39 | 45 | msg.text = gb_common.reqCode80[msg.data.requestCode]; |
| 40 | 46 | |
| 41 | - 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); | |
| 42 | 52 | } |
| 43 | 53 | |
| 44 | 54 | var waitRemoves = []; |
| ... | ... | @@ -47,12 +57,16 @@ var gb_sch_websocket = (function() { |
| 47 | 57 | gb_schedule_table.updateSchedule(msg.t); |
| 48 | 58 | msg.domId = 'fache_' + msg.t.id + '_' + parseInt(Math.random() * 10000); |
| 49 | 59 | |
| 50 | - 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); | |
| 51 | 62 | waitRemoves.push({ |
| 52 | 63 | t: currentSecond(), |
| 53 | 64 | dom: msg.domId |
| 54 | 65 | }); |
| 55 | 66 | |
| 67 | + //tts | |
| 68 | + var ttsMsg=$item.find('.title').text(); | |
| 69 | + gb_tts.speak(ttsMsg, msg.t.xlBm); | |
| 56 | 70 | gb_schedule_table.calc_yfwf_num(msg.t.xlBm); |
| 57 | 71 | } |
| 58 | 72 | |
| ... | ... | @@ -61,11 +75,15 @@ var gb_sch_websocket = (function() { |
| 61 | 75 | gb_schedule_table.updateSchedule(msg.t); |
| 62 | 76 | msg.domId = 'zhongDian_' + msg.t.id + '_' + parseInt(Math.random() * 10000); |
| 63 | 77 | |
| 64 | - 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); | |
| 65 | 80 | waitRemoves.push({ |
| 66 | 81 | t: currentSecond(), |
| 67 | 82 | dom: msg.domId |
| 68 | 83 | }); |
| 84 | + //tts | |
| 85 | + var ttsMsg=$item.find('.title').text(); | |
| 86 | + gb_tts.speak(ttsMsg, msg.t.xlBm); | |
| 69 | 87 | } |
| 70 | 88 | |
| 71 | 89 | //服务器通知刷新班次 | ... | ... |
src/main/resources/static/real_control_v2/main.html
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | <link rel="stylesheet" href="/real_control_v2/css/home.css" /> |
| 19 | 19 | <!-- line style --> |
| 20 | 20 | <link rel="stylesheet" href="/real_control_v2/css/line_schedule.css" /> |
| 21 | + <link rel="stylesheet" href="/real_control_v2/css/sch_autocomp_result.css" /> | |
| 21 | 22 | <!-- custom table --> |
| 22 | 23 | <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" /> |
| 23 | 24 | <!-- jquery contextMenu style --> |
| ... | ... | @@ -118,12 +119,15 @@ |
| 118 | 119 | <script src="/real_control_v2/js/line_schedule/sch_table.js"></script> |
| 119 | 120 | <script src="/real_control_v2/js/line_schedule/context_menu.js"></script> |
| 120 | 121 | <script src="/real_control_v2/js/line_schedule/dbclick.js"></script> |
| 122 | + <script src="/real_control_v2/js/line_schedule/search.js"></script> | |
| 121 | 123 | |
| 122 | 124 | <!-- 字典相关 --> |
| 123 | 125 | <script src="/assets/js/dictionary.js"></script> |
| 124 | 126 | <!-- websocket --> |
| 125 | 127 | <script src="/assets/js/sockjs.min.js"></script> |
| 126 | 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> | |
| 127 | 131 | </body> |
| 128 | 132 | |
| 129 | 133 | </html> | ... | ... |