Commit 8ed54c917c1ec50f1cf559524563bbbea1c43989
1 parent
a937be67
bf
Showing
10 changed files
with
176 additions
and
134 deletions
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineController.java
| @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | import org.springframework.stereotype.Controller; | 18 | import org.springframework.stereotype.Controller; |
| 19 | import org.springframework.ui.ModelMap; | 19 | import org.springframework.ui.ModelMap; |
| 20 | import org.springframework.web.bind.annotation.*; | 20 | import org.springframework.web.bind.annotation.*; |
| 21 | +import org.springframework.web.servlet.ModelAndView; | ||
| 21 | 22 | ||
| 22 | import java.io.File; | 23 | import java.io.File; |
| 23 | import java.lang.reflect.Field; | 24 | import java.lang.reflect.Field; |
| @@ -52,11 +53,15 @@ public class BsthTLineController extends BaseController | @@ -52,11 +53,15 @@ public class BsthTLineController extends BaseController | ||
| 52 | */ | 53 | */ |
| 53 | @RequiresPermissions("system:line:view") | 54 | @RequiresPermissions("system:line:view") |
| 54 | @GetMapping() | 55 | @GetMapping() |
| 55 | - public String line() | 56 | + public ModelAndView line() |
| 56 | { | 57 | { |
| 57 | - return prefix + "/line"; | 58 | + ModelAndView mv=new ModelAndView(prefix + "/line"); |
| 59 | + List<Map> companyList=bsthTLineService.selectCompany(); | ||
| 60 | + mv.addObject("companyList",companyList); | ||
| 61 | + return mv; | ||
| 58 | } | 62 | } |
| 59 | 63 | ||
| 64 | + | ||
| 60 | /** | 65 | /** |
| 61 | * 线路分页 | 66 | * 线路分页 |
| 62 | */ | 67 | */ |
| @@ -277,6 +282,9 @@ public class BsthTLineController extends BaseController | @@ -277,6 +282,9 @@ public class BsthTLineController extends BaseController | ||
| 277 | return ajaxResult; | 282 | return ajaxResult; |
| 278 | } | 283 | } |
| 279 | 284 | ||
| 285 | + | ||
| 286 | + | ||
| 287 | + | ||
| 280 | /* | 288 | /* |
| 281 | 289 | ||
| 282 | 290 |
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/mapper/BsthTLineMapper.java
| 1 | package com.ruoyi.project.system.line.mapper; | 1 | package com.ruoyi.project.system.line.mapper; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 4 | import com.ruoyi.project.system.line.domain.BsthTLine; | 6 | import com.ruoyi.project.system.line.domain.BsthTLine; |
| 5 | import com.ruoyi.project.system.line.domain.LineEditReport; | 7 | import com.ruoyi.project.system.line.domain.LineEditReport; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| @@ -71,7 +73,7 @@ public interface BsthTLineMapper | @@ -71,7 +73,7 @@ public interface BsthTLineMapper | ||
| 71 | 73 | ||
| 72 | /*int createLineMonthReport(BsthTLine line);*/ | 74 | /*int createLineMonthReport(BsthTLine line);*/ |
| 73 | 75 | ||
| 74 | - | 76 | + List<Map> selectCompany(); |
| 75 | 77 | ||
| 76 | 78 | ||
| 77 | 79 |
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/IBsthTLineService.java
| 1 | package com.ruoyi.project.system.line.service; | 1 | package com.ruoyi.project.system.line.service; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | +import java.util.Map; | ||
| 4 | 5 | ||
| 5 | import com.alibaba.fastjson.JSONArray; | 6 | import com.alibaba.fastjson.JSONArray; |
| 6 | import com.ruoyi.project.system.line.domain.BsthTLine; | 7 | import com.ruoyi.project.system.line.domain.BsthTLine; |
| @@ -60,5 +61,7 @@ public interface IBsthTLineService | @@ -60,5 +61,7 @@ public interface IBsthTLineService | ||
| 60 | BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine); | 61 | BsthTLine selectHistoryByLineNameAndUpdateStatus(BsthTLine bsthTLine); |
| 61 | 62 | ||
| 62 | int deleteBsthTLineHistoryById(Long id); | 63 | int deleteBsthTLineHistoryById(Long id); |
| 64 | + | ||
| 65 | + List<Map> selectCompany(); | ||
| 63 | /*int createLineMonthReport();*/ | 66 | /*int createLineMonthReport();*/ |
| 64 | } | 67 | } |
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/impl/BsthTLineServiceImpl.java
| @@ -443,4 +443,9 @@ public class BsthTLineServiceImpl implements IBsthTLineService | @@ -443,4 +443,9 @@ public class BsthTLineServiceImpl implements IBsthTLineService | ||
| 443 | return bsthTLineMapper.deleteBsthTLineHistoryById(id); | 443 | return bsthTLineMapper.deleteBsthTLineHistoryById(id); |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | + @Override | ||
| 447 | + public List<Map> selectCompany(){ | ||
| 448 | + return bsthTLineMapper.selectCompany(); | ||
| 449 | + } | ||
| 450 | + | ||
| 446 | } | 451 | } |
bsthLineProfiles/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java
| 1 | package com.ruoyi.project.system.user.controller; | 1 | package com.ruoyi.project.system.user.controller; |
| 2 | 2 | ||
| 3 | -import java.util.ArrayList; | ||
| 4 | import java.util.Date; | 3 | import java.util.Date; |
| 5 | -import java.util.HashMap; | ||
| 6 | import java.util.List; | 4 | import java.util.List; |
| 7 | -import java.util.Map; | ||
| 8 | 5 | ||
| 6 | +import javax.servlet.http.Cookie; | ||
| 9 | import javax.servlet.http.HttpServletRequest; | 7 | import javax.servlet.http.HttpServletRequest; |
| 10 | import javax.servlet.http.HttpServletResponse; | 8 | import javax.servlet.http.HttpServletResponse; |
| 11 | 9 | ||
| 12 | -import org.apache.http.HttpResponse; | ||
| 13 | -import org.apache.http.client.HttpClient; | ||
| 14 | -import org.apache.http.client.methods.HttpPost; | ||
| 15 | -import org.apache.http.entity.StringEntity; | ||
| 16 | -import org.apache.http.impl.client.DefaultHttpClient; | ||
| 17 | -import org.apache.http.impl.client.HttpClientBuilder; | ||
| 18 | -import org.apache.http.util.EntityUtils; | ||
| 19 | import org.apache.shiro.SecurityUtils; | 10 | import org.apache.shiro.SecurityUtils; |
| 20 | import org.apache.shiro.authc.AuthenticationException; | 11 | import org.apache.shiro.authc.AuthenticationException; |
| 21 | import org.apache.shiro.authc.UsernamePasswordToken; | 12 | import org.apache.shiro.authc.UsernamePasswordToken; |
| @@ -27,9 +18,6 @@ import org.springframework.web.bind.annotation.GetMapping; | @@ -27,9 +18,6 @@ import org.springframework.web.bind.annotation.GetMapping; | ||
| 27 | import org.springframework.web.bind.annotation.PostMapping; | 18 | import org.springframework.web.bind.annotation.PostMapping; |
| 28 | import org.springframework.web.bind.annotation.ResponseBody; | 19 | import org.springframework.web.bind.annotation.ResponseBody; |
| 29 | 20 | ||
| 30 | -import com.alibaba.fastjson.JSON; | ||
| 31 | -import com.alibaba.fastjson.JSONArray; | ||
| 32 | -import com.alibaba.fastjson.JSONObject; | ||
| 33 | import com.ruoyi.common.utils.DateUtils; | 21 | import com.ruoyi.common.utils.DateUtils; |
| 34 | import com.ruoyi.common.utils.ServletUtils; | 22 | import com.ruoyi.common.utils.ServletUtils; |
| 35 | import com.ruoyi.common.utils.StringUtils; | 23 | import com.ruoyi.common.utils.StringUtils; |
| @@ -38,25 +26,23 @@ import com.ruoyi.framework.config.RuoYiConfig; | @@ -38,25 +26,23 @@ import com.ruoyi.framework.config.RuoYiConfig; | ||
| 38 | import com.ruoyi.framework.shiro.service.PasswordService; | 26 | import com.ruoyi.framework.shiro.service.PasswordService; |
| 39 | import com.ruoyi.framework.web.controller.BaseController; | 27 | import com.ruoyi.framework.web.controller.BaseController; |
| 40 | import com.ruoyi.framework.web.domain.AjaxResult; | 28 | import com.ruoyi.framework.web.domain.AjaxResult; |
| 41 | -import com.ruoyi.framework.web.service.PermissionService; | ||
| 42 | import com.ruoyi.framework.web.service.TokenService; | 29 | import com.ruoyi.framework.web.service.TokenService; |
| 43 | import com.ruoyi.project.system.config.service.IConfigService; | 30 | import com.ruoyi.project.system.config.service.IConfigService; |
| 44 | import com.ruoyi.project.system.menu.domain.Menu; | 31 | import com.ruoyi.project.system.menu.domain.Menu; |
| 45 | import com.ruoyi.project.system.menu.service.IMenuService; | 32 | import com.ruoyi.project.system.menu.service.IMenuService; |
| 33 | +import com.ruoyi.project.system.menu.service.MenuServiceImpl; | ||
| 46 | import com.ruoyi.project.system.user.domain.User; | 34 | import com.ruoyi.project.system.user.domain.User; |
| 47 | 35 | ||
| 48 | -import io.jsonwebtoken.lang.Assert; | ||
| 49 | - | ||
| 50 | /** | 36 | /** |
| 51 | * 登录验证 | 37 | * 登录验证 |
| 52 | - * | 38 | + * |
| 53 | * @author ruoyi | 39 | * @author ruoyi |
| 54 | */ | 40 | */ |
| 55 | @Controller | 41 | @Controller |
| 56 | public class LoginController extends BaseController | 42 | public class LoginController extends BaseController |
| 57 | { | 43 | { |
| 58 | - @Autowired | ||
| 59 | - TokenService tokenService; | 44 | + @Autowired |
| 45 | + TokenService tokenService; | ||
| 60 | 46 | ||
| 61 | @Autowired | 47 | @Autowired |
| 62 | private IMenuService menuService; | 48 | private IMenuService menuService; |
| @@ -69,8 +55,7 @@ public class LoginController extends BaseController | @@ -69,8 +55,7 @@ public class LoginController extends BaseController | ||
| 69 | 55 | ||
| 70 | @Autowired | 56 | @Autowired |
| 71 | private RuoYiConfig ruoYiConfig; | 57 | private RuoYiConfig ruoYiConfig; |
| 72 | - | ||
| 73 | - | 58 | + |
| 74 | @GetMapping("/login") | 59 | @GetMapping("/login") |
| 75 | public String login(HttpServletRequest request, HttpServletResponse response) | 60 | public String login(HttpServletRequest request, HttpServletResponse response) |
| 76 | { | 61 | { |
| @@ -82,62 +67,23 @@ public class LoginController extends BaseController | @@ -82,62 +67,23 @@ public class LoginController extends BaseController | ||
| 82 | 67 | ||
| 83 | return "login"; | 68 | return "login"; |
| 84 | } | 69 | } |
| 85 | - | 70 | + |
| 86 | @GetMapping("/getInfo") | 71 | @GetMapping("/getInfo") |
| 87 | public String getInfo(String token,ModelMap mmap) | 72 | public String getInfo(String token,ModelMap mmap) |
| 88 | { | 73 | { |
| 89 | - | ||
| 90 | - if(token != null) { | ||
| 91 | - | ||
| 92 | - User user = tokenService.getUser(token); | ||
| 93 | - if (user == null && token != null) { | ||
| 94 | - | ||
| 95 | - String dataJsonStr = sendPost("http://180.169.154.251:18080/information/authenticate/loginAuthentication",token); | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - JSONObject jsonObject = JSON.parseObject(dataJsonStr); | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - JSONObject dataJson = jsonObject.getJSONObject("data"); | ||
| 102 | - | ||
| 103 | - Assert.notNull(dataJson, "获取用户信息异常"); | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - JSONArray jsonMenu = dataJson.getJSONArray("userAuthList").getJSONObject(0).getJSONArray("roleList").getJSONObject(0).getJSONArray("resourceList"); | ||
| 107 | - | ||
| 108 | 74 | ||
| 109 | - Map<Long,Menu> menuMap = new HashMap<Long,Menu>(); | ||
| 110 | - | ||
| 111 | - String ids = ""; | ||
| 112 | - | ||
| 113 | - for(Object json:jsonMenu) { | ||
| 114 | - ids += ((JSONObject)json).getLongValue("menuId") + ","; | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - ids.substring(0,ids.length() -1); | 75 | + if(token != null) { |
| 118 | 76 | ||
| 119 | - List<Menu> allMenus = menuService.selectMenuNormalByMenuIds(ids.split(",")); | ||
| 120 | - | ||
| 121 | - | 77 | + login("admin","admin123",false); |
| 122 | 78 | ||
| 123 | - login("admin","admin123",false); | ||
| 124 | - user = getSysUser(); | ||
| 125 | - user.setToken(token); | ||
| 126 | -// user.setPermissions(permissionService.getMenuPermission()); | ||
| 127 | - tokenService.createToken(user); | ||
| 128 | - | ||
| 129 | - | ||
| 130 | - //String username = dataJson.getString("account"); | ||
| 131 | -// String username = "admin"; | ||
| 132 | -// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); | ||
| 133 | -// SysUser sysUser = sysUserService.selectUserByUserName(username); | ||
| 134 | - | ||
| 135 | -// user.setPermissions(permissionService.getMenuPermission(sysUser)); | ||
| 136 | -// user.setUser(sysUser); | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - mmap.put("menus", allMenus); | 79 | + // 取身份信息 |
| 80 | + User user = getSysUser(); | ||
| 81 | + // 根据用户id取出菜单 | ||
| 82 | + List<Menu> menus = menuService.selectMenusByUser(user); | ||
| 83 | + mmap.put("menus", menus); | ||
| 140 | mmap.put("user", user); | 84 | mmap.put("user", user); |
| 85 | + mmap.put("sideTheme", "theme-dark"); | ||
| 86 | + mmap.put("skinName", "skin-blue"); | ||
| 141 | mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter")); | 87 | mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter")); |
| 142 | mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear()); | 88 | mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear()); |
| 143 | mmap.put("demoEnabled", ruoYiConfig.isDemoEnabled()); | 89 | mmap.put("demoEnabled", ruoYiConfig.isDemoEnabled()); |
| @@ -148,50 +94,36 @@ public class LoginController extends BaseController | @@ -148,50 +94,36 @@ public class LoginController extends BaseController | ||
| 148 | String menuStyle = configService.selectConfigByKey("sys.index.menuStyle"); | 94 | String menuStyle = configService.selectConfigByKey("sys.index.menuStyle"); |
| 149 | // 移动端,默认使左侧导航菜单,否则取默认配置 | 95 | // 移动端,默认使左侧导航菜单,否则取默认配置 |
| 150 | String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle; | 96 | String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle; |
| 151 | - | ||
| 152 | - | 97 | + |
| 98 | + // 优先Cookie配置导航菜单 | ||
| 99 | + Cookie[] cookies = ServletUtils.getRequest().getCookies(); | ||
| 100 | + for (Cookie cookie : cookies) | ||
| 101 | + { | ||
| 102 | + if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) | ||
| 103 | + { | ||
| 104 | + indexStyle = cookie.getValue(); | ||
| 105 | + break; | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + | ||
| 153 | return "index"; | 109 | return "index"; |
| 154 | - | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - } | 110 | + |
| 111 | + }else { | ||
| 112 | + return "login"; | ||
| 113 | + } | ||
| 114 | + | ||
| 158 | // User loginUser = tokenService.getUser(ServletUtils.getRequest()); | 115 | // User loginUser = tokenService.getUser(ServletUtils.getRequest()); |
| 159 | - | 116 | + |
| 160 | 117 | ||
| 161 | // UsernamePasswordToken token = new UsernamePasswordToken(loginUser.getUserName(), loginUser.getPassword(), false); | 118 | // UsernamePasswordToken token = new UsernamePasswordToken(loginUser.getUserName(), loginUser.getPassword(), false); |
| 162 | // Subject subject = SecurityUtils.getSubject(); | 119 | // Subject subject = SecurityUtils.getSubject(); |
| 163 | 120 | ||
| 164 | // subject.login(token); | 121 | // subject.login(token); |
| 165 | // return success(); | 122 | // return success(); |
| 166 | - | ||
| 167 | - return "index"; | ||
| 168 | - } | ||
| 169 | 123 | ||
| 170 | -public String sendPost(String url,String token) { | ||
| 171 | - String strresponse = null; | ||
| 172 | - try{ | ||
| 173 | - HttpClient hc = HttpClientBuilder.create().build();//获取DefaultHttpClient请求 | ||
| 174 | - HttpPost hp = new HttpPost(url); | ||
| 175 | - JSONObject jsonParam = new JSONObject(); | ||
| 176 | 124 | ||
| 177 | - jsonParam.put("token", token); | ||
| 178 | - jsonParam.put("systemCode", "SYS0015"); | ||
| 179 | - //设置数据为utf-8编码 | ||
| 180 | - StringEntity entity = new StringEntity(jsonParam.toString(),"utf-8"); | ||
| 181 | - //设置请求编码 | ||
| 182 | - entity.setContentEncoding("utf-8"); | ||
| 183 | - //设置请求类型 | ||
| 184 | - entity.setContentType("application/json"); | ||
| 185 | - hp.setEntity(entity); | ||
| 186 | - //请求并得到结果 | ||
| 187 | - HttpResponse result = hc.execute(hp); | ||
| 188 | - strresponse = EntityUtils.toString(result.getEntity(),"utf-8").trim(); | ||
| 189 | - }catch(Exception e){ | ||
| 190 | - e.printStackTrace(); | ||
| 191 | - } | ||
| 192 | - return strresponse; | ||
| 193 | - | ||
| 194 | -} | 125 | + |
| 126 | + } | ||
| 195 | 127 | ||
| 196 | // 检查初始密码是否提醒修改 | 128 | // 检查初始密码是否提醒修改 |
| 197 | public boolean initPasswordIsModify(Date pwdUpdateDate) | 129 | public boolean initPasswordIsModify(Date pwdUpdateDate) |
| @@ -199,7 +131,7 @@ public String sendPost(String url,String token) { | @@ -199,7 +131,7 @@ public String sendPost(String url,String token) { | ||
| 199 | Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify")); | 131 | Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify")); |
| 200 | return initPasswordModify !=null && initPasswordModify == 1 && pwdUpdateDate == null; | 132 | return initPasswordModify !=null && initPasswordModify == 1 && pwdUpdateDate == null; |
| 201 | } | 133 | } |
| 202 | - | 134 | + |
| 203 | // 检查密码是否过期 | 135 | // 检查密码是否过期 |
| 204 | public boolean passwordIsExpiration(Date pwdUpdateDate) | 136 | public boolean passwordIsExpiration(Date pwdUpdateDate) |
| 205 | { | 137 | { |
| @@ -216,7 +148,7 @@ public String sendPost(String url,String token) { | @@ -216,7 +148,7 @@ public String sendPost(String url,String token) { | ||
| 216 | } | 148 | } |
| 217 | return false; | 149 | return false; |
| 218 | } | 150 | } |
| 219 | - | 151 | + |
| 220 | public void login(String username, String password, Boolean rememberMe) | 152 | public void login(String username, String password, Boolean rememberMe) |
| 221 | { | 153 | { |
| 222 | UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); | 154 | UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); |
| @@ -234,7 +166,7 @@ public String sendPost(String url,String token) { | @@ -234,7 +166,7 @@ public String sendPost(String url,String token) { | ||
| 234 | } | 166 | } |
| 235 | } | 167 | } |
| 236 | } | 168 | } |
| 237 | - | 169 | + |
| 238 | @PostMapping("/login") | 170 | @PostMapping("/login") |
| 239 | @ResponseBody | 171 | @ResponseBody |
| 240 | public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) | 172 | public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) |
| @@ -262,4 +194,4 @@ public String sendPost(String url,String token) { | @@ -262,4 +194,4 @@ public String sendPost(String url,String token) { | ||
| 262 | { | 194 | { |
| 263 | return "error/unauth"; | 195 | return "error/unauth"; |
| 264 | } | 196 | } |
| 265 | -} | 197 | -} |
| 198 | +} | ||
| 266 | \ No newline at end of file | 199 | \ No newline at end of file |
bsthLineProfiles/src/main/resources/mybatis/mybatis/system/BsthTLineMapper.xml
| @@ -1699,7 +1699,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -1699,7 +1699,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 1699 | delete from bsth_t_line_history where id=#{id} | 1699 | delete from bsth_t_line_history where id=#{id} |
| 1700 | </delete> | 1700 | </delete> |
| 1701 | 1701 | ||
| 1702 | - | 1702 | + <select id="selectCompany" resultType="map"> |
| 1703 | + select * from bsth_company | ||
| 1704 | + </select> | ||
| 1703 | 1705 | ||
| 1704 | 1706 | ||
| 1705 | <!-- | 1707 | <!-- |
bsthLineProfiles/src/main/resources/templates/system/line/line.html
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> | 3 | xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
| 4 | <head> | 4 | <head> |
| 5 | <th:block th:include="include :: header('线路档案信息')" /> | 5 | <th:block th:include="include :: header('线路档案信息')" /> |
| 6 | + <th:block th:include="include :: select2-css" /> | ||
| 6 | </head> | 7 | </head> |
| 7 | <body class="gray-bg"> | 8 | <body class="gray-bg"> |
| 8 | <div class="container-div" id="context"> | 9 | <div class="container-div" id="context"> |
| @@ -11,9 +12,13 @@ | @@ -11,9 +12,13 @@ | ||
| 11 | <form id="formId"> | 12 | <form id="formId"> |
| 12 | <div class="select-list"> | 13 | <div class="select-list"> |
| 13 | <ul> | 14 | <ul> |
| 14 | - <li><label>公司:</label> <input type="text" name="company" /> | 15 | + <li><label>公司:</label> |
| 16 | + <select id='company' > | ||
| 17 | + </select> | ||
| 15 | </li> | 18 | </li> |
| 16 | - <li><label>分公司:</label> <input type="text" name="fCompany" /> | 19 | + <li><label>分公司:</label> |
| 20 | + <select id='fCompany' > | ||
| 21 | + </select> | ||
| 17 | </li> | 22 | </li> |
| 18 | <li><label>线路名称:</label> <input type="text" name="lineName" /> | 23 | <li><label>线路名称:</label> <input type="text" name="lineName" /> |
| 19 | </li> | 24 | </li> |
| @@ -214,6 +219,7 @@ | @@ -214,6 +219,7 @@ | ||
| 214 | </div> | 219 | </div> |
| 215 | </div> | 220 | </div> |
| 216 | <th:block th:include="include :: footer" /> | 221 | <th:block th:include="include :: footer" /> |
| 222 | +<th:block th:include="include :: select2-js" /> | ||
| 217 | <div class="modal fade" id="myModal" tabindex="-1" role="dialog" | 223 | <div class="modal fade" id="myModal" tabindex="-1" role="dialog" |
| 218 | aria-labelledby="myModalLabel" aria-hidden="true"> | 224 | aria-labelledby="myModalLabel" aria-hidden="true"> |
| 219 | <div class="modal-dialog"> | 225 | <div class="modal-dialog"> |
| @@ -241,7 +247,83 @@ | @@ -241,7 +247,83 @@ | ||
| 241 | 247 | ||
| 242 | <script th:inline="javascript"> | 248 | <script th:inline="javascript"> |
| 243 | 249 | ||
| 250 | + var companyList=[[${companyList}]]; | ||
| 251 | + var companies=new Array(); | ||
| 252 | + var fCompanies=new Array(); | ||
| 253 | + $(function() { | ||
| 254 | + for(let i in companyList){ | ||
| 255 | + companies[i]=companyList[i].company; | ||
| 256 | + fCompanies[i]=companyList[i].fCompany; | ||
| 257 | + } | ||
| 258 | + companies=Array.from(new Set(companies)); | ||
| 259 | + companySelect(); | ||
| 260 | + fCompanySelect(false); | ||
| 261 | + $('#company').on('change.select2', function (e) { | ||
| 262 | + fCompanySelect(true) | ||
| 263 | + }); | ||
| 264 | + }); | ||
| 265 | + | ||
| 266 | + function companySelect(){ | ||
| 267 | + var arr = new Array(); | ||
| 268 | + var company=new Object(); | ||
| 269 | + company.id=''; | ||
| 270 | + company.text=''; | ||
| 271 | + company.value=''; | ||
| 272 | + arr.push(company) | ||
| 273 | + for (var i = 0; i < companies.length; i++) { | ||
| 274 | + company=new Object(); | ||
| 275 | + company.id=companies[i]; | ||
| 276 | + company.text=companies[i]; | ||
| 277 | + company.value=companies[i]; | ||
| 278 | + arr.push(company); | ||
| 279 | + } | ||
| 280 | + $("#company").select2({ | ||
| 281 | + data: arr, | ||
| 282 | + placeholder:'请选择', | ||
| 283 | + allowClear:true | ||
| 284 | + }) | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + function fCompanySelect(flag){ | ||
| 289 | + $('#fCompany').empty(); | ||
| 290 | + var company=$('#company').select2('val'); | ||
| 291 | + var arr = new Array(); | ||
| 292 | + var fCompany=new Object(); | ||
| 293 | + fCompany.id=''; | ||
| 294 | + fCompany.text=''; | ||
| 295 | + fCompany.value=''; | ||
| 296 | + arr.push(fCompany) | ||
| 297 | + if(company==''){ | ||
| 298 | + for(let i in companyList){ | ||
| 299 | + var companyName=companyList[i].company; | ||
| 300 | + var fCompanyName=companyList[i].fCompany; | ||
| 301 | + fCompany=new Object(); | ||
| 302 | + fCompany.id=fCompanyName; | ||
| 303 | + fCompany.text=fCompanyName; | ||
| 304 | + fCompany.value=fCompanyName; | ||
| 305 | + arr.push(fCompany); | ||
| 306 | + } | ||
| 307 | + }else { | ||
| 308 | + for(let i in companyList){ | ||
| 309 | + var companyName=companyList[i].company; | ||
| 310 | + var fCompanyName=companyList[i].fCompany; | ||
| 311 | + if(companyName==company){ | ||
| 312 | + fCompany=new Object(); | ||
| 313 | + fCompany.id=fCompanyName; | ||
| 314 | + fCompany.text=fCompanyName; | ||
| 315 | + fCompany.value=fCompanyName; | ||
| 316 | + arr.push(fCompany); | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + } | ||
| 244 | 320 | ||
| 321 | + $("#fCompany").select2({ | ||
| 322 | + data: arr, | ||
| 323 | + placeholder:'请选择', | ||
| 324 | + allowClear:true | ||
| 325 | + }); | ||
| 326 | + } | ||
| 245 | 327 | ||
| 246 | new Vue({ | 328 | new Vue({ |
| 247 | el: '#context', | 329 | el: '#context', |
| @@ -404,6 +486,8 @@ | @@ -404,6 +486,8 @@ | ||
| 404 | 486 | ||
| 405 | function queryParams(params) { | 487 | function queryParams(params) { |
| 406 | var search = $.table.queryParams(params); | 488 | var search = $.table.queryParams(params); |
| 489 | + search.company=$('#company').select2('val'); | ||
| 490 | + search.fCompany=$('#fCompany').select2('val'); | ||
| 407 | return search; | 491 | return search; |
| 408 | } | 492 | } |
| 409 | var editFlag = [[${@permission.hasPermi('system:line:edit')}]]; | 493 | var editFlag = [[${@permission.hasPermi('system:line:edit')}]]; |
bsthLineProfiles/src/main/resources/templates/system/line/map.html
| @@ -48,7 +48,7 @@ body, html, #container { | @@ -48,7 +48,7 @@ body, html, #container { | ||
| 48 | <form id="station"> | 48 | <form id="station"> |
| 49 | <div class="row"> | 49 | <div class="row"> |
| 50 | <h4></h4> | 50 | <h4></h4> |
| 51 | - <label class="col-sm-3"><h4> 站点</h4></label> | 51 | + <label class="col-sm-3"><h4 style="text-align:right">站点</h4></label> |
| 52 | <div class="col-sm-9" > | 52 | <div class="col-sm-9" > |
| 53 | <select id='stations' > | 53 | <select id='stations' > |
| 54 | <option value=""></option> | 54 | <option value=""></option> |
| @@ -58,7 +58,7 @@ body, html, #container { | @@ -58,7 +58,7 @@ body, html, #container { | ||
| 58 | </div> | 58 | </div> |
| 59 | <div class="row"> | 59 | <div class="row"> |
| 60 | <h4></h4> | 60 | <h4></h4> |
| 61 | - <label class="col-sm-3"><h4> 范围</h4></label> | 61 | + <label class="col-sm-3"><h4 style="text-align:right">范围</h4></label> |
| 62 | <div class="col-sm-9"> | 62 | <div class="col-sm-9"> |
| 63 | <input id="distance" class="form-control" type="text" placeholder="单位米"> | 63 | <input id="distance" class="form-control" type="text" placeholder="单位米"> |
| 64 | </div> | 64 | </div> |
| @@ -78,7 +78,7 @@ body, html, #container { | @@ -78,7 +78,7 @@ body, html, #container { | ||
| 78 | <form id="road" style="display:none;"> | 78 | <form id="road" style="display:none;"> |
| 79 | <div class="row"> | 79 | <div class="row"> |
| 80 | <h4></h4> | 80 | <h4></h4> |
| 81 | - <label class="col-sm-3"><h4> 路名</h4></label> | 81 | + <label class="col-sm-3"><h4 style="text-align:right">路名</h4></label> |
| 82 | <div class="col-sm-9"> | 82 | <div class="col-sm-9"> |
| 83 | <input id="roadName" class="form-control" type="text"> | 83 | <input id="roadName" class="form-control" type="text"> |
| 84 | </div> | 84 | </div> |
| @@ -113,7 +113,6 @@ body, html, #container { | @@ -113,7 +113,6 @@ body, html, #container { | ||
| 113 | 113 | ||
| 114 | <div class="info stationInfo"> | 114 | <div class="info stationInfo"> |
| 115 | <div id="stationInfo"></div> | 115 | <div id="stationInfo"></div> |
| 116 | - | ||
| 117 | </div> | 116 | </div> |
| 118 | 117 | ||
| 119 | <div id="container"></div> | 118 | <div id="container"></div> |
bsthLineProfiles/src/main/resources/templates/system/lineAdd/line.html
| @@ -67,6 +67,23 @@ | @@ -67,6 +67,23 @@ | ||
| 67 | 67 | ||
| 68 | <script th:inline="javascript"> | 68 | <script th:inline="javascript"> |
| 69 | 69 | ||
| 70 | + $(function() { | ||
| 71 | + stations=data.stations; | ||
| 72 | + var arr = new Array(); | ||
| 73 | + for (var i = 0; i < stations.length; i++) { | ||
| 74 | + var station=new Object(); | ||
| 75 | + station.id=stations[i]; | ||
| 76 | + station.text=stations[i]; | ||
| 77 | + station.value=stations[i]; | ||
| 78 | + arr.push(station); | ||
| 79 | + } | ||
| 80 | + $("#company").select2({ | ||
| 81 | + data: arr, | ||
| 82 | + placeholder:'请选择', | ||
| 83 | + allowClear:true | ||
| 84 | + }) | ||
| 85 | + }); | ||
| 86 | + | ||
| 70 | function add(obj){ | 87 | function add(obj){ |
| 71 | if($(obj)[0].className.indexOf("disabled") == -1) | 88 | if($(obj)[0].className.indexOf("disabled") == -1) |
| 72 | $.operate.addFull(); | 89 | $.operate.addFull(); |
bsthLineProfiles/src/main/resources/templates/system/lineExamine/line.html
| @@ -12,31 +12,20 @@ | @@ -12,31 +12,20 @@ | ||
| 12 | <form id="formId"> | 12 | <form id="formId"> |
| 13 | <div class="select-list"> | 13 | <div class="select-list"> |
| 14 | <ul> | 14 | <ul> |
| 15 | - <div class="form-group"> | ||
| 16 | - <li class="col-sm-3"><label>公司:</label> <input type="text" name="company" /> | 15 | + <li><label>公司:</label> <input type="text" name="company" /> |
| 17 | </li> | 16 | </li> |
| 18 | - <li class="col-sm-3"><label>分公司:</label> <input type="text" name="fCompany" /> | 17 | + <li><label>分公司:</label> <input type="text" name="fCompany" /> |
| 19 | </li> | 18 | </li> |
| 20 | - <li class="col-sm-3"><label>线路名称:</label> <input type="text" name="lineName" /> | 19 | + <li><label>线路名称:</label> <input type="text" name="lineName" /> |
| 21 | </li> | 20 | </li> |
| 22 | - <li class="col-sm-3"><label>申请开始:</label> | ||
| 23 | - <div class="input-group date"> | ||
| 24 | - <input name="createTimeStr" id="createTimeStr" class="form-control" placeholder="yyyy-MM-dd" type="text" | 21 | + <li ><label>申请开始:</label> |
| 22 | + <input name="createTimeStr" id="createTimeStr" class="form-control" placeholder="yyyy-MM-dd" type="text" | ||
| 25 | autocomplete="off"> | 23 | autocomplete="off"> |
| 26 | - <span class="input-group-addon"><i class="fa fa-calendar"></i></span> | ||
| 27 | - </div> | ||
| 28 | </li> | 24 | </li> |
| 29 | - </div> | ||
| 30 | - <div class="form-group"> | ||
| 31 | - <li class="col-sm-3"><label>申请结束:</label> | ||
| 32 | - <div class="input-group date"> | 25 | + <li><label>申请结束:</label> |
| 33 | <input name="createTimeEnd" id="createTimeEnd" class="form-control" placeholder="yyyy-MM-dd" type="text" | 26 | <input name="createTimeEnd" id="createTimeEnd" class="form-control" placeholder="yyyy-MM-dd" type="text" |
| 34 | autocomplete="off"> | 27 | autocomplete="off"> |
| 35 | - <span class="input-group-addon"><i class="fa fa-calendar"></i></span> | ||
| 36 | - </div> | ||
| 37 | </li> | 28 | </li> |
| 38 | - </div> | ||
| 39 | - | ||
| 40 | <li> | 29 | <li> |
| 41 | <el-button size="mini" type="primary" icon="el-icon-search" onClick="$.table.search();">搜索</el-button> | 30 | <el-button size="mini" type="primary" icon="el-icon-search" onClick="$.table.search();">搜索</el-button> |
| 42 | <el-button size="mini" icon="el-icon-refresh" onClick="$.form.reset();">重置</el-button> | 31 | <el-button size="mini" icon="el-icon-refresh" onClick="$.form.reset();">重置</el-button> |