Commit f125ea9ada1b701cbd1b05955461c55fc08f984a
1 parent
9bfed1f5
1.加入808模块映射车辆维护功能
Showing
12 changed files
with
1047 additions
and
0 deletions
src/main/java/com/bsth/DataSourceConfig.java
| @@ -31,6 +31,13 @@ public class DataSourceConfig { | @@ -31,6 +31,13 @@ public class DataSourceConfig { | ||
| 31 | return DataSourceBuilder.create().build(); | 31 | return DataSourceBuilder.create().build(); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | + @Bean(name = "msDataSource") | ||
| 35 | + @Qualifier("msDataSource") | ||
| 36 | + @ConfigurationProperties(prefix = "spring.datasource.ms") | ||
| 37 | + public DataSource msDataSource(){ | ||
| 38 | + return DataSourceBuilder.create().build(); | ||
| 39 | + } | ||
| 40 | + | ||
| 34 | @Bean(name = "jdbcTemplate") | 41 | @Bean(name = "jdbcTemplate") |
| 35 | @Primary | 42 | @Primary |
| 36 | public JdbcTemplate jdbcTemplate(@Qualifier("dataSource")DataSource dataSource){ | 43 | public JdbcTemplate jdbcTemplate(@Qualifier("dataSource")DataSource dataSource){ |
| @@ -41,4 +48,9 @@ public class DataSourceConfig { | @@ -41,4 +48,9 @@ public class DataSourceConfig { | ||
| 41 | public JdbcTemplate infoPublishJdbcTemplate(@Qualifier("infoPublishDataSource")DataSource dataSource){ | 48 | public JdbcTemplate infoPublishJdbcTemplate(@Qualifier("infoPublishDataSource")DataSource dataSource){ |
| 42 | return new JdbcTemplate(dataSource); | 49 | return new JdbcTemplate(dataSource); |
| 43 | } | 50 | } |
| 51 | + | ||
| 52 | + @Bean(name = "msJdbcTemplate") | ||
| 53 | + public JdbcTemplate msJdbcTemplate(@Qualifier("msDataSource")DataSource dataSource){ | ||
| 54 | + return new JdbcTemplate(dataSource); | ||
| 55 | + } | ||
| 44 | } | 56 | } |
src/main/java/com/bsth/controller/VehicleMappingController.java
0 → 100644
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.VehicleMapping; | ||
| 5 | +import com.bsth.service.VehicleMappingService; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("vehicle-mapping") | ||
| 19 | +public class VehicleMappingController { | ||
| 20 | + | ||
| 21 | + private final static Logger log = LoggerFactory.getLogger(VehicleMappingController.class); | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + private VehicleMappingService vehicleMappingService; | ||
| 25 | + | ||
| 26 | + @RequestMapping(method = RequestMethod.POST) | ||
| 27 | + public Map<String, Object> save(VehicleMapping vehicleMapping) { | ||
| 28 | + Map<String, Object> result = new HashMap<String, Object>(); | ||
| 29 | + result.put("status", ResponseCode.ERROR); | ||
| 30 | + try { | ||
| 31 | + vehicleMappingService.save(vehicleMapping); | ||
| 32 | + result.put("status", ResponseCode.SUCCESS); | ||
| 33 | + } catch (Exception e) { | ||
| 34 | + log.error("", e); | ||
| 35 | + result.put("msg", e.getMessage()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + return result; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 42 | + public Map<String, Object> findByParams(@RequestParam Map<String, Object> params) { | ||
| 43 | + Map<String, Object> result = new HashMap<>(); | ||
| 44 | + result.put("status", ResponseCode.ERROR); | ||
| 45 | + try { | ||
| 46 | + result.put("data", vehicleMappingService.findByParams(params)); | ||
| 47 | + result.put("status", ResponseCode.SUCCESS); | ||
| 48 | + } catch (Exception e) { | ||
| 49 | + log.error("", e); | ||
| 50 | + result.put("msg", e.getMessage()); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + return result; | ||
| 54 | + } | ||
| 55 | +} |
src/main/java/com/bsth/entity/VehicleMapping.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | + | ||
| 5 | +import java.util.Date; | ||
| 6 | + | ||
| 7 | +public class VehicleMapping { | ||
| 8 | + | ||
| 9 | + private int id; | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * 设备编号(对应Cars中equipment_code) | ||
| 13 | + */ | ||
| 14 | + private String deviceId; | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 关联的设备号 | ||
| 18 | + */ | ||
| 19 | + private String relationDeviceId; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * jt808中sim | ||
| 23 | + */ | ||
| 24 | + private String sim; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 关联sim | ||
| 28 | + */ | ||
| 29 | + private String relationSim; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 0 拓华设备信号优先 1 808设备信号优先 | ||
| 33 | + */ | ||
| 34 | + private int extEnabled; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 车辆编码(Cars中inside_code) | ||
| 38 | + */ | ||
| 39 | + private String inCode; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 线路编码 | ||
| 43 | + */ | ||
| 44 | + private int lineId; | ||
| 45 | + | ||
| 46 | + private String lineName; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 加入日期 | ||
| 50 | + */ | ||
| 51 | + private Date onlineDate; | ||
| 52 | + | ||
| 53 | + public int getId() { | ||
| 54 | + return id; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public void setId(int id) { | ||
| 58 | + this.id = id; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public String getDeviceId() { | ||
| 62 | + return deviceId; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void setDeviceId(String deviceId) { | ||
| 66 | + this.deviceId = deviceId; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public String getRelationDeviceId() { | ||
| 70 | + return relationDeviceId; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public void setRelationDeviceId(String relationDeviceId) { | ||
| 74 | + this.relationDeviceId = relationDeviceId; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public String getSim() { | ||
| 78 | + return sim; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public void setSim(String sim) { | ||
| 82 | + this.sim = sim; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public String getRelationSim() { | ||
| 86 | + return relationSim; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setRelationSim(String relationSim) { | ||
| 90 | + this.relationSim = relationSim; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public int getExtEnabled() { | ||
| 94 | + return extEnabled; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public void setExtEnabled(int extEnabled) { | ||
| 98 | + this.extEnabled = extEnabled; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public String getInCode() { | ||
| 102 | + return inCode; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public void setInCode(String inCode) { | ||
| 106 | + this.inCode = inCode; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public int getLineId() { | ||
| 110 | + return lineId; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setLineId(int lineId) { | ||
| 114 | + this.lineId = lineId; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public String getLineName() { | ||
| 118 | + String lineName = BasicData.lineCode2NameMap.get(String.valueOf(lineId)); | ||
| 119 | + | ||
| 120 | + return lineName; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setLineName(String lineName) { | ||
| 124 | + this.lineName = lineName; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public Date getOnlineDate() { | ||
| 128 | + return onlineDate; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setOnlineDate(Date onlineDate) { | ||
| 132 | + this.onlineDate = onlineDate; | ||
| 133 | + } | ||
| 134 | +} |
src/main/java/com/bsth/service/VehicleMappingService.java
0 → 100644
| 1 | +package com.bsth.service; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.VehicleMapping; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +public interface VehicleMappingService { | ||
| 9 | + | ||
| 10 | + void save(VehicleMapping vehicleMapping); | ||
| 11 | + | ||
| 12 | + List<VehicleMapping> findByParams(Map<String, Object> params); | ||
| 13 | +} |
src/main/java/com/bsth/service/impl/VehicleMappingServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.VehicleMapping; | ||
| 4 | +import com.bsth.service.VehicleMappingService; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
| 7 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 8 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | + | ||
| 11 | +import java.util.*; | ||
| 12 | + | ||
| 13 | +@Service | ||
| 14 | +public class VehicleMappingServiceImpl implements VehicleMappingService { | ||
| 15 | + | ||
| 16 | + @Autowired | ||
| 17 | + @Qualifier("msJdbcTemplate") | ||
| 18 | + private JdbcTemplate msJdbcTemplate; | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void save(VehicleMapping vehicleMapping) { | ||
| 22 | + StringBuilder sql = new StringBuilder(); | ||
| 23 | + List<Object> params = new ArrayList<>(); | ||
| 24 | + if (vehicleMapping.getId() == 0) { | ||
| 25 | + sql.append("insert into bsth_c_device_sim_mapping (device_id,relation_device_id,sim,relation_sim,ext_enabled,in_code,line_id,online_date) values (?, ?, ?, ?, ?, ?, ?, ?)"); | ||
| 26 | + params.addAll(Arrays.asList(vehicleMapping.getDeviceId(), vehicleMapping.getRelationDeviceId(), vehicleMapping.getSim(), vehicleMapping.getRelationSim(), vehicleMapping.getExtEnabled(), vehicleMapping.getInCode(), vehicleMapping.getLineId(), new Date())); | ||
| 27 | + } else { | ||
| 28 | + sql.append("update bsth_c_device_sim_mapping set device_id = ?,relation_device_id = ?,sim = ?,relation_sim = ?,ext_enabled = ?,in_code = ?,line_id = ? where id = ?"); | ||
| 29 | + params.addAll(Arrays.asList(vehicleMapping.getDeviceId(), vehicleMapping.getRelationDeviceId(), vehicleMapping.getSim(), vehicleMapping.getRelationSim(), vehicleMapping.getExtEnabled(), vehicleMapping.getInCode(), vehicleMapping.getLineId(), vehicleMapping.getId())); | ||
| 30 | + } | ||
| 31 | + msJdbcTemplate.update(sql.toString(), params.toArray()); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public List<VehicleMapping> findByParams(Map<String, Object> params) { | ||
| 36 | + List<Object> objs = new ArrayList<>(); | ||
| 37 | + StringBuilder sql = new StringBuilder("select * from bsth_c_device_sim_mapping where 1 = 1"); | ||
| 38 | + for (Map.Entry<String, Object> entry : params.entrySet()) { | ||
| 39 | + String key = entry.getKey(); | ||
| 40 | + if ("id".equals(key) || "lineId".equals(key) || "extEnabled".equals(key)) { | ||
| 41 | + sql.append(" and ").append(camelToSnake(key)).append(" = ?"); | ||
| 42 | + } else { | ||
| 43 | + sql.append(" and ").append(camelToSnake(key)).append(" like concat('%',?,'%')"); | ||
| 44 | + } | ||
| 45 | + objs.add(entry.getValue()); | ||
| 46 | + } | ||
| 47 | + List<VehicleMapping> list = msJdbcTemplate.query(sql.toString(), objs.toArray(), BeanPropertyRowMapper.newInstance(VehicleMapping.class)); | ||
| 48 | + return list; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public static String camelToSnake(String str) { | ||
| 52 | + return str.replaceAll("([a-z])([A-Z]+)", "$1_$2").toLowerCase(); | ||
| 53 | + } | ||
| 54 | +} |
src/main/resources/application-cloud.properties
| @@ -48,6 +48,24 @@ spring.datasource.info-publish.connection-test-query= SELECT 1 | @@ -48,6 +48,24 @@ spring.datasource.info-publish.connection-test-query= SELECT 1 | ||
| 48 | spring.datasource.info-publish.validation-timeout= 3000 | 48 | spring.datasource.info-publish.validation-timeout= 3000 |
| 49 | spring.datasource.info-publish.register-mbeans=false | 49 | spring.datasource.info-publish.register-mbeans=false |
| 50 | 50 | ||
| 51 | +#DATABASE ms | ||
| 52 | +spring.datasource.ms.driver-class-name= com.mysql.jdbc.Driver | ||
| 53 | +spring.datasource.ms.jdbc-url= jdbc:mysql://10.10.2.20/ms?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 54 | +spring.datasource.ms.username= root | ||
| 55 | +spring.datasource.ms.password= root2jsp | ||
| 56 | +spring.datasource.ms.type= com.zaxxer.hikari.HikariDataSource | ||
| 57 | +#DATASOURCE | ||
| 58 | +spring.datasource.ms.minimum-idle= 8 | ||
| 59 | +spring.datasource.ms.maximum-pool-size= 16 | ||
| 60 | +#spring.datasource.ms.auto-commit= true | ||
| 61 | +spring.datasource.ms.idle-timeout= 60000 | ||
| 62 | +#spring.datasource.ms.pool-name= HikariPool | ||
| 63 | +spring.datasource.ms.max-lifetime= 1800000 | ||
| 64 | +spring.datasource.ms.connection-timeout= 3000 | ||
| 65 | +spring.datasource.ms.connection-test-query= SELECT 1 | ||
| 66 | +spring.datasource.ms.validation-timeout= 3000 | ||
| 67 | +spring.datasource.ms.register-mbeans=false | ||
| 68 | + | ||
| 51 | kafka.use= false | 69 | kafka.use= false |
| 52 | spring.kafka.consumer.bootstrap-servers= 127.0.0.1:9092 | 70 | spring.kafka.consumer.bootstrap-servers= 127.0.0.1:9092 |
| 53 | spring.kafka.key-serializer= org.apache.kafka.common.serialization.StringSerializer | 71 | spring.kafka.key-serializer= org.apache.kafka.common.serialization.StringSerializer |
src/main/resources/application-dev.properties
| @@ -48,6 +48,24 @@ spring.datasource.info-publish.connection-test-query= SELECT 1 | @@ -48,6 +48,24 @@ spring.datasource.info-publish.connection-test-query= SELECT 1 | ||
| 48 | spring.datasource.info-publish.validation-timeout= 3000 | 48 | spring.datasource.info-publish.validation-timeout= 3000 |
| 49 | spring.datasource.info-publish.register-mbeans=false | 49 | spring.datasource.info-publish.register-mbeans=false |
| 50 | 50 | ||
| 51 | +#DATABASE ms | ||
| 52 | +spring.datasource.ms.driver-class-name= com.mysql.jdbc.Driver | ||
| 53 | +spring.datasource.ms.jdbc-url= jdbc:mysql://192.168.168.152/ms?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 54 | +spring.datasource.ms.username= root | ||
| 55 | +spring.datasource.ms.password= root2jsp | ||
| 56 | +spring.datasource.ms.type= com.zaxxer.hikari.HikariDataSource | ||
| 57 | +#DATASOURCE | ||
| 58 | +spring.datasource.ms.minimum-idle= 8 | ||
| 59 | +spring.datasource.ms.maximum-pool-size= 16 | ||
| 60 | +#spring.datasource.ms.auto-commit= true | ||
| 61 | +spring.datasource.ms.idle-timeout= 60000 | ||
| 62 | +#spring.datasource.ms.pool-name= HikariPool | ||
| 63 | +spring.datasource.ms.max-lifetime= 1800000 | ||
| 64 | +spring.datasource.ms.connection-timeout= 3000 | ||
| 65 | +spring.datasource.ms.connection-test-query= SELECT 1 | ||
| 66 | +spring.datasource.ms.validation-timeout= 3000 | ||
| 67 | +spring.datasource.ms.register-mbeans=false | ||
| 68 | + | ||
| 51 | kafka.use= false | 69 | kafka.use= false |
| 52 | spring.kafka.consumer.bootstrap-servers= localhost:9092 | 70 | spring.kafka.consumer.bootstrap-servers= localhost:9092 |
| 53 | spring.kafka.consumer.group-id= schedule-system | 71 | spring.kafka.consumer.group-id= schedule-system |
src/main/resources/application-test.properties
| @@ -48,6 +48,24 @@ spring.datasource.info-publish.hikari.connection-test-query= SELECT 1 | @@ -48,6 +48,24 @@ spring.datasource.info-publish.hikari.connection-test-query= SELECT 1 | ||
| 48 | spring.datasource.info-publish.hikari.validation-timeout= 3000 | 48 | spring.datasource.info-publish.hikari.validation-timeout= 3000 |
| 49 | spring.datasource.info-publish.hikari.register-mbeans=false | 49 | spring.datasource.info-publish.hikari.register-mbeans=false |
| 50 | 50 | ||
| 51 | +#DATABASE ms | ||
| 52 | +spring.datasource.ms.driver-class-name= com.mysql.jdbc.Driver | ||
| 53 | +spring.datasource.ms.jdbc-url= jdbc:mysql://10.10.2.200/ms?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 54 | +spring.datasource.ms.username= root | ||
| 55 | +spring.datasource.ms.password= root2jsp | ||
| 56 | +spring.datasource.ms.type= com.zaxxer.hikari.HikariDataSource | ||
| 57 | +#DATASOURCE | ||
| 58 | +spring.datasource.ms.minimum-idle= 8 | ||
| 59 | +spring.datasource.ms.maximum-pool-size= 16 | ||
| 60 | +#spring.datasource.ms.auto-commit= true | ||
| 61 | +spring.datasource.ms.idle-timeout= 60000 | ||
| 62 | +#spring.datasource.ms.pool-name= HikariPool | ||
| 63 | +spring.datasource.ms.max-lifetime= 1800000 | ||
| 64 | +spring.datasource.ms.connection-timeout= 3000 | ||
| 65 | +spring.datasource.ms.connection-test-query= SELECT 1 | ||
| 66 | +spring.datasource.ms.validation-timeout= 3000 | ||
| 67 | +spring.datasource.ms.register-mbeans=false | ||
| 68 | + | ||
| 51 | kafka.use= false | 69 | kafka.use= false |
| 52 | spring.kafka.consumer.bootstrap-servers= 127.0.0.1:9092 | 70 | spring.kafka.consumer.bootstrap-servers= 127.0.0.1:9092 |
| 53 | spring.kafka.consumer.group-id= schedule-system-test | 71 | spring.kafka.consumer.group-id= schedule-system-test |
src/main/resources/static/pages/base/vehicle-mapping/add.html
0 → 100644
| 1 | +<!-- 片段标题 START --> | ||
| 2 | +<div class="page-head"> | ||
| 3 | + <div class="page-title"> | ||
| 4 | + <h1>车辆映射添加</h1> | ||
| 5 | + </div> | ||
| 6 | +</div> | ||
| 7 | +<!-- 片段标题 START --> | ||
| 8 | + | ||
| 9 | +<!-- 线路信息导航栏组件 START --> | ||
| 10 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 11 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 12 | + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li> | ||
| 13 | + <li><a href="/pages/base/vehicle-mapping/list.html" data-pjax>车辆映射信息</a> <i class="fa fa-circle"></i></li> | ||
| 14 | + <li><span class="active">车辆映射添加</span></li> | ||
| 15 | +</ul> | ||
| 16 | +<!-- 线路信息导航栏组件 START --> | ||
| 17 | + | ||
| 18 | +<!-- 信息容器组件 START --> | ||
| 19 | +<div class="portlet light bordered"> | ||
| 20 | + | ||
| 21 | + <!-- 信息容器组件标题 START --> | ||
| 22 | + <div class="portlet-title"> | ||
| 23 | + <div class="caption"> | ||
| 24 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 25 | + <span class="caption-subject font-red-sunglo bold uppercase">车辆映射添加</span> | ||
| 26 | + </div> | ||
| 27 | + </div> | ||
| 28 | + <!-- 信息容器组件标题 END --> | ||
| 29 | + | ||
| 30 | + <div class="portlet-body form" id="vehicleMappingAddForm"> | ||
| 31 | + <form action="/" class="form-horizontal" id="vehicle_mapping_add_form"> | ||
| 32 | + <div class="form-body"> | ||
| 33 | + <div class="form-group"> | ||
| 34 | + <label class="control-label col-md-2"> | ||
| 35 | + <span class="required"> * </span>设备编码 : | ||
| 36 | + </label> | ||
| 37 | + <div class="col-md-3"> | ||
| 38 | + <input type="text" class="form-control" name="deviceId" id="deviceIdInput" placeholder="设备编码"> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + <div class="form-group"> | ||
| 42 | + <label class="control-label col-md-2"> | ||
| 43 | + 关联设备 : | ||
| 44 | + </label> | ||
| 45 | + <div class="col-md-3"> | ||
| 46 | + <input type="text" class="form-control" name="relationDeviceId" placeholder="关联设备"> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + <div class="form-group"> | ||
| 50 | + <label class="control-label col-md-2"> | ||
| 51 | + SIM : | ||
| 52 | + </label> | ||
| 53 | + <div class="col-md-3"> | ||
| 54 | + <input type="text" class="form-control" name="sim" placeholder="SIM"> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + <div class="form-group"> | ||
| 58 | + <label class="control-label col-md-2"> | ||
| 59 | + 关联SIM : | ||
| 60 | + </label> | ||
| 61 | + <div class="col-md-3"> | ||
| 62 | + <input type="text" class="form-control" name="relationSim" placeholder="关联SIM"> | ||
| 63 | + </div> | ||
| 64 | + </div> | ||
| 65 | + <div class="form-group"> | ||
| 66 | + <label class="control-label col-md-2"> | ||
| 67 | + 设备优先 : | ||
| 68 | + </label> | ||
| 69 | + <div class="col-md-3"> | ||
| 70 | + <select class="form-control" style="width:100%" name="extEnabled"> | ||
| 71 | + <option value="">请选择</option> | ||
| 72 | + <option value="0">拓华</option> | ||
| 73 | + <option value="1">808</option> | ||
| 74 | + </select> | ||
| 75 | + </div> | ||
| 76 | + </div> | ||
| 77 | + <div class="form-group"> | ||
| 78 | + <label class="control-label col-md-2"> | ||
| 79 | + 内部编码 : | ||
| 80 | + </label> | ||
| 81 | + <div class="col-md-3"> | ||
| 82 | + <input type="text" class="form-control" name="inCode" placeholder="内部编码"> | ||
| 83 | + </div> | ||
| 84 | + </div> | ||
| 85 | + <div class="form-group"> | ||
| 86 | + <label class="control-label col-md-2"> | ||
| 87 | + 线路 : | ||
| 88 | + </label> | ||
| 89 | + <div class="col-md-3"> | ||
| 90 | + <select class="form-control" style="width:100%" name="lineId" id="lineSelect"></select> | ||
| 91 | + </div> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + | ||
| 95 | + <div class="form-actions"> | ||
| 96 | + <div class="row"> | ||
| 97 | + <div class="col-md-offset-3 col-md-4"> | ||
| 98 | + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button> | ||
| 99 | + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-reply"></i> 返回</a> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + </div> | ||
| 103 | + </form> | ||
| 104 | + </div> | ||
| 105 | +</div> | ||
| 106 | +<!-- 线路信息详情片段JS模块 --> | ||
| 107 | +<script> | ||
| 108 | + (function () { | ||
| 109 | + function initLineSelect2() { | ||
| 110 | + // 填充线路拉框选择值 | ||
| 111 | + $get('/line/all', {}, function(array){ | ||
| 112 | + var len_ = array.length,paramsD = new Array(); | ||
| 113 | + if(len_>0) { | ||
| 114 | + $.each(array, function(i, g){ | ||
| 115 | + if(g.remove != 1 && g.name) { | ||
| 116 | + paramsD.push({'id': g.lineCode ,'text': g.name}); | ||
| 117 | + } | ||
| 118 | + }); | ||
| 119 | + if($('span').hasClass('select2-selection')) | ||
| 120 | + $('span .select2-selection').remove(); | ||
| 121 | + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) { | ||
| 122 | + //selector.select2("val", ''); | ||
| 123 | + }); | ||
| 124 | + } | ||
| 125 | + }); | ||
| 126 | + } | ||
| 127 | + // 选择线路,填充线路编码搜索框 | ||
| 128 | + $("#lineSelect").on("change",function(){ | ||
| 129 | + var text = $('#lineSelect').val(); | ||
| 130 | + if(text){ | ||
| 131 | + var linecode = text.split("_"); | ||
| 132 | + $("#lineCodeInput").val(linecode[2]); | ||
| 133 | + } | ||
| 134 | + }); | ||
| 135 | + initLineSelect2(); | ||
| 136 | + var form = $('#vehicle_mapping_add_form'); | ||
| 137 | + var error = $('.alert-danger',form); | ||
| 138 | + form.validate({ | ||
| 139 | + errorElement: 'span', | ||
| 140 | + errorClass: 'help-block help-block-error', | ||
| 141 | + focusInvalid: true, | ||
| 142 | + rules: { | ||
| 143 | + 'id': {required: true}, | ||
| 144 | + 'deviceId': {required: true, minlength: 8, maxlength: 8}, | ||
| 145 | + 'relationDeviceId': {required: false, minlength: 8, maxlength: 8}, | ||
| 146 | + 'sim' : {required: true, minlength: 12, maxlength: 12}, | ||
| 147 | + 'relationSim': {required: false, minlength: 12, maxlength: 12} | ||
| 148 | + }, | ||
| 149 | + | ||
| 150 | + invalidHandler : function(event, validator) { | ||
| 151 | + // 显示表单未通过提示信息 | ||
| 152 | + error.show(); | ||
| 153 | + // 把提示信息放到指定的位置。 | ||
| 154 | + App.scrollTo(error, -200); | ||
| 155 | + }, | ||
| 156 | + | ||
| 157 | + highlight : function(element) { | ||
| 158 | + // 添加errorClass("has-error")到表单元素 | ||
| 159 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 160 | + }, | ||
| 161 | + | ||
| 162 | + unhighlight : function(element) { | ||
| 163 | + // 移除errorClass("has-error") | ||
| 164 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 165 | + }, | ||
| 166 | + | ||
| 167 | + success : function(label) { | ||
| 168 | + label.closest('.form-group').removeClass('has-error'); | ||
| 169 | + }, | ||
| 170 | + | ||
| 171 | + submitHandler : function(f) { | ||
| 172 | + error.hide(); | ||
| 173 | + var params = form.serializeJSON(); | ||
| 174 | + $post('/vehicle-mapping', params, function(result) { | ||
| 175 | + if (result) { | ||
| 176 | + if(result.status=='SUCCESS') { | ||
| 177 | + layer.msg('修改成功...'); | ||
| 178 | + } else if(result.status=='ERROR') { | ||
| 179 | + layer.msg('修改失败...'); | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + loadPage('list.html'); | ||
| 183 | + }); | ||
| 184 | + } | ||
| 185 | + }); | ||
| 186 | + })(); | ||
| 187 | +</script> | ||
| 0 | \ No newline at end of file | 188 | \ No newline at end of file |
src/main/resources/static/pages/base/vehicle-mapping/details.html
0 → 100644
| 1 | +<!-- 片段标题 START --> | ||
| 2 | +<div class="page-head"> | ||
| 3 | + <div class="page-title"> | ||
| 4 | + <h1>车辆映射详情</h1> | ||
| 5 | + </div> | ||
| 6 | +</div> | ||
| 7 | +<!-- 片段标题 START --> | ||
| 8 | + | ||
| 9 | +<!-- 线路信息导航栏组件 START --> | ||
| 10 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 11 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 12 | + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li> | ||
| 13 | + <li><a href="/pages/base/vehicle-mapping/list.html" data-pjax>车辆映射信息</a> <i class="fa fa-circle"></i></li> | ||
| 14 | + <li><span class="active">车辆映射详情</span></li> | ||
| 15 | +</ul> | ||
| 16 | +<!-- 线路信息导航栏组件 START --> | ||
| 17 | + | ||
| 18 | +<!-- 信息容器组件 START --> | ||
| 19 | +<div class="portlet light bordered"> | ||
| 20 | + | ||
| 21 | + <!-- 信息容器组件标题 START --> | ||
| 22 | + <div class="portlet-title"> | ||
| 23 | + <div class="caption"> | ||
| 24 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 25 | + <span class="caption-subject font-red-sunglo bold uppercase">车辆映射详情</span> | ||
| 26 | + </div> | ||
| 27 | + </div> | ||
| 28 | + <!-- 信息容器组件标题 END --> | ||
| 29 | + | ||
| 30 | + <div class="portlet-body form" id="vehicleMappingDetailsForm"> | ||
| 31 | + <form action="/" class="form-horizontal" id="vehicle_mapping_details_form"> | ||
| 32 | + <div class="form-body"> | ||
| 33 | + <div class="form-group"> | ||
| 34 | + <label class="control-label col-md-2"> | ||
| 35 | + <span class="required"> * </span>设备编码 : | ||
| 36 | + </label> | ||
| 37 | + <div class="col-md-3"> | ||
| 38 | + <input type="text" class="form-control" name="deviceId" id="deviceIdInput" placeholder="设备编码"> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + <div class="form-group"> | ||
| 42 | + <label class="control-label col-md-2"> | ||
| 43 | + 关联设备 : | ||
| 44 | + </label> | ||
| 45 | + <div class="col-md-3"> | ||
| 46 | + <input type="text" class="form-control" name="relationDeviceId" id="relationDeviceIdInput" placeholder="关联设备"> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + <div class="form-group"> | ||
| 50 | + <label class="control-label col-md-2"> | ||
| 51 | + SIM : | ||
| 52 | + </label> | ||
| 53 | + <div class="col-md-3"> | ||
| 54 | + <input type="text" class="form-control" name="sim" id="simInput" placeholder="SIM"> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + <div class="form-group"> | ||
| 58 | + <label class="control-label col-md-2"> | ||
| 59 | + 关联SIM : | ||
| 60 | + </label> | ||
| 61 | + <div class="col-md-3"> | ||
| 62 | + <input type="text" class="form-control" name="relationSim" id="relationSimInput" placeholder="关联SIM"> | ||
| 63 | + </div> | ||
| 64 | + </div> | ||
| 65 | + <div class="form-group"> | ||
| 66 | + <label class="control-label col-md-2"> | ||
| 67 | + 设备优先 : | ||
| 68 | + </label> | ||
| 69 | + <div class="col-md-3"> | ||
| 70 | + <input type="text" class="form-control" name="extEnabled" id="extEnabledInput" placeholder="设备优先"> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + <div class="form-group"> | ||
| 74 | + <label class="control-label col-md-2"> | ||
| 75 | + 内部编码 : | ||
| 76 | + </label> | ||
| 77 | + <div class="col-md-3"> | ||
| 78 | + <input type="text" class="form-control" name="inCode" id="inCodeInput" placeholder="内部编码"> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + <div class="form-group"> | ||
| 82 | + <label class="control-label col-md-2"> | ||
| 83 | + 线路 : | ||
| 84 | + </label> | ||
| 85 | + <div class="col-md-3"> | ||
| 86 | + <input type="text" class="form-control" name="lineName" id="lineNameInput" placeholder="线路"> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | + </div> | ||
| 90 | + | ||
| 91 | + <div class="form-actions"> | ||
| 92 | + <div class="row"> | ||
| 93 | + <div class="col-md-offset-4 col-md-5"> | ||
| 94 | + <a type="button" class="btn default" href="list.html" style="margin-left: 35%;" data-pjax><i | ||
| 95 | + class="fa fa-reply"></i> 返回</a> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + </form> | ||
| 100 | + </div> | ||
| 101 | +</div> | ||
| 102 | +<!-- 线路信息详情片段JS模块 --> | ||
| 103 | +<script> | ||
| 104 | + (function () { | ||
| 105 | + var id = $.url().param('no'); | ||
| 106 | + if (id) { | ||
| 107 | + $get('/vehicle-mapping/all' ,{id: id}, function(result){ | ||
| 108 | + if (result && result.data && result.data.length > 0) { | ||
| 109 | + $('input,select,textarea','#vehicle_mapping_details_form').each(function () { | ||
| 110 | + $(this).val(result.data[0][$(this).attr('name')]); | ||
| 111 | + if ($(this).attr('name') == 'extEnabled') { | ||
| 112 | + $(this).val(result.data[0].extEnabled == 0 ? '拓华' : '808'); | ||
| 113 | + } | ||
| 114 | + }) | ||
| 115 | + } | ||
| 116 | + $('input,select,textarea','#vehicle_mapping_details_form').attr('Disabled','Disabled'); | ||
| 117 | + }); | ||
| 118 | + } | ||
| 119 | + })(); | ||
| 120 | +</script> | ||
| 0 | \ No newline at end of file | 121 | \ No newline at end of file |
src/main/resources/static/pages/base/vehicle-mapping/edit.html
0 → 100644
| 1 | +<!-- 片段标题 START --> | ||
| 2 | +<div class="page-head"> | ||
| 3 | + <div class="page-title"> | ||
| 4 | + <h1>车辆映射修改</h1> | ||
| 5 | + </div> | ||
| 6 | +</div> | ||
| 7 | +<!-- 片段标题 START --> | ||
| 8 | + | ||
| 9 | +<!-- 线路信息导航栏组件 START --> | ||
| 10 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 11 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 12 | + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li> | ||
| 13 | + <li><a href="/pages/base/vehicle-mapping/list.html" data-pjax>车辆映射信息</a> <i class="fa fa-circle"></i></li> | ||
| 14 | + <li><span class="active">车辆映射修改</span></li> | ||
| 15 | +</ul> | ||
| 16 | +<!-- 线路信息导航栏组件 START --> | ||
| 17 | + | ||
| 18 | +<!-- 信息容器组件 START --> | ||
| 19 | +<div class="portlet light bordered"> | ||
| 20 | + | ||
| 21 | + <!-- 信息容器组件标题 START --> | ||
| 22 | + <div class="portlet-title"> | ||
| 23 | + <div class="caption"> | ||
| 24 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 25 | + <span class="caption-subject font-red-sunglo bold uppercase">车辆映射修改</span> | ||
| 26 | + </div> | ||
| 27 | + </div> | ||
| 28 | + <!-- 信息容器组件标题 END --> | ||
| 29 | + | ||
| 30 | + <div class="portlet-body form" id="vehicleMappingEditForm"> | ||
| 31 | + <form action="/" class="form-horizontal" id="vehicle_mapping_edit_form"> | ||
| 32 | + <input type="hidden" name="id"/> | ||
| 33 | + <div class="form-body"> | ||
| 34 | + <div class="form-group"> | ||
| 35 | + <label class="control-label col-md-2"> | ||
| 36 | + <span class="required"> * </span>设备编码 : | ||
| 37 | + </label> | ||
| 38 | + <div class="col-md-3"> | ||
| 39 | + <input type="text" class="form-control" name="deviceId" id="deviceIdInput" placeholder="设备编码"> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + <div class="form-group"> | ||
| 43 | + <label class="control-label col-md-2"> | ||
| 44 | + 关联设备 : | ||
| 45 | + </label> | ||
| 46 | + <div class="col-md-3"> | ||
| 47 | + <input type="text" class="form-control" name="relationDeviceId" placeholder="关联设备"> | ||
| 48 | + </div> | ||
| 49 | + </div> | ||
| 50 | + <div class="form-group"> | ||
| 51 | + <label class="control-label col-md-2"> | ||
| 52 | + SIM : | ||
| 53 | + </label> | ||
| 54 | + <div class="col-md-3"> | ||
| 55 | + <input type="text" class="form-control" name="sim" placeholder="SIM"> | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + <div class="form-group"> | ||
| 59 | + <label class="control-label col-md-2"> | ||
| 60 | + 关联SIM : | ||
| 61 | + </label> | ||
| 62 | + <div class="col-md-3"> | ||
| 63 | + <input type="text" class="form-control" name="relationSim" placeholder="关联SIM"> | ||
| 64 | + </div> | ||
| 65 | + </div> | ||
| 66 | + <div class="form-group"> | ||
| 67 | + <label class="control-label col-md-2"> | ||
| 68 | + 设备优先 : | ||
| 69 | + </label> | ||
| 70 | + <div class="col-md-3"> | ||
| 71 | + <select class="form-control" style="width:100%" name="extEnabled"> | ||
| 72 | + <option value="">请选择</option> | ||
| 73 | + <option value="0">拓华</option> | ||
| 74 | + <option value="1">808</option> | ||
| 75 | + </select> | ||
| 76 | + </div> | ||
| 77 | + </div> | ||
| 78 | + <div class="form-group"> | ||
| 79 | + <label class="control-label col-md-2"> | ||
| 80 | + 内部编码 : | ||
| 81 | + </label> | ||
| 82 | + <div class="col-md-3"> | ||
| 83 | + <input type="text" class="form-control" name="inCode" placeholder="内部编码"> | ||
| 84 | + </div> | ||
| 85 | + </div> | ||
| 86 | + <div class="form-group"> | ||
| 87 | + <label class="control-label col-md-2"> | ||
| 88 | + 线路 : | ||
| 89 | + </label> | ||
| 90 | + <div class="col-md-3"> | ||
| 91 | + <select class="form-control" style="width:100%" name="lineId" id="lineSelect"></select> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + | ||
| 96 | + <div class="form-actions"> | ||
| 97 | + <div class="row"> | ||
| 98 | + <div class="col-md-offset-3 col-md-4"> | ||
| 99 | + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button> | ||
| 100 | + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-reply"></i> 返回</a> | ||
| 101 | + </div> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + </form> | ||
| 105 | + </div> | ||
| 106 | +</div> | ||
| 107 | +<!-- 线路信息详情片段JS模块 --> | ||
| 108 | +<script> | ||
| 109 | + (function () { | ||
| 110 | + function initLineSelect2() { | ||
| 111 | + // 填充线路拉框选择值 | ||
| 112 | + $get('/line/all', {}, function(array){ | ||
| 113 | + var len_ = array.length,paramsD = new Array(); | ||
| 114 | + if(len_>0) { | ||
| 115 | + $.each(array, function(i, g){ | ||
| 116 | + if(g.remove != 1 && g.name) { | ||
| 117 | + paramsD.push({'id': g.lineCode ,'text': g.name}); | ||
| 118 | + } | ||
| 119 | + }); | ||
| 120 | + if($('span').hasClass('select2-selection')) | ||
| 121 | + $('span .select2-selection').remove(); | ||
| 122 | + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) { | ||
| 123 | + selector.select2("val", localStorage.getItem('edit-line-id')); | ||
| 124 | + }); | ||
| 125 | + } | ||
| 126 | + }); | ||
| 127 | + } | ||
| 128 | + // 选择线路,填充线路编码搜索框 | ||
| 129 | + $("#lineSelect").on("change",function(){ | ||
| 130 | + var text = $('#lineSelect').val(); | ||
| 131 | + if(text){ | ||
| 132 | + var linecode = text.split("_"); | ||
| 133 | + $("#lineCodeInput").val(linecode[2]); | ||
| 134 | + } | ||
| 135 | + }); | ||
| 136 | + | ||
| 137 | + var id = $.url().param('no'); | ||
| 138 | + if (id) { | ||
| 139 | + $get('/vehicle-mapping/all' ,{id: id}, function(result){ | ||
| 140 | + if (result && result.data && result.data.length > 0) { | ||
| 141 | + $('input,select,textarea','#vehicle_mapping_edit_form').each(function () { | ||
| 142 | + $(this).val(result.data[0][$(this).attr('name')]); | ||
| 143 | + if ($(this).attr('name') == 'lineId') { | ||
| 144 | + localStorage.setItem('edit-line-id', result.data[0].lineId); | ||
| 145 | + $.ajaxSettings.async = false; | ||
| 146 | + initLineSelect2(); | ||
| 147 | + $.ajaxSettings.async = true; | ||
| 148 | + } | ||
| 149 | + }) | ||
| 150 | + } | ||
| 151 | + }); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + var form = $('#vehicle_mapping_edit_form'); | ||
| 155 | + var error = $('.alert-danger',form); | ||
| 156 | + form.validate({ | ||
| 157 | + errorElement: 'span', | ||
| 158 | + errorClass: 'help-block help-block-error', | ||
| 159 | + focusInvalid: true, | ||
| 160 | + rules: { | ||
| 161 | + 'id': {required: true}, | ||
| 162 | + 'deviceId': {required: true, minlength: 8, maxlength: 8}, | ||
| 163 | + 'relationDeviceId': {required: false, minlength: 8, maxlength: 8}, | ||
| 164 | + 'sim' : {required: true, minlength: 12, maxlength: 12}, | ||
| 165 | + 'relationSim': {required: false, minlength: 12, maxlength: 12} | ||
| 166 | + }, | ||
| 167 | + | ||
| 168 | + invalidHandler : function(event, validator) { | ||
| 169 | + // 显示表单未通过提示信息 | ||
| 170 | + error.show(); | ||
| 171 | + // 把提示信息放到指定的位置。 | ||
| 172 | + App.scrollTo(error, -200); | ||
| 173 | + }, | ||
| 174 | + | ||
| 175 | + highlight : function(element) { | ||
| 176 | + // 添加errorClass("has-error")到表单元素 | ||
| 177 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 178 | + }, | ||
| 179 | + | ||
| 180 | + unhighlight : function(element) { | ||
| 181 | + // 移除errorClass("has-error") | ||
| 182 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 183 | + }, | ||
| 184 | + | ||
| 185 | + success : function(label) { | ||
| 186 | + label.closest('.form-group').removeClass('has-error'); | ||
| 187 | + }, | ||
| 188 | + | ||
| 189 | + submitHandler : function(f) { | ||
| 190 | + debugger | ||
| 191 | + error.hide(); | ||
| 192 | + var params = form.serializeJSON(); | ||
| 193 | + $post('/vehicle-mapping', params, function(result) { | ||
| 194 | + if (result) { | ||
| 195 | + if(result.status=='SUCCESS') { | ||
| 196 | + layer.msg('修改成功...'); | ||
| 197 | + } else if(result.status=='ERROR') { | ||
| 198 | + layer.msg('修改失败...'); | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + loadPage('list.html'); | ||
| 202 | + }); | ||
| 203 | + } | ||
| 204 | + }); | ||
| 205 | + })(); | ||
| 206 | +</script> | ||
| 0 | \ No newline at end of file | 207 | \ No newline at end of file |
src/main/resources/static/pages/base/vehicle-mapping/list.html
0 → 100644
| 1 | +<div class="page-head"> | ||
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>车辆映射信息</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | +<!-- 片段标题 END --> | ||
| 7 | + | ||
| 8 | +<!-- 线路信息导航栏组件 START --> | ||
| 9 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 10 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 11 | + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li> | ||
| 12 | + <li><span class="active">车辆映射信息</span></li> | ||
| 13 | +</ul> | ||
| 14 | +<!-- 线路信息导航栏组件 END --> | ||
| 15 | + | ||
| 16 | +<div class="row"> | ||
| 17 | + <div class="col-md-12"> | ||
| 18 | + <div class="portlet light porttlet-fit bordered"> | ||
| 19 | + <div class="portlet-title"> | ||
| 20 | + <div class="tipso-animation"> | ||
| 21 | + </div> | ||
| 22 | + <div class="caption"> | ||
| 23 | + <i class="fa fa-info-circle font-dark"></i> | ||
| 24 | + <span class="caption-subject font-dark sbold uppercase">车辆映射信息</span> | ||
| 25 | + </div> | ||
| 26 | + <div class="actions"> | ||
| 27 | + <div class="btn-group btn-group-devided" data-toggle="buttons"> | ||
| 28 | + <!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加映射</a> --> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + <div class="portlet-body"> | ||
| 33 | + <div class="table-container" style="margin-top: 10px"> | ||
| 34 | + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_vehicle_mapping"> | ||
| 35 | + <thead> | ||
| 36 | + <tr role="row" class="heading"> | ||
| 37 | + <th width="5%">序号</th> | ||
| 38 | + <th width="12%">设备编号</th> | ||
| 39 | + <th width="12%">关联设备</th> | ||
| 40 | + <th width="12%">SIM</th> | ||
| 41 | + <th width="12%">关联SIM</th> | ||
| 42 | + <th width="12%">设备优先</th> | ||
| 43 | + <th width="12%">内部编码</th> | ||
| 44 | + <th width="12%">线路</th> | ||
| 45 | + <th width="12%">操作</th> | ||
| 46 | + </tr> | ||
| 47 | + <tr role="row" class="filter"> | ||
| 48 | + <td>#</td> | ||
| 49 | + <td> | ||
| 50 | + <input type="text" class="form-control form-filter input-sm" name="deviceId"> | ||
| 51 | + </td> | ||
| 52 | + <td> | ||
| 53 | + <input type="text" class="form-control form-filter input-sm" name="relationDeviceId"> | ||
| 54 | + </td> | ||
| 55 | + <td> | ||
| 56 | + <input type="text" class="form-control form-filter input-sm" name="sim"> | ||
| 57 | + </td> | ||
| 58 | + <td> | ||
| 59 | + <input type="text" class="form-control form-filter input-sm" name="relationSim"> | ||
| 60 | + </td> | ||
| 61 | + <td> | ||
| 62 | + <select class="form-control" style="width:100%" name="extEnabled"> | ||
| 63 | + <option value="">请选择</option> | ||
| 64 | + <option value="0">拓华</option> | ||
| 65 | + <option value="1">808</option> | ||
| 66 | + </select> | ||
| 67 | + </td> | ||
| 68 | + <td> | ||
| 69 | + <input type="text" class="form-control form-filter input-sm" name="inCode"> | ||
| 70 | + </td> | ||
| 71 | + <td> | ||
| 72 | + <select class="form-control" style="width:100%" name="lineId" id="lineSelect"></select> | ||
| 73 | + </td> | ||
| 74 | + <td> | ||
| 75 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | ||
| 76 | + <i class="fa fa-search"></i> 搜索 | ||
| 77 | + </button> | ||
| 78 | + | ||
| 79 | + <button class="btn btn-sm red btn-outline filter-cancel" id="notification-trigger"> | ||
| 80 | + <i class="fa fa-times"></i> 重置 | ||
| 81 | + </button> | ||
| 82 | + </td> | ||
| 83 | + </tr> | ||
| 84 | + </thead> | ||
| 85 | + <tbody></tbody> | ||
| 86 | + </table> | ||
| 87 | +<!-- <div style="text-align: right;">--> | ||
| 88 | +<!-- <ul id="pagination" class="pagination"></ul>--> | ||
| 89 | +<!-- </div>--> | ||
| 90 | + </div> | ||
| 91 | + </div> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | +</div> | ||
| 95 | +<script type="text/html" id="vehicle_mapping_list_template"> | ||
| 96 | + {{each list as obj i }} | ||
| 97 | + <tr> | ||
| 98 | + <td style="vertical-align: middle;"> | ||
| 99 | + {{i+1}} | ||
| 100 | + </td> | ||
| 101 | + <td> | ||
| 102 | + {{obj.deviceId}} | ||
| 103 | + </td> | ||
| 104 | + <td> | ||
| 105 | + {{obj.relationDeviceId}} | ||
| 106 | + </td> | ||
| 107 | + <td> | ||
| 108 | + {{obj.sim}} | ||
| 109 | + </td> | ||
| 110 | + <td> | ||
| 111 | + {{obj.relationSim}} | ||
| 112 | + </td> | ||
| 113 | + <td> | ||
| 114 | + {{if obj.extEnabled == 0}} | ||
| 115 | + 拓华 | ||
| 116 | + {{else if obj.extEnabled == 1}} | ||
| 117 | + 808 | ||
| 118 | + {{/if}} | ||
| 119 | + </td> | ||
| 120 | + <td> | ||
| 121 | + {{obj.inCode}} | ||
| 122 | + </td> | ||
| 123 | + <td> | ||
| 124 | + {{obj.lineName}} | ||
| 125 | + </td> | ||
| 126 | + <td> | ||
| 127 | + <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> | ||
| 128 | + <!--<a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>--> | ||
| 129 | + </td> | ||
| 130 | + </tr> | ||
| 131 | + {{/each}} | ||
| 132 | + {{if list.length == 0}} | ||
| 133 | + <tr> | ||
| 134 | + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td> | ||
| 135 | + </tr> | ||
| 136 | + {{/if}} | ||
| 137 | +</script> | ||
| 138 | +<script> | ||
| 139 | + (function () { | ||
| 140 | + function getParams() { | ||
| 141 | + var cells = $('tr.filter')[0].cells; | ||
| 142 | + var params = {}, name; | ||
| 143 | + $.each(cells, function(i, cell){ | ||
| 144 | + var items = $('input,select', cell); | ||
| 145 | + for(var j = 0, item; item = items[j++];){ | ||
| 146 | + name = $(item).attr('name'), val = $(item).val(); | ||
| 147 | + if (name && val) { | ||
| 148 | + params[name] = val; | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + }); | ||
| 152 | + | ||
| 153 | + return params; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + function loadTableData(param){ | ||
| 157 | + var params = {}; | ||
| 158 | + if (param) { | ||
| 159 | + params = param; | ||
| 160 | + } | ||
| 161 | + var i = layer.load(2); | ||
| 162 | + $.get('/vehicle-mapping/all', params, function(result){ | ||
| 163 | + var data = result.data; | ||
| 164 | + // 把数据填充到模版中 | ||
| 165 | + var tbodyHtml = template('vehicle_mapping_list_template', {list: data}); | ||
| 166 | + $('#datatable_vehicle_mapping tbody').html(tbodyHtml); | ||
| 167 | + layer.close(i); | ||
| 168 | + }); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + function initLineSelect2() { | ||
| 172 | + // 填充线路拉框选择值 | ||
| 173 | + $get('/line/all', {}, function(array){ | ||
| 174 | + var len_ = array.length,paramsD = new Array(); | ||
| 175 | + if(len_>0) { | ||
| 176 | + $.each(array, function(i, g){ | ||
| 177 | + if(g.remove != 1 && g.name) { | ||
| 178 | + paramsD.push({'id': g.lineCode ,'text': g.name}); | ||
| 179 | + } | ||
| 180 | + }); | ||
| 181 | + if($('span').hasClass('select2-selection')) | ||
| 182 | + $('span .select2-selection').remove(); | ||
| 183 | + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) { | ||
| 184 | + //selector.select2("val", storage.xlName_AgursData); | ||
| 185 | + }); | ||
| 186 | + } | ||
| 187 | + }); | ||
| 188 | + } | ||
| 189 | + // 选择线路,填充线路编码搜索框 | ||
| 190 | + $("#lineSelect").on("change",function(){ | ||
| 191 | + var text = $('#lineSelect').val(); | ||
| 192 | + if(text){ | ||
| 193 | + var linecode = text.split("_"); | ||
| 194 | + $("#lineCodeInput").val(linecode[2]); | ||
| 195 | + } | ||
| 196 | + }); | ||
| 197 | + | ||
| 198 | + $('tr.filter .filter-cancel').on('click',function(){ | ||
| 199 | + $('tr.filter input,select').val('').change(); | ||
| 200 | + $('.tipso-animation').tipso('hide'); | ||
| 201 | + loadTableData(); | ||
| 202 | + }); | ||
| 203 | + | ||
| 204 | + $('tr.filter .filter-submit').on('click',function(){ | ||
| 205 | + var params = getParams(); | ||
| 206 | + loadTableData(params); | ||
| 207 | + }); | ||
| 208 | + | ||
| 209 | + initLineSelect2(); | ||
| 210 | + loadTableData(); | ||
| 211 | + })(); | ||
| 212 | +</script> | ||
| 0 | \ No newline at end of file | 213 | \ No newline at end of file |