Commit 4eb90db480908763850602436acf08598017940c

Authored by yiming
1 parent 8ed54c91

bf

bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineAddController.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;
@@ -49,12 +50,16 @@ public class BsthTLineAddController extends BaseController @@ -49,12 +50,16 @@ public class BsthTLineAddController extends BaseController
49 50
50 @Autowired 51 @Autowired
51 private IUserService userService; 52 private IUserService userService;
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 +
  59 + ModelAndView mv=new ModelAndView(prefix + "/line");
  60 + List<Map> companyList=bsthTLineService.selectCompany();
  61 + mv.addObject("companyList",companyList);
  62 + return mv;
58 } 63 }
59 64
60 @GetMapping("/map") 65 @GetMapping("/map")
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineExamineController.java
@@ -15,9 +15,11 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -15,9 +15,11 @@ import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Controller; 15 import org.springframework.stereotype.Controller;
16 import org.springframework.ui.ModelMap; 16 import org.springframework.ui.ModelMap;
17 import org.springframework.web.bind.annotation.*; 17 import org.springframework.web.bind.annotation.*;
  18 +import org.springframework.web.servlet.ModelAndView;
18 19
19 20
20 import java.util.List; 21 import java.util.List;
  22 +import java.util.Map;
21 23
22 24
23 /** 25 /**
@@ -41,14 +43,16 @@ public class BsthTLineExamineController extends BaseController @@ -41,14 +43,16 @@ public class BsthTLineExamineController extends BaseController
41 43
42 44
43 45
44 -  
45 @RequiresPermissions("system:line:view") 46 @RequiresPermissions("system:line:view")
46 @GetMapping() 47 @GetMapping()
47 - public String line() 48 + public ModelAndView line()
48 { 49 {
49 - return prefix + "/line";  
50 - }  
51 50
  51 + ModelAndView mv=new ModelAndView(prefix + "/line");
  52 + List<Map> companyList=bsthTLineService.selectCompany();
  53 + mv.addObject("companyList",companyList);
  54 + return mv;
  55 + }
52 56
53 @GetMapping("/map") 57 @GetMapping("/map")
54 public String map() 58 public String map()
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineHistoryController.java
@@ -30,6 +30,7 @@ import com.ruoyi.common.utils.ServletUtils; @@ -30,6 +30,7 @@ import com.ruoyi.common.utils.ServletUtils;
30 import com.ruoyi.common.utils.poi.ExcelUtil; 30 import com.ruoyi.common.utils.poi.ExcelUtil;
31 import com.ruoyi.common.utils.security.ShiroUtils; 31 import com.ruoyi.common.utils.security.ShiroUtils;
32 import com.ruoyi.framework.web.page.TableDataInfo; 32 import com.ruoyi.framework.web.page.TableDataInfo;
  33 +import org.springframework.web.servlet.ModelAndView;
33 34
34 /** 35 /**
35 * 【请填写功能名称】Controller 36 * 【请填写功能名称】Controller
@@ -53,13 +54,17 @@ public class BsthTLineHistoryController extends BaseController @@ -53,13 +54,17 @@ public class BsthTLineHistoryController extends BaseController
53 @Autowired 54 @Autowired
54 private IUserService userService; 55 private IUserService userService;
55 56
  57 +
56 @RequiresPermissions("system:lineHistory:view") 58 @RequiresPermissions("system:lineHistory:view")
57 @GetMapping() 59 @GetMapping()
58 - public String line() 60 + public ModelAndView line()
59 { 61 {
60 - return prefix + "/line";  
61 - }  
62 62
  63 + ModelAndView mv=new ModelAndView(prefix + "/line");
  64 + List<Map> companyList=bsthTLineService.selectCompany();
  65 + mv.addObject("companyList",companyList);
  66 + return mv;
  67 + }
63 68
64 /** 69 /**
65 * 变更分页 70 * 变更分页
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;
3 import java.util.Date; 4 import java.util.Date;
  5 +import java.util.HashMap;
4 import java.util.List; 6 import java.util.List;
  7 +import java.util.Map;
5 8
6 -import javax.servlet.http.Cookie;  
7 import javax.servlet.http.HttpServletRequest; 9 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse; 10 import javax.servlet.http.HttpServletResponse;
9 11
  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;
10 import org.apache.shiro.SecurityUtils; 19 import org.apache.shiro.SecurityUtils;
11 import org.apache.shiro.authc.AuthenticationException; 20 import org.apache.shiro.authc.AuthenticationException;
12 import org.apache.shiro.authc.UsernamePasswordToken; 21 import org.apache.shiro.authc.UsernamePasswordToken;
@@ -18,6 +27,9 @@ import org.springframework.web.bind.annotation.GetMapping; @@ -18,6 +27,9 @@ import org.springframework.web.bind.annotation.GetMapping;
18 import org.springframework.web.bind.annotation.PostMapping; 27 import org.springframework.web.bind.annotation.PostMapping;
19 import org.springframework.web.bind.annotation.ResponseBody; 28 import org.springframework.web.bind.annotation.ResponseBody;
20 29
  30 +import com.alibaba.fastjson.JSON;
  31 +import com.alibaba.fastjson.JSONArray;
  32 +import com.alibaba.fastjson.JSONObject;
21 import com.ruoyi.common.utils.DateUtils; 33 import com.ruoyi.common.utils.DateUtils;
22 import com.ruoyi.common.utils.ServletUtils; 34 import com.ruoyi.common.utils.ServletUtils;
23 import com.ruoyi.common.utils.StringUtils; 35 import com.ruoyi.common.utils.StringUtils;
@@ -26,13 +38,15 @@ import com.ruoyi.framework.config.RuoYiConfig; @@ -26,13 +38,15 @@ import com.ruoyi.framework.config.RuoYiConfig;
26 import com.ruoyi.framework.shiro.service.PasswordService; 38 import com.ruoyi.framework.shiro.service.PasswordService;
27 import com.ruoyi.framework.web.controller.BaseController; 39 import com.ruoyi.framework.web.controller.BaseController;
28 import com.ruoyi.framework.web.domain.AjaxResult; 40 import com.ruoyi.framework.web.domain.AjaxResult;
  41 +import com.ruoyi.framework.web.service.PermissionService;
29 import com.ruoyi.framework.web.service.TokenService; 42 import com.ruoyi.framework.web.service.TokenService;
30 import com.ruoyi.project.system.config.service.IConfigService; 43 import com.ruoyi.project.system.config.service.IConfigService;
31 import com.ruoyi.project.system.menu.domain.Menu; 44 import com.ruoyi.project.system.menu.domain.Menu;
32 import com.ruoyi.project.system.menu.service.IMenuService; 45 import com.ruoyi.project.system.menu.service.IMenuService;
33 -import com.ruoyi.project.system.menu.service.MenuServiceImpl;  
34 import com.ruoyi.project.system.user.domain.User; 46 import com.ruoyi.project.system.user.domain.User;
35 47
  48 +import io.jsonwebtoken.lang.Assert;
  49 +
36 /** 50 /**
37 * 登录验证 51 * 登录验证
38 * 52 *
@@ -56,6 +70,7 @@ public class LoginController extends BaseController @@ -56,6 +70,7 @@ public class LoginController extends BaseController
56 @Autowired 70 @Autowired
57 private RuoYiConfig ruoYiConfig; 71 private RuoYiConfig ruoYiConfig;
58 72
  73 +
59 @GetMapping("/login") 74 @GetMapping("/login")
60 public String login(HttpServletRequest request, HttpServletResponse response) 75 public String login(HttpServletRequest request, HttpServletResponse response)
61 { 76 {
@@ -74,44 +89,72 @@ public class LoginController extends BaseController @@ -74,44 +89,72 @@ public class LoginController extends BaseController
74 89
75 if(token != null) { 90 if(token != null) {
76 91
77 - login("admin","admin123",false);  
78 -  
79 - // 取身份信息  
80 - User user = getSysUser();  
81 - // 根据用户id取出菜单  
82 - List<Menu> menus = menuService.selectMenusByUser(user);  
83 - mmap.put("menus", menus);  
84 - mmap.put("user", user);  
85 - mmap.put("sideTheme", "theme-dark");  
86 - mmap.put("skinName", "skin-blue");  
87 - mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter"));  
88 - mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());  
89 - mmap.put("demoEnabled", ruoYiConfig.isDemoEnabled());  
90 - mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));  
91 - mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));  
92 -  
93 - // 菜单导航显示风格  
94 - String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");  
95 - // 移动端,默认使左侧导航菜单,否则取默认配置  
96 - String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;  
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; 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 +
  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") + ",";
106 } 115 }
107 - }  
108 116
109 - return "index"; 117 + ids.substring(0,ids.length() -1);
110 118
111 - }else {  
112 - return "login";  
113 - } 119 + List<Menu> allMenus = menuService.selectMenuNormalByMenuIds(ids.split(","));
114 120
  121 +
  122 +
  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);
  140 + mmap.put("user", user);
  141 + mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter"));
  142 + mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
  143 + mmap.put("demoEnabled", ruoYiConfig.isDemoEnabled());
  144 + mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
  145 + mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
  146 +
  147 + // 菜单导航显示风格
  148 + String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
  149 + // 移动端,默认使左侧导航菜单,否则取默认配置
  150 + String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
  151 +
  152 +
  153 + return "index";
  154 +
  155 + }
  156 +
  157 + }
115 // User loginUser = tokenService.getUser(ServletUtils.getRequest()); 158 // User loginUser = tokenService.getUser(ServletUtils.getRequest());
116 159
117 160
@@ -121,7 +164,32 @@ public class LoginController extends BaseController @@ -121,7 +164,32 @@ public class LoginController extends BaseController
121 // subject.login(token); 164 // subject.login(token);
122 // return success(); 165 // return success();
123 166
  167 + return "index";
  168 + }
  169 +
  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();
124 176
  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;
125 193
126 } 194 }
127 195
@@ -194,4 +262,4 @@ public class LoginController extends BaseController @@ -194,4 +262,4 @@ public class LoginController extends BaseController
194 { 262 {
195 return "error/unauth"; 263 return "error/unauth";
196 } 264 }
197 -}  
198 \ No newline at end of file 265 \ No newline at end of file
  266 +}
bsthLineProfiles/src/main/resources/application-druid.yml
@@ -5,18 +5,22 @@ spring: @@ -5,18 +5,22 @@ spring:
5 driverClassName: com.mysql.cj.jdbc.Driver 5 driverClassName: com.mysql.cj.jdbc.Driver
6 druid: 6 druid:
7 # 主库数据源 7 # 主库数据源
  8 +# master:
  9 +# url: jdbc:mysql://localhost:3306/linedata?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  10 +# username: root
  11 +# password: Aa123456
  12 + # 主库数据源
8 master: 13 master:
9 url: jdbc:mysql://localhost:3306/bsth_line_profiles?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 14 url: jdbc:mysql://localhost:3306/bsth_line_profiles?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
10 username: root 15 username: root
11 password: 1995627a 16 password: 1995627a
12 - #password: Aa123456  
13 # 从库数据源 17 # 从库数据源
14 slave: 18 slave:
15 # 从数据源开关/默认关闭 19 # 从数据源开关/默认关闭
16 enabled: false 20 enabled: false
17 - url:  
18 - username:  
19 - password: 21 + url:
  22 + username:
  23 + password:
20 # 初始连接数 24 # 初始连接数
21 initialSize: 5 25 initialSize: 5
22 # 最小连接池数量 26 # 最小连接池数量
@@ -36,7 +40,7 @@ spring: @@ -36,7 +40,7 @@ spring:
36 testWhileIdle: true 40 testWhileIdle: true
37 testOnBorrow: false 41 testOnBorrow: false
38 testOnReturn: false 42 testOnReturn: false
39 - webStatFilter: 43 + webStatFilter:
40 enabled: true 44 enabled: true
41 statViewServlet: 45 statViewServlet:
42 enabled: true 46 enabled: true
@@ -44,8 +48,8 @@ spring: @@ -44,8 +48,8 @@ spring:
44 allow: 48 allow:
45 url-pattern: /druid/* 49 url-pattern: /druid/*
46 # 控制台管理用户名和密码 50 # 控制台管理用户名和密码
47 - login-username:  
48 - login-password: 51 + login-username:
  52 + login-password:
49 filter: 53 filter:
50 stat: 54 stat:
51 enabled: true 55 enabled: true
bsthLineProfiles/src/main/resources/application.yml
@@ -28,7 +28,7 @@ server: @@ -28,7 +28,7 @@ server:
28 max-threads: 800 28 max-threads: 800
29 # Tomcat启动初始化的线程数,默认值25 29 # Tomcat启动初始化的线程数,默认值25
30 min-spare-threads: 30 30 min-spare-threads: 30
31 - 31 +
32 # 日志配置 32 # 日志配置
33 logging: 33 logging:
34 level: 34 level:
@@ -56,7 +56,7 @@ spring: @@ -56,7 +56,7 @@ spring:
56 jackson: 56 jackson:
57 time-zone: GMT+8 57 time-zone: GMT+8
58 date-format: yyyy-MM-dd HH:mm:ss 58 date-format: yyyy-MM-dd HH:mm:ss
59 - profiles: 59 + profiles:
60 active: druid 60 active: druid
61 # 文件上传 61 # 文件上传
62 servlet: 62 servlet:
@@ -93,7 +93,7 @@ spring: @@ -93,7 +93,7 @@ spring:
93 max-active: 8 93 max-active: 8
94 # #连接池最大阻塞等待时间(使用负值表示没有限制) 94 # #连接池最大阻塞等待时间(使用负值表示没有限制)
95 max-wait: -1ms 95 max-wait: -1ms
96 - 96 +
97 token: 97 token:
98 # 令牌自定义标识 98 # 令牌自定义标识
99 header: Authorization 99 header: Authorization
@@ -112,11 +112,11 @@ mybatis: @@ -112,11 +112,11 @@ mybatis:
112 configLocation: classpath:mybatis/mybatis-config.xml 112 configLocation: classpath:mybatis/mybatis-config.xml
113 113
114 # PageHelper分页插件 114 # PageHelper分页插件
115 -pagehelper: 115 +pagehelper:
116 helperDialect: mysql 116 helperDialect: mysql
117 reasonable: true 117 reasonable: true
118 supportMethodsArguments: true 118 supportMethodsArguments: true
119 - params: count=countSql 119 + params: count=countSql
120 120
121 # Shiro 121 # Shiro
122 shiro: 122 shiro:
@@ -128,12 +128,12 @@ shiro: @@ -128,12 +128,12 @@ shiro:
128 # 首页地址 128 # 首页地址
129 indexUrl: /index 129 indexUrl: /index
130 # 验证码开关 130 # 验证码开关
131 - captchaEnabled: false 131 + captchaEnabled: true
132 # 验证码类型 math 数组计算 char 字符 132 # 验证码类型 math 数组计算 char 字符
133 captchaType: math 133 captchaType: math
134 cookie: 134 cookie:
135 # 设置Cookie的域名 默认空,即当前访问的域名 135 # 设置Cookie的域名 默认空,即当前访问的域名
136 - domain: 136 + domain:
137 # 设置cookie的有效访问路径 137 # 设置cookie的有效访问路径
138 path: / 138 path: /
139 # 设置HttpOnly属性 139 # 设置HttpOnly属性
@@ -155,7 +155,7 @@ shiro: @@ -155,7 +155,7 @@ shiro:
155 kickoutAfter: false 155 kickoutAfter: false
156 156
157 # 防止XSS攻击 157 # 防止XSS攻击
158 -xss: 158 +xss:
159 # 过滤开关 159 # 过滤开关
160 enabled: true 160 enabled: true
161 # 排除链接(多个用逗号分隔) 161 # 排除链接(多个用逗号分隔)
@@ -169,7 +169,7 @@ swagger: @@ -169,7 +169,7 @@ swagger:
169 enabled: true 169 enabled: true
170 170
171 # 代码生成 171 # 代码生成
172 -gen: 172 +gen:
173 # 作者 173 # 作者
174 author: ruoyi 174 author: ruoyi
175 # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool 175 # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
bsthLineProfiles/src/main/resources/templates/system/line/line.html
@@ -257,9 +257,9 @@ @@ -257,9 +257,9 @@
257 } 257 }
258 companies=Array.from(new Set(companies)); 258 companies=Array.from(new Set(companies));
259 companySelect(); 259 companySelect();
260 - fCompanySelect(false); 260 + fCompanySelect();
261 $('#company').on('change.select2', function (e) { 261 $('#company').on('change.select2', function (e) {
262 - fCompanySelect(true) 262 + fCompanySelect()
263 }); 263 });
264 }); 264 });
265 265
@@ -285,7 +285,7 @@ @@ -285,7 +285,7 @@
285 } 285 }
286 286
287 287
288 - function fCompanySelect(flag){ 288 + function fCompanySelect(){
289 $('#fCompany').empty(); 289 $('#fCompany').empty();
290 var company=$('#company').select2('val'); 290 var company=$('#company').select2('val');
291 var arr = new Array(); 291 var arr = new Array();
bsthLineProfiles/src/main/resources/templates/system/lineAdd/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>
@@ -39,6 +44,7 @@ @@ -39,6 +44,7 @@
39 </div> 44 </div>
40 </div> 45 </div>
41 <th:block th:include="include :: footer" /> 46 <th:block th:include="include :: footer" />
  47 + <th:block th:include="include :: select2-js" />
42 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" 48 <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
43 aria-labelledby="myModalLabel" aria-hidden="true"> 49 aria-labelledby="myModalLabel" aria-hidden="true">
44 <div class="modal-dialog"> 50 <div class="modal-dialog">
@@ -67,22 +73,83 @@ @@ -67,22 +73,83 @@
67 73
68 <script th:inline="javascript"> 74 <script th:inline="javascript">
69 75
  76 + var companyList=[[${companyList}]];
  77 + var companies=new Array();
  78 + var fCompanies=new Array();
70 $(function() { 79 $(function() {
71 - stations=data.stations; 80 + for(let i in companyList){
  81 + companies[i]=companyList[i].company;
  82 + fCompanies[i]=companyList[i].fCompany;
  83 + }
  84 + companies=Array.from(new Set(companies));
  85 + companySelect();
  86 + fCompanySelect();
  87 + $('#company').on('change.select2', function (e) {
  88 + fCompanySelect()
  89 + });
  90 + });
  91 +
  92 + function companySelect(){
72 var arr = new Array(); 93 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); 94 + var company=new Object();
  95 + company.id='';
  96 + company.text='';
  97 + company.value='';
  98 + arr.push(company)
  99 + for (var i = 0; i < companies.length; i++) {
  100 + company=new Object();
  101 + company.id=companies[i];
  102 + company.text=companies[i];
  103 + company.value=companies[i];
  104 + arr.push(company);
79 } 105 }
80 $("#company").select2({ 106 $("#company").select2({
81 data: arr, 107 data: arr,
82 placeholder:'请选择', 108 placeholder:'请选择',
83 allowClear:true 109 allowClear:true
84 }) 110 })
85 - }); 111 + }
  112 +
  113 +
  114 + function fCompanySelect(){
  115 + $('#fCompany').empty();
  116 + var company=$('#company').select2('val');
  117 + var arr = new Array();
  118 + var fCompany=new Object();
  119 + fCompany.id='';
  120 + fCompany.text='';
  121 + fCompany.value='';
  122 + arr.push(fCompany)
  123 + if(company==''){
  124 + for(let i in companyList){
  125 + var companyName=companyList[i].company;
  126 + var fCompanyName=companyList[i].fCompany;
  127 + fCompany=new Object();
  128 + fCompany.id=fCompanyName;
  129 + fCompany.text=fCompanyName;
  130 + fCompany.value=fCompanyName;
  131 + arr.push(fCompany);
  132 + }
  133 + }else {
  134 + for(let i in companyList){
  135 + var companyName=companyList[i].company;
  136 + var fCompanyName=companyList[i].fCompany;
  137 + if(companyName==company){
  138 + fCompany=new Object();
  139 + fCompany.id=fCompanyName;
  140 + fCompany.text=fCompanyName;
  141 + fCompany.value=fCompanyName;
  142 + arr.push(fCompany);
  143 + }
  144 + }
  145 + }
  146 +
  147 + $("#fCompany").select2({
  148 + data: arr,
  149 + placeholder:'请选择',
  150 + allowClear:true
  151 + });
  152 + }
86 153
87 function add(obj){ 154 function add(obj){
88 if($(obj)[0].className.indexOf("disabled") == -1) 155 if($(obj)[0].className.indexOf("disabled") == -1)
@@ -199,7 +266,12 @@ @@ -199,7 +266,12 @@
199 } 266 }
200 } 267 }
201 } 268 }
202 - 269 + function queryParams(params) {
  270 + var search = $.table.queryParams(params);
  271 + search.company=$('#company').select2('val');
  272 + search.fCompany=$('#fCompany').select2('val');
  273 + return search;
  274 + }
203 275
204 var editFlag = [[${@permission.hasPermi('system:lineReport:edit')}]]; 276 var editFlag = [[${@permission.hasPermi('system:lineReport:edit')}]];
205 var removeFlag = [[${@permission.hasPermi('system:lineReport:remove')}]]; 277 var removeFlag = [[${@permission.hasPermi('system:lineReport:remove')}]];
bsthLineProfiles/src/main/resources/templates/system/lineExamine/line.html
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 <head> 4 <head>
5 <th:block th:include="include :: header('线路档案信息')" /> 5 <th:block th:include="include :: header('线路档案信息')" />
6 <th:block th:include="include :: datetimepicker-css" /> 6 <th:block th:include="include :: datetimepicker-css" />
  7 +<th:block th:include="include :: select2-css" />
7 </head> 8 </head>
8 <body class="gray-bg"> 9 <body class="gray-bg">
9 <div class="container-div" id="context"> 10 <div class="container-div" id="context">
@@ -12,9 +13,13 @@ @@ -12,9 +13,13 @@
12 <form id="formId"> 13 <form id="formId">
13 <div class="select-list"> 14 <div class="select-list">
14 <ul> 15 <ul>
15 - <li><label>公司:</label> <input type="text" name="company" /> 16 + <li><label>公司:</label>
  17 + <select id='company' >
  18 + </select>
16 </li> 19 </li>
17 - <li><label>分公司:</label> <input type="text" name="fCompany" /> 20 + <li><label>分公司:</label>
  21 + <select id='fCompany' >
  22 + </select>
18 </li> 23 </li>
19 <li><label>线路名称:</label> <input type="text" name="lineName" /> 24 <li><label>线路名称:</label> <input type="text" name="lineName" />
20 </li> 25 </li>
@@ -44,6 +49,7 @@ @@ -44,6 +49,7 @@
44 </div> 49 </div>
45 <th:block th:include="include :: footer" /> 50 <th:block th:include="include :: footer" />
46 <th:block th:include="include :: datetimepicker-js" /> 51 <th:block th:include="include :: datetimepicker-js" />
  52 + <th:block th:include="include :: select2-js" />
47 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" 53 <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
48 aria-labelledby="myModalLabel" aria-hidden="true"> 54 aria-labelledby="myModalLabel" aria-hidden="true">
49 <div class="modal-dialog"> 55 <div class="modal-dialog">
@@ -71,7 +77,83 @@ @@ -71,7 +77,83 @@
71 77
72 78
73 <script th:inline="javascript"> 79 <script th:inline="javascript">
  80 + var companyList=[[${companyList}]];
  81 + var companies=new Array();
  82 + var fCompanies=new Array();
  83 + $(function() {
  84 + for(let i in companyList){
  85 + companies[i]=companyList[i].company;
  86 + fCompanies[i]=companyList[i].fCompany;
  87 + }
  88 + companies=Array.from(new Set(companies));
  89 + companySelect();
  90 + fCompanySelect();
  91 + $('#company').on('change.select2', function (e) {
  92 + fCompanySelect()
  93 + });
  94 + });
  95 +
  96 + function companySelect(){
  97 + var arr = new Array();
  98 + var company=new Object();
  99 + company.id='';
  100 + company.text='';
  101 + company.value='';
  102 + arr.push(company)
  103 + for (var i = 0; i < companies.length; i++) {
  104 + company=new Object();
  105 + company.id=companies[i];
  106 + company.text=companies[i];
  107 + company.value=companies[i];
  108 + arr.push(company);
  109 + }
  110 + $("#company").select2({
  111 + data: arr,
  112 + placeholder:'请选择',
  113 + allowClear:true
  114 + })
  115 + }
  116 +
74 117
  118 + function fCompanySelect(){
  119 + $('#fCompany').empty();
  120 + var company=$('#company').select2('val');
  121 + var arr = new Array();
  122 + var fCompany=new Object();
  123 + fCompany.id='';
  124 + fCompany.text='';
  125 + fCompany.value='';
  126 + arr.push(fCompany)
  127 + if(company==''){
  128 + for(let i in companyList){
  129 + var companyName=companyList[i].company;
  130 + var fCompanyName=companyList[i].fCompany;
  131 + fCompany=new Object();
  132 + fCompany.id=fCompanyName;
  133 + fCompany.text=fCompanyName;
  134 + fCompany.value=fCompanyName;
  135 + arr.push(fCompany);
  136 + }
  137 + }else {
  138 + for(let i in companyList){
  139 + var companyName=companyList[i].company;
  140 + var fCompanyName=companyList[i].fCompany;
  141 + if(companyName==company){
  142 + fCompany=new Object();
  143 + fCompany.id=fCompanyName;
  144 + fCompany.text=fCompanyName;
  145 + fCompany.value=fCompanyName;
  146 + arr.push(fCompany);
  147 + }
  148 + }
  149 + }
  150 +
  151 + $("#fCompany").select2({
  152 + data: arr,
  153 + placeholder:'请选择',
  154 + allowClear:true
  155 + });
  156 + }
75 157
76 new Vue({ 158 new Vue({
77 el: '#context', 159 el: '#context',
@@ -88,6 +170,8 @@ @@ -88,6 +170,8 @@
88 var createTimeEnd=$('#createTimeEnd').val(); 170 var createTimeEnd=$('#createTimeEnd').val();
89 search.createTimeStr=createTimeStr; 171 search.createTimeStr=createTimeStr;
90 search.createTimeEnd=createTimeEnd; 172 search.createTimeEnd=createTimeEnd;
  173 + search.company=$('#company').select2('val');
  174 + search.fCompany=$('#fCompany').select2('val');
91 return search; 175 return search;
92 } 176 }
93 177
bsthLineProfiles/src/main/resources/templates/system/lineHistory/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>
@@ -34,6 +39,7 @@ @@ -34,6 +39,7 @@
34 </div> 39 </div>
35 </div> 40 </div>
36 <th:block th:include="include :: footer" /> 41 <th:block th:include="include :: footer" />
  42 + <th:block th:include="include :: select2-js" />
37 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" 43 <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
38 aria-labelledby="myModalLabel" aria-hidden="true"> 44 aria-labelledby="myModalLabel" aria-hidden="true">
39 <div class="modal-dialog"> 45 <div class="modal-dialog">
@@ -61,7 +67,83 @@ @@ -61,7 +67,83 @@
61 67
62 68
63 <script th:inline="javascript"> 69 <script th:inline="javascript">
  70 + var companyList=[[${companyList}]];
  71 + var companies=new Array();
  72 + var fCompanies=new Array();
  73 + $(function() {
  74 + for(let i in companyList){
  75 + companies[i]=companyList[i].company;
  76 + fCompanies[i]=companyList[i].fCompany;
  77 + }
  78 + companies=Array.from(new Set(companies));
  79 + companySelect();
  80 + fCompanySelect();
  81 + $('#company').on('change.select2', function (e) {
  82 + fCompanySelect()
  83 + });
  84 + });
  85 +
  86 + function companySelect(){
  87 + var arr = new Array();
  88 + var company=new Object();
  89 + company.id='';
  90 + company.text='';
  91 + company.value='';
  92 + arr.push(company)
  93 + for (var i = 0; i < companies.length; i++) {
  94 + company=new Object();
  95 + company.id=companies[i];
  96 + company.text=companies[i];
  97 + company.value=companies[i];
  98 + arr.push(company);
  99 + }
  100 + $("#company").select2({
  101 + data: arr,
  102 + placeholder:'请选择',
  103 + allowClear:true
  104 + })
  105 + }
  106 +
64 107
  108 + function fCompanySelect(){
  109 + $('#fCompany').empty();
  110 + var company=$('#company').select2('val');
  111 + var arr = new Array();
  112 + var fCompany=new Object();
  113 + fCompany.id='';
  114 + fCompany.text='';
  115 + fCompany.value='';
  116 + arr.push(fCompany)
  117 + if(company==''){
  118 + for(let i in companyList){
  119 + var companyName=companyList[i].company;
  120 + var fCompanyName=companyList[i].fCompany;
  121 + fCompany=new Object();
  122 + fCompany.id=fCompanyName;
  123 + fCompany.text=fCompanyName;
  124 + fCompany.value=fCompanyName;
  125 + arr.push(fCompany);
  126 + }
  127 + }else {
  128 + for(let i in companyList){
  129 + var companyName=companyList[i].company;
  130 + var fCompanyName=companyList[i].fCompany;
  131 + if(companyName==company){
  132 + fCompany=new Object();
  133 + fCompany.id=fCompanyName;
  134 + fCompany.text=fCompanyName;
  135 + fCompany.value=fCompanyName;
  136 + arr.push(fCompany);
  137 + }
  138 + }
  139 + }
  140 +
  141 + $("#fCompany").select2({
  142 + data: arr,
  143 + placeholder:'请选择',
  144 + allowClear:true
  145 + });
  146 + }
65 147
66 new Vue({ 148 new Vue({
67 el: '#context', 149 el: '#context',
@@ -75,6 +157,8 @@ @@ -75,6 +157,8 @@
75 var search = $.table.queryParams(params); 157 var search = $.table.queryParams(params);
76 search.examineStatus ='true'; 158 search.examineStatus ='true';
77 search.examineType='0'; 159 search.examineType='0';
  160 + search.company=$('#company').select2('val');
  161 + search.fCompany=$('#fCompany').select2('val');
78 return search; 162 return search;
79 } 163 }
80 164