Merge remote-tracking branch 'origin/main'

# Conflicts:
#	RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/outside/service/impl/OutSideServiceImpl.java
This commit is contained in:
biexiande 2025-02-20 18:11:19 +08:00
commit fb80307d8d
83 changed files with 1529 additions and 599 deletions

View File

@ -5,6 +5,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.framework.security.service.SysLoginService; import com.ruoyi.framework.security.service.SysLoginService;
import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysUserService;
import com.ruoyi.project.system.utils.AESUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -32,11 +35,11 @@ public class OauthDemo {
* 认证地址应用注册id应用注册key 三个参数因环境不同而不同建议改为从配置文件中读取 * 认证地址应用注册id应用注册key 三个参数因环境不同而不同建议改为从配置文件中读取
*/ */
//认证地址 //认证地址
public static final String BASE_URL = "http://utuum.sd-gold.com:7021/idp/oauth2"; public static final String BASE_URL = "https://iam.sd-port.com:18010/idp/oauth2";
//应用注册id //应用注册id
public static final String CLIENT_ID = "hfxyjwzxjc"; public static final String CLIENT_ID = "hfxyjwzxjc";
//应用注册key //应用注册key
public static final String CLIENT_SECRET = "2c9ecb1b6b1f47d297abb6ffa7ede060"; public static final String CLIENT_SECRET = "f1a1aebeaf24419591d895768fe72328";
//获取access_token的url //获取access_token的url
public static final String GET_ACCESS_TOKEN_URL = BASE_URL + "/getToken"; public static final String GET_ACCESS_TOKEN_URL = BASE_URL + "/getToken";
@ -51,7 +54,9 @@ public class OauthDemo {
*/ */
@RequestMapping("/redirectToAuth") @RequestMapping("/redirectToAuth")
public void reToAuth(HttpServletRequest request, HttpServletResponse response) { public void reToAuth(HttpServletRequest request, HttpServletResponse response) {
String url = request.getRequestURL().toString().replaceAll("/prod-api/redirectToAuth", "/prod-api/getAccountName"); System.out.println("redirectToAuth------------------->"+ request.getRequestURL().toString());
String url = request.getRequestURL().toString().replaceAll("/redirectToAuth", "/LoginSso");
System.out.println("redirectToAuth------------------->"+url);
String re_url = BASE_URL + "/authorize?redirect_uri=" + url + "&state=sso&client_id=" + CLIENT_ID + "&response_type=code"; String re_url = BASE_URL + "/authorize?redirect_uri=" + url + "&state=sso&client_id=" + CLIENT_ID + "&response_type=code";
try { try {
response.sendRedirect(re_url); response.sendRedirect(re_url);
@ -60,6 +65,8 @@ public class OauthDemo {
} }
} }
@Autowired
private ISysUserService sysUserService;
/** /**
* 此方法最后取到账号acc的值后需要各系统进行登录逻辑处理 * 此方法最后取到账号acc的值后需要各系统进行登录逻辑处理
* @param code 用户名和密码认证通过后返回的codeaccess_token,从而获取到用户或账号信息 * @param code 用户名和密码认证通过后返回的codeaccess_token,从而获取到用户或账号信息
@ -101,9 +108,11 @@ public class OauthDemo {
return null; return null;
} }
System.out.println("the acc is :" + acc); System.out.println("the acc is :" + acc);
String s = loginService.loginNoCaptcha(userName, passWord, null);
String tokenNew = loginService.loginNoCode(acc,"123456",null,null);
AjaxResult success = AjaxResult.success(); AjaxResult success = AjaxResult.success();
success.put(Constants.TOKEN,s); success.put(Constants.TOKEN,tokenNew);
success.put("mgs","登录成功"); success.put("mgs","登录成功");
return success; return success;
} }

View File

@ -34,9 +34,9 @@ public class EquTask {
@Autowired @Autowired
private ThDeviceMapper thDeviceMapper; private ThDeviceMapper thDeviceMapper;
/** /**
* 港口原有设备对接 * 港口原有设备对接-
*/ */
// @Scheduled(fixedRate = 10000) @Scheduled(fixedRate = 1200000)
public void equ(){ public void equ(){
String hash = "16EA8A305FB58BE0730DD67F04F022F4"; String hash = "16EA8A305FB58BE0730DD67F04F022F4";
@ -48,11 +48,11 @@ public class EquTask {
JSONObject dataByJson = tokenByJson.getJSONObject("data"); JSONObject dataByJson = tokenByJson.getJSONObject("data");
String token = dataByJson.getString("token"); String token = dataByJson.getString("token");
ThDevice thDevice = new ThDevice(); ThDevice thDevice = new ThDevice();
thDevice.setDeptId(5l); // thDevice.setDeptId(5l);
List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice); List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
equLists.forEach(e->{ equLists.forEach(e->{
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
System.out.println("开始获取数据");
map.put("sensorUId",e.getSn()); map.put("sensorUId",e.getSn());
map.put("label",e.getName()); map.put("label",e.getName());
HttpResult result = OkHttps.sync("http://10.201.35.30:8090/enviSensor/select?" + HttpResult result = OkHttps.sync("http://10.201.35.30:8090/enviSensor/select?" +
@ -60,6 +60,7 @@ public class EquTask {
.addPathPara(map) .addPathPara(map)
.addHeader("token", token) .addHeader("token", token)
.get(); .get();
JSONObject vocByJson = result.getBody().toBean(JSONObject.class); JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
JSONObject vocDataByJson = vocByJson.getJSONObject("data"); JSONObject vocDataByJson = vocByJson.getJSONObject("data");
JSONArray vocByArray = vocDataByJson.getJSONArray("array"); JSONArray vocByArray = vocDataByJson.getJSONArray("array");
@ -72,6 +73,49 @@ public class EquTask {
}); });
} }
/**
* 港口原有设备对接-
*/
// @Scheduled(fixedRate = 600000)
// public void equ(){
// try {
// System.out.println("=================================================");
// String hash = "16EA8A305FB58BE0730DD67F04F022F4";
//
// HttpResult httpResult = OkHttps.sync("http://10.201.35.30:8090/user/login").addBodyPara("userName", "admin")
// .addBodyPara("password", hash)
// .bodyType("application/json")
// .post();
// JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class);
// System.out.println("---------------------------------"+tokenByJson);
// JSONObject dataByJson = tokenByJson.getJSONObject("data");
// String token = dataByJson.getString("token");
// ThDevice thDevice = new ThDevice();
//// thDevice.setDeptId(5l);
//// List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
//// equLists.forEach(e->{
// HashMap<String, Object> map = new HashMap<>();
// token = "28e73f2d211f3ac211313a1aa61dc0c5";
// map.put("token",token);
// HttpResult result = OkHttps.sync("http://10.205.51.190:30100/device/getGasDeviceList?token={token}")
// .addPathPara(map)
// .addHeader("token", token)
// .post();
// JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
// System.out.println("---------------------------------"+vocByJson);
// JSONArray vocByArray = vocByJson.getJSONArray("data");
// System.out.println(vocByArray.toString());
// try {
// Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
// } catch (JsonProcessingException jsonProcessingException) {
// jsonProcessingException.printStackTrace();
// }
//
//// });
// }catch (Exception e){
// e.printStackTrace();
// }
// }
public void dateByDay(){ public void dateByDay(){
outSideService.monthTask(""); outSideService.monthTask("");
} }

View File

@ -107,10 +107,10 @@ public class DataScopeAspect
{ {
continue; continue;
} }
if (!StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))) // if (!StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
{ // {
continue; // continue;
} // }
if (DATA_SCOPE_ALL.equals(dataScope)) if (DATA_SCOPE_ALL.equals(dataScope))
{ {
sqlString = new StringBuilder(); sqlString = new StringBuilder();
@ -135,7 +135,9 @@ public class DataScopeAspect
} }
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
{ {
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or FIND_IN_SET ( {} ,ancestors ) <> 0 )", deptAlias, user.getDeptId(), user.getDeptId())); sqlString.append(StringUtils.format(" {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} OR INSTR(',' || ancestors || ',', ',' || {} || ',') > 0 )", deptAlias, user.getDeptId(), user.getDeptId()));
// sqlString.append(StringUtils.format(" {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or FIND_IN_SET ( {} ,ancestors ) <> 0 )", deptAlias, user.getDeptId(), user.getDeptId()));
} }
else if (DATA_SCOPE_SELF.equals(dataScope)) else if (DATA_SCOPE_SELF.equals(dataScope))
{ {
@ -164,7 +166,7 @@ public class DataScopeAspect
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
{ {
BaseEntity baseEntity = (BaseEntity) params; BaseEntity baseEntity = (BaseEntity) params;
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString + ")");
} }
} }
} }

View File

@ -111,7 +111,7 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> { .authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login","/bbc/**", requests.antMatchers("/singleSign","/login","/bbc/**",
"/register", "/captchaImage","/outside/*","/redirectToAuth","/getAccountName").permitAll() "/register", "/captchaImage","/outside/*","/redirectToAuth","/getAccountName").permitAll()
// 静态资源可匿名访问 // 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()

View File

@ -75,7 +75,7 @@ public class AsyncFactory
logininfor.setStatus(Constants.FAIL); logininfor.setStatus(Constants.FAIL);
} }
// 插入数据 // 插入数据
SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor); // SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor);
} }
}; };
} }

View File

@ -6,6 +6,8 @@ import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
@ -101,6 +103,55 @@ public class SysLoginService
} }
/**
* 登录验证
*
* @param username 用户名
* @param password 密码
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
public String loginNoCode(String username, String password, String code, String uuid)
{
// 验证码校验
// validateCaptcha(username, code, uuid);
// 登录前置校验
// loginPreCheck(username, password);
// 用户验证
Authentication authentication = null;
try
{
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
}
catch (Exception e)
{
if (e instanceof BadCredentialsException)
{
// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
else
{
// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
}
finally
{
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}
/** /**
* 无需验证码登录 * 无需验证码登录
* 重写login方法将验证码模块去掉 * 重写login方法将验证码模块去掉
@ -115,7 +166,9 @@ public class SysLoginService
Authentication authentication = null; Authentication authentication = null;
try try
{ {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); // UserDetails userDetails = userDetailsService.loadUserByUsername(username);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, null);
AuthenticationContextHolder.setContext(authenticationToken); AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken); authentication = authenticationManager.authenticate(authenticationToken);
@ -133,14 +186,52 @@ public class SysLoginService
throw new ServiceException(e.getMessage()); throw new ServiceException(e.getMessage());
} }
} }
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); // AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal(); LoginUser loginUser = (LoginUser) authentication.getPrincipal();
System.out.println(loginUser);
recordLoginInfo(loginUser.getUserId()); recordLoginInfo(loginUser.getUserId());
// 生成token // 生成token
return tokenService.createToken(loginUser); return tokenService.createToken(loginUser);
} }
/**
* 不加验证码登录
*
* @param username 用户名
* @param password 密码
* @param uuid 唯一标识
* @return 结果
*/
public String loginNoCode(String username, String password, String uuid)
{
// 用户验证
Authentication authentication = null;
try
{
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager
.authenticate(new UsernamePasswordAuthenticationToken(username, password));
}
catch (Exception e)
{
if (e instanceof BadCredentialsException)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
else
{
// AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}
/** /**
* 校验验证码 * 校验验证码

View File

@ -53,13 +53,15 @@ public class UserDetailsServiceImpl implements UserDetailsService
throw new ServiceException(MessageUtils.message("user.blocked")); throw new ServiceException(MessageUtils.message("user.blocked"));
} }
passwordService.validate(user); // passwordService.validate(user);
return createLoginUser(user); return createLoginUser(user);
} }
public UserDetails createLoginUser(SysUser user) public UserDetails createLoginUser(SysUser user)
{ {
return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user)); LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
System.out.println(loginUser.toString());
return loginUser;
} }
} }

View File

@ -20,9 +20,9 @@ public class OilAnalysisController extends BaseController {
private IOilThDeviceReportService oilThDeviceReportService; private IOilThDeviceReportService oilThDeviceReportService;
@GetMapping("/factoryBoundaryOnline") @GetMapping("/factoryBoundaryOnline")
public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate) { public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate, String deviceSn) {
List<Map<String, Object>> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate); List<Map<String, Object>> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn);
List<Map<String, Object>> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate); List<Map<String, Object>> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("alarmCount", alarmCount); resultMap.put("alarmCount", alarmCount);
resultMap.put("alarmCountDesc", alarmCountDesc); resultMap.put("alarmCountDesc", alarmCountDesc);

View File

@ -72,7 +72,7 @@ public class OilMonitorController extends BaseController {
*/ */
@Log(title = "密封点", businessType = BusinessType.DELETE) @Log(title = "密封点", businessType = BusinessType.DELETE)
@GetMapping("/delete/{ids}") @GetMapping("/delete/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long ids) {
return toAjax(oilMonitorService.deleteOilMonitorByIds(ids)); return toAjax(oilMonitorService.deleteOilMonitorByIds(ids));
} }

View File

@ -43,6 +43,12 @@ public class OilStatisticsController extends BaseController {
return getDataTable(devices); return getDataTable(devices);
} }
@GetMapping(value = "/getDeviceListByDeptId")
public TableDataInfo getDeviceListByDeptId(Long deptId) {
List<ThDevice> devices = oilThDeviceService.selectDeviceListByDeptId(deptId);
return getDataTable(devices);
}
@GetMapping("/getDeviceReport") @GetMapping("/getDeviceReport")
public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) { public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) {
if ("page".equals(thDeviceReport.getRemark())) { if ("page".equals(thDeviceReport.getRemark())) {
@ -59,10 +65,21 @@ public class OilStatisticsController extends BaseController {
} }
@GetMapping("/getAvgDsByDeptIdsAndDate") @GetMapping("/getAvgDsByDeptIdsAndDate")
public AjaxResult getAvgDsByDeptIdsAndDate(@RequestParam("ids") List<Long> ids, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) { public AjaxResult getAvgDsByDeptIdsAndDate(
@RequestParam("ids") List<Long> ids,
@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate,
@RequestParam("isDaily") boolean isDaily
) {
Map<Long, Object> resultMap = new HashMap<>(); Map<Long, Object> resultMap = new HashMap<>();
for (Long id : ids) { for (Long id : ids) {
List<Map<String, Object>> result = thDeviceReportMonthService.selectAvgDsByDeptIdAndDate(id, startDate, endDate); List<Map<String, Object>> result;
if (isDaily) {
result = oilThDeviceReportService.selectAvgDsByDateRange(id, startDate, endDate);
} else {
result = thDeviceReportMonthService.selectAvgDsByDeptIdAndDate(id, startDate, endDate);
}
resultMap.put(id, result); resultMap.put(id, result);
} }
return success(resultMap); return success(resultMap);
@ -187,8 +204,8 @@ public class OilStatisticsController extends BaseController {
} }
@GetMapping("/dailyData") @GetMapping("/dailyData")
public AjaxResult dailyData(String day) { public AjaxResult dailyData(String day,Long deptId) {
List<Map<String, Object>> dailyReportDataOverview = oilThDeviceReportService.dailyReportDataOverview(day); List<Map<String, Object>> dailyReportDataOverview = oilThDeviceReportService.dailyReportDataOverview(day,deptId);
return success(dailyReportDataOverview); return success(dailyReportDataOverview);
} }

View File

@ -69,7 +69,7 @@ public class OilDevice extends BaseEntity {
*/ */
private Long backCount; private Long backCount;
private String bjyz;
public Long getDeviceId() { public Long getDeviceId() {
return deviceId; return deviceId;
} }
@ -90,6 +90,14 @@ public class OilDevice extends BaseEntity {
this.adjustCount = adjustCount; this.adjustCount = adjustCount;
} }
public String getBjyz() {
return bjyz;
}
public void setBjyz(String bjyz) {
this.bjyz = bjyz;
}
public Long getBackCount() { public Long getBackCount() {
return backCount; return backCount;
} }

View File

@ -20,7 +20,7 @@ public class OilMonitor extends BaseEntity {
* 监测设备名称 * 监测设备名称
*/ */
private String monitorName; private String monitorName;
private String bjyz;
private String longitude; private String longitude;
private String address; private String address;
@ -52,6 +52,26 @@ public class OilMonitor extends BaseEntity {
private String fileUrl; private String fileUrl;
private Long userId;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getId() { public Long getId() {
return id; return id;
} }
@ -100,6 +120,14 @@ public class OilMonitor extends BaseEntity {
this.unitNo = unitNo; this.unitNo = unitNo;
} }
public String getBjyz() {
return bjyz;
}
public void setBjyz(String bjyz) {
this.bjyz = bjyz;
}
public String getSystemNo() { public String getSystemNo() {
return systemNo; return systemNo;
} }

View File

@ -133,6 +133,21 @@ public class ThDevice extends BaseEntity {
*/ */
private BigDecimal ds; private BigDecimal ds;
/**
* 用户id
*/
private Long userId;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getGangqu() { public String getGangqu() {
return gangqu; return gangqu;
} }

View File

@ -36,9 +36,9 @@ public interface OilMonitorMapper {
/** /**
* 删除 * 删除
* @param ids * @param id
*/ */
void deleteOilMonitorByIds(@Param("ids") Long[] ids); void deleteOilMonitorByIds(@Param("id") Long id);
/** /**
* 获取检测地图 * 获取检测地图

View File

@ -73,14 +73,17 @@ public interface ThDeviceReportMapper {
* @param day 日期 2024-08-30 * @param day 日期 2024-08-30
*/ */
@MapKey("day") @MapKey("day")
List<Map<String, Object>> dailyReportDataOverview(@Param("day") String day); List<Map<String, Object>> dailyReportDataOverview(@Param("day") String day,@Param("deptId") Long deptId);
@MapKey("day") @MapKey("day")
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn);
@MapKey("sn") @MapKey("sn")
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn);
@MapKey("sn") @MapKey("sn")
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year); List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year);
@MapKey("day")
List<Map<String, Object>> selectAvgDsByDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
} }

View File

@ -18,7 +18,7 @@ public interface IOilMonitorService {
int updateOilMonitor(OilMonitor oilMonitor); int updateOilMonitor(OilMonitor oilMonitor);
int deleteOilMonitorByIds(Long[] ids); int deleteOilMonitorByIds(Long id);
/** /**
* 查询检测设备地图列表 * 查询检测设备地图列表

View File

@ -10,11 +10,13 @@ public interface IOilThDeviceReportService {
List<Map<String, Object>> monthReportDataOverviewGangQuCompare(Long deptId, String month); List<Map<String, Object>> monthReportDataOverviewGangQuCompare(Long deptId, String month);
List<Map<String, Object>> dailyReportDataOverview(String day); List<Map<String, Object>> dailyReportDataOverview(String day,Long deptId);
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate); List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn);
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate); List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn);
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(Long deptId, String year); List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(Long deptId, String year);
List<Map<String, Object>> selectAvgDsByDateRange(Long deptId, String beginDate, String endDate);
} }

View File

@ -26,6 +26,7 @@ public class OilMonitorServiceImpl implements IOilMonitorService {
private OilMonitorMapper oilMonitorMapper; private OilMonitorMapper oilMonitorMapper;
@Override @Override
@DataScope(deptAlias = "d",permission="4")
public List<OilMonitor> selectOilDeviceList(OilMonitor oilDevice) { public List<OilMonitor> selectOilDeviceList(OilMonitor oilDevice) {
return oilMonitorMapper.selectOilDeviceList(oilDevice); return oilMonitorMapper.selectOilDeviceList(oilDevice);
} }
@ -49,7 +50,7 @@ public class OilMonitorServiceImpl implements IOilMonitorService {
} }
@Override @Override
public int deleteOilMonitorByIds(Long[] ids) { public int deleteOilMonitorByIds(Long ids) {
oilMonitorMapper.deleteOilMonitorByIds(ids); oilMonitorMapper.deleteOilMonitorByIds(ids);
return 1; return 1;
} }

View File

@ -32,18 +32,18 @@ public class OilThDeviceReportService implements IOilThDeviceReportService {
} }
@Override @Override
public List<Map<String, Object>> dailyReportDataOverview(String day) { public List<Map<String, Object>> dailyReportDataOverview(String day,Long deptId) {
return camelCaseMapListKey(thDeviceReportMapper.dailyReportDataOverview(day)); return camelCaseMapListKey(thDeviceReportMapper.dailyReportDataOverview(day,deptId));
} }
@Override @Override
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate) { public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn) {
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate)); return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn));
} }
@Override @Override
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate) { public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn) {
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate)); return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn));
} }
@Override @Override
@ -51,4 +51,9 @@ public class OilThDeviceReportService implements IOilThDeviceReportService {
return camelCaseMapListKey(thDeviceReportMapper.selectOverLimitCountByYearAndDeptId(deptId, year)); return camelCaseMapListKey(thDeviceReportMapper.selectOverLimitCountByYearAndDeptId(deptId, year));
} }
@Override
public List<Map<String, Object>> selectAvgDsByDateRange(Long deptId, String beginDate, String endDate) {
return camelCaseMapListKey(thDeviceReportMapper.selectAvgDsByDateRange(deptId, beginDate, endDate));
}
} }

View File

@ -26,9 +26,14 @@ public class ThDeviceReportMonthServiceImpl implements ThDeviceReportMonthServic
@Override @Override
public List<Map<String, Object>> selectThDeviceReportMonthList(Long deptId, String year, String month) { public List<Map<String, Object>> selectThDeviceReportMonthList(Long deptId, String year, String month) {
return camelCaseMapListKey(thDeviceReportMonthMapper.selectThDeviceReportMonthList(deptId, year, month)); String month1=formatMonth(Integer.parseInt(month));
return camelCaseMapListKey(thDeviceReportMonthMapper.selectThDeviceReportMonthList(deptId, year, month1));
} }
// 格式化月份确保是两位数
public static String formatMonth(int month) {
return String.format("%02d", month);
}
@Override @Override
public int updateThDeviceReportMonth(ThDeviceReportMonth thDeviceReportMonth) { public int updateThDeviceReportMonth(ThDeviceReportMonth thDeviceReportMonth) {
return thDeviceReportMonthMapper.updateThDeviceReportMonth(thDeviceReportMonth); return thDeviceReportMonthMapper.updateThDeviceReportMonth(thDeviceReportMonth);

View File

@ -5,10 +5,11 @@ import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.outside.service.OutSideService; import com.ruoyi.project.outside.service.OutSideService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.HashMap;
import org.springframework.web.bind.annotation.RestController; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("/outside") @RequestMapping("/outside")
@ -38,18 +39,39 @@ public class OutSideController extends BaseController {
return AjaxResult.error(); return AjaxResult.error();
} }
} }
// @PostMapping("/monthTask") @PostMapping("/monthTask")
// public AjaxResult monthTask(@RequestBody String date) { public AjaxResult monthTask(@RequestBody String date) {
// try { try {
// Integer succ=outSideService.monthTask(date); Integer succ=outSideService.monthTask(date);
// return AjaxResult.success(succ); return AjaxResult.success(succ);
// } catch (Exception e) { } catch (Exception e) {
// System.out.println(e); System.out.println(e);
// return AjaxResult.error(); return AjaxResult.error();
// } }
//
// }
}
@GetMapping("/updateData")
public AjaxResult updateData(@RequestBody String date) {
try {
Integer succ=outSideService.updateData(date);
return AjaxResult.success(succ);
} catch (Exception e) {
System.out.println(e);
return AjaxResult.error();
}
}
@GetMapping("/getMonthData")
public AjaxResult getMonthData(@RequestBody String date) {
try {
List<Map<String, Object>> alarmCount = outSideService.getMonthData(date);
return AjaxResult.success(alarmCount);
} catch (Exception e) {
System.out.println(e);
return AjaxResult.error();
}
}
} }

View File

@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
public interface OutSideMapper { public interface OutSideMapper {
/** /**
@ -26,4 +27,15 @@ public interface OutSideMapper {
* @param list * @param list
*/ */
void insertMonth(@Param("sensorMonthList") List<SensorMonth> list); void insertMonth(@Param("sensorMonthList") List<SensorMonth> list);
/**
* 删除相同数据
* @param sn
* @param reportTime
*/
void deleteSampleDevice(@Param("sn")String sn,@Param("reportTime") String reportTime);
Integer updateData(@Param("date") String date);
List<Map<String, Object>> getMonthData(@Param("date") String date);
} }

View File

@ -2,6 +2,9 @@ package com.ruoyi.project.outside.service;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.List;
import java.util.Map;
public interface OutSideService { public interface OutSideService {
/** /**
@ -24,4 +27,8 @@ public interface OutSideService {
* @return * @return
*/ */
Integer insertOldDeviceData(String data) throws JsonProcessingException; Integer insertOldDeviceData(String data) throws JsonProcessingException;
Integer updateData(String date);
List<Map<String, Object>> getMonthData(String date);
} }

View File

@ -18,6 +18,7 @@ import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
@Service @Service
@ -36,6 +37,7 @@ public class OutSideServiceImpl implements OutSideService {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode = objectMapper.readTree(jsonData); JsonNode rootNode = objectMapper.readTree(jsonData);
for (JsonNode sensorNode : rootNode.get("sensorDatas")) { for (JsonNode sensorNode : rootNode.get("sensorDatas")) {
if (sensorNode.get("flag").asInt()==1) {
sensorData.setSn(sn); sensorData.setSn(sn);
sensorData.setFlag(sensorNode.get("flag").asText()); sensorData.setFlag(sensorNode.get("flag").asText());
sensorData.setDs(sensorNode.get("gas_value").asText()); sensorData.setDs(sensorNode.get("gas_value").asText());
@ -56,6 +58,7 @@ public class OutSideServiceImpl implements OutSideService {
sensorData.setReportTime(DateUtils.getTime()); sensorData.setReportTime(DateUtils.getTime());
outSideMapper.insertDevice(sensorData); outSideMapper.insertDevice(sensorData);
} }
}
return 1; return 1;
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); System.out.println(e);
@ -76,8 +79,12 @@ public class OutSideServiceImpl implements OutSideService {
String lastMonth = previousMonth.format(formatter); String lastMonth = previousMonth.format(formatter);
List<SensorMonth> list = outSideMapper.queryMonth(lastMonth); List<SensorMonth> list = outSideMapper.queryMonth(lastMonth);
if(list.size()>0){
outSideMapper.insertMonth(list); outSideMapper.insertMonth(list);
return 1; return 1;
}else{
return 0;
}
} }
@Override @Override
@ -87,16 +94,30 @@ public class OutSideServiceImpl implements OutSideService {
// 判断是否是数组 // 判断是否是数组
if (rootNode.isArray()) { if (rootNode.isArray()) {
for (JsonNode node : rootNode) { for (JsonNode node : rootNode) {
if (node.get("type").asInt()==5) {
SensorData sd = insertOldData(node); SensorData sd = insertOldData(node);
outSideMapper.deleteSampleDevice(sd.getSn(),sd.getReportTime());
outSideMapper.insertDevice(sd); outSideMapper.insertDevice(sd);
} }
} else {
SensorData sd = insertOldData(rootNode);
outSideMapper.insertDevice(sd);
} }
}
// else {
// SensorData sd = insertOldData(rootNode);
// outSideMapper.insertDevice(sd);
// }
return 0; return 0;
} }
@Override
public Integer updateData(String date) {
return outSideMapper.updateData(date);
}
@Override
public List<Map<String, Object>> getMonthData(String date) {
return outSideMapper.getMonthData(date);
}
private static SensorData insertOldData(JsonNode node) { private static SensorData insertOldData(JsonNode node) {
/** /**
* sn: equipmentUId * sn: equipmentUId

View File

@ -4,6 +4,7 @@ package com.ruoyi.project.system.controller;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.banboocloud.Codec.BamboocloudFacade; import com.banboocloud.Codec.BamboocloudFacade;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.reflect.ReflectUtils; import com.ruoyi.common.utils.reflect.ReflectUtils;
import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.project.system.domain.SysUser; import com.ruoyi.project.system.domain.SysUser;
@ -192,17 +193,20 @@ public class BbcController extends BaseController {
logger.info("reqmap---------->"+reqmap); logger.info("reqmap---------->"+reqmap);
SysUser user = new SysUser(); SysUser user = new SysUser();
user.setUserName(userName); user.setUserName(userName);
user.setPassword(pass); user.setPassword(SecurityUtils.encryptPassword(("123456")));
user.setPhonenumber(mobile); user.setPhonenumber(mobile);
user.setStatus(status); user.setStatus(status);
user.setNickName(nickName); user.setNickName(nickName);
Random random = new Random(); // Random random = new Random();
int min = 8000; // int min = 8000;
int max = 9000; // int max = 9000;
int randomNumber = random.nextInt(max - min + 1) + min; // int randomNumber = random.nextInt(max - min + 1) + min;
user.setUserId(Long.valueOf(randomNumber)); // user.setUserId(Long.valueOf(randomNumber)); 删除 随机数id 使用序列新增
//用户创建 //用户创建
userService.registerUser(user); userService.registerUser(user);
/**
* todo 新增 用户权限 给予默认 角色
*/
//获取返回给IAM连接器的唯一标识用于后续该条数据的更新修改删除 //获取返回给IAM连接器的唯一标识用于后续该条数据的更新修改删除
String uid = user.getUserId() + ""; String uid = user.getUserId() + "";
if (uid != null) { if (uid != null) {
@ -271,7 +275,7 @@ public class BbcController extends BaseController {
logger.info("reqmap---------->"+reqmap); logger.info("reqmap---------->"+reqmap);
SysUser user = new SysUser(); SysUser user = new SysUser();
user.setUserName(userName); user.setUserName(userName);
user.setPassword(pass); user.setPassword(SecurityUtils.encryptPassword(("123456")));
user.setPhonenumber(mobile); user.setPhonenumber(mobile);
user.setStatus(status); user.setStatus(status);
user.setNickName(nickName); user.setNickName(nickName);

View File

@ -39,9 +39,7 @@ public class SysDeptController extends BaseController
/** /**
* 获取部门列表 * 获取部门列表
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list") @GetMapping("/list")
@DataScope(deptAlias="d", permission="4")
public AjaxResult list(SysDept dept) public AjaxResult list(SysDept dept)
{ {
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);

View File

@ -1,6 +1,7 @@
package com.ruoyi.project.system.controller; package com.ruoyi.project.system.controller;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import com.ruoyi.project.system.utils.AESUtil; import com.ruoyi.project.system.utils.AESUtil;
@ -52,6 +53,22 @@ public class SysLoginController
ajax.put(Constants.TOKEN, token); ajax.put(Constants.TOKEN, token);
return ajax; return ajax;
} }
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/singleSign")
public AjaxResult singleSign(@RequestBody LoginBody loginBody) throws Exception {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String password= AESUtil.decrypt(loginBody.getPassword());
String token = loginService.loginNoCode(loginBody.getUsername().toUpperCase(Locale.ROOT),password, loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/** /**
* 获取用户信息 * 获取用户信息

View File

@ -56,7 +56,7 @@ public class SysUserController extends BaseController
/** /**
* 获取用户列表 * 获取用户列表
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") // @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysUser user) public TableDataInfo list(SysUser user)
{ {

View File

@ -278,7 +278,9 @@ public class SysUserServiceImpl implements ISysUserService
@Override @Override
public boolean registerUser(SysUser user) public boolean registerUser(SysUser user)
{ {
return userMapper.insertUser(user) > 0; int res = userMapper.insertUser(user);
insertUserRole(user.getUserId(),new Long[]{2L});
return res > 0;
} }
/** /**

View File

@ -6,9 +6,9 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
# url: jdbc:oracle:thin:@127.0.0.1:1521/orcl # url: jdbc:oracle:thin:@218.58.79.146:17521/orcl
# username: root # username: system
# password: password # password: oracle
url: jdbc:oracle:thin:@10.169.28.44:1521/orcl url: jdbc:oracle:thin:@10.169.28.44:1521/orcl
username: spg_voc username: spg_voc
password: SPG$spgvoc_24! password: SPG$spgvoc_24!

View File

@ -71,18 +71,17 @@ spring:
# 热部署开关 # 热部署开关
enabled: true enabled: true
# redis 配置 # redis 配置
# redis:
# host: 192.168.1.115
# port: 6379
# password: Liwen073898!
redis: redis:
# 地址
# host: 192.168.31.105
host: 127.0.0.1 host: 127.0.0.1
# 端口默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 0 database: 0
# 密码 # 密码
password: 123456 password: 123456
# password: admin123!
# 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
pool: pool:
@ -102,7 +101,7 @@ token:
# 令牌密钥 # 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
expireTime: 30 expireTime: 720
# MyBatis配置 # MyBatis配置
mybatis: mybatis:

View File

@ -27,6 +27,7 @@
SELECT d.sn AS "sn", SELECT d.sn AS "sn",
p.dept_name AS "factoryName", p.dept_name AS "factoryName",
pp.dept_name AS "gangqu", pp.dept_name AS "gangqu",
r.report_time as "reportTime",
r.ds AS "ds", r.ds AS "ds",
r.zt AS "level" r.zt AS "level"
FROM th_device d FROM th_device d
@ -34,7 +35,7 @@
JOIN sys_dept p ON d.dept_id = p.dept_id JOIN sys_dept p ON d.dept_id = p.dept_id
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
WHERE WHERE
r.REPORT_TIME = TO_DATE(#{date}, 'YYYY-MM-DD') TRUNC(r.REPORT_TIME) = TO_DATE(#{date}, 'YYYY-MM-DD')
AND (r.zt = '一级报警' OR r.zt = '二级报警') AND (r.zt = '一级报警' OR r.zt = '二级报警')
@ -51,8 +52,8 @@
JOIN JOIN
sys_dept p ON d.dept_id = p.dept_id sys_dept p ON d.dept_id = p.dept_id
WHERE WHERE
r.REPORT_TIME >= TO_DATE(#{date}, 'YYYY-MM-DD') - 3 TRUNC(r.REPORT_TIME) >= TO_DATE(#{date}, 'YYYY-MM-DD') - 3
AND r.REPORT_TIME &lt; TO_DATE(#{date}, 'YYYY-MM-DD') + 1 AND TRUNC(r.REPORT_TIME) &lt; TO_DATE(#{date}, 'YYYY-MM-DD') + 1
GROUP BY GROUP BY
p.dept_name p.dept_name
HAVING HAVING
@ -73,7 +74,7 @@
WHERE d.dept_id IN (SELECT dept_id WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)) CONNECT BY PRIOR dept_id = parent_id))
AND r.REPORT_TIME = TO_DATE(#{date}, 'YYYY-MM-DD') AND TRUNC(r.REPORT_TIME) = TO_DATE(#{date}, 'YYYY-MM-DD')
group by dp.dept_name group by dp.dept_name
</select> </select>
</mapper> </mapper>

View File

@ -15,7 +15,7 @@
<result property="fileUrl" column="file_url"/> <result property="fileUrl" column="file_url"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="bjyz" column="bjyz"/>
<result property="adjustCount" column="adjustCount"/> <result property="adjustCount" column="adjustCount"/>
<result property="backCount" column="backCount"/> <result property="backCount" column="backCount"/>
</resultMap> </resultMap>
@ -54,8 +54,8 @@
d.create_by, d.create_by,
d.create_time, d.create_time,
f.factory_name, f.factory_name,
d.file_url d.file_url,
-- ( SELECT count( id ) FROM oil_device_img WHERE device_id = d.id ) AS adjustCount d.bjyz
FROM FROM
oil_device d oil_device d
JOIN (select * from sys_factory where is_stop='否') f ON d.factory_id = f.factory_id JOIN (select * from sys_factory where is_stop='否') f ON d.factory_id = f.factory_id

View File

@ -21,6 +21,9 @@
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="systemNo" column="system_no"/> <result property="systemNo" column="system_no"/>
<result property="unitNo" column="unit_no"/> <result property="unitNo" column="unit_no"/>
<result property="bjyz" column="bjyz"/>
<result property="userId" column="user_id"/>
<result property="userName" column="userName"/>
</resultMap> </resultMap>
<resultMap type="com.ruoyi.project.oil.domain.monitor.ThDevice" id="ThDeviceList"> <resultMap type="com.ruoyi.project.oil.domain.monitor.ThDevice" id="ThDeviceList">
<result property="id" column="id"/> <result property="id" column="id"/>
@ -43,6 +46,7 @@
<result property="num" column="num"/> <result property="num" column="num"/>
<result property="factoryName" column="factory_name"/> <result property="factoryName" column="factory_name"/>
<result property="factoryId" column="factory_id"/> <result property="factoryId" column="factory_id"/>
<result property="userId" column="user_id"/>
</resultMap> </resultMap>
<resultMap type="com.ruoyi.project.oil.domain.monitor.ThAlarm" id="AlarmResult"> <resultMap type="com.ruoyi.project.oil.domain.monitor.ThAlarm" id="AlarmResult">
@ -83,13 +87,29 @@
<select id="selectOilDeviceList" resultMap="OilDeviceResult"> <select id="selectOilDeviceList" resultMap="OilDeviceResult">
select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.create_by,t.create_time,t.address,t.dept_id,d.dept_name,longitude,latitude select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.create_by,t.create_time,t.address,t.dept_id,d.dept_name,t.longitude,t.latitude,
from th_device t left join sys_dept d on t.dept_id=d.dept_id t.bjyz, t.user_id, u.user_name as userName
from th_device t
left join sys_dept d on t.dept_id=d.dept_id
left join sys_user u on t.user_id=u.user_id
<where> <where>
<if test="id != null and id != ''">and t.id=#{id}</if> <if test="id != null and id != ''">and t.id=#{id}</if>
<if test="monitorName != null and monitorName != ''">and t.name like concat('%', #{monitorName},'%') </if> <if test="monitorName != null and monitorName != ''"> and t.name like concat(concat('%', #{monitorName}), '%') </if>
<if test="monitorNo != null and monitorNo != ''">and t.sn= #{monitorNo} </if> <if test="monitorNo != null and monitorNo != ''">and t.sn= #{monitorNo} </if>
<if test="deptId != null and deptId != ''">and t.dept_id= #{deptId} </if> <if test="deptId != null and deptId != 228">
and t.sn IN (
SELECT td.sn
FROM th_device td
LEFT JOIN sys_dept p ON td.dept_id = p.dept_id
WHERE td.dept_id IN (
SELECT dept_id
FROM sys_dept
START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id
)
)
</if>
<if test="status != null ">and t.status= #{status} </if> <if test="status != null ">and t.status= #{status} </if>
</where> </where>
</select> </select>
@ -115,6 +135,8 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="unitNo != null">unit_no,</if> <if test="unitNo != null">unit_no,</if>
<if test="systemNo != null">system_no,</if> <if test="systemNo != null">system_no,</if>
<if test="bjyz != null">bjyz,</if>
<if test="userId != null">user_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorName != null">#{monitorName},</if> <if test="monitorName != null">#{monitorName},</if>
@ -129,7 +151,8 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<if test="latitude != null">#{latitude},</if> <if test="latitude != null">#{latitude},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="unitNo != null">#{unitNo},</if> <if test="unitNo != null">#{unitNo},</if>
<if test="systemNo != null">#{systemNo},</if> <if test="bjyz != null">#{bjyz},</if>
<if test="userId != null">#{userId},</if>
</trim> </trim>
</insert> </insert>
@ -148,15 +171,15 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<if test="status != null">status=#{status},</if> <if test="status != null">status=#{status},</if>
<if test="systemNo != null">system_no=#{systemNo},</if> <if test="systemNo != null">system_no=#{systemNo},</if>
<if test="unitNo != null">unit_no=#{unitNo},</if> <if test="unitNo != null">unit_no=#{unitNo},</if>
<if test="bjyz != null">bjyz=#{bjyz},</if>
<if test="userId != null">user_id=#{userId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteOilMonitorByIds"> <delete id="deleteOilMonitorByIds">
delete from th_device where id in delete from th_device where id = #{id}
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete> </delete>
<select id="getMonitorMap" resultMap="ThDeviceList"> <select id="getMonitorMap" resultMap="ThDeviceList">
@ -244,7 +267,7 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
LEFT JOIN th_device_deal d ON th_device_report.id = d.report_id LEFT JOIN th_device_deal d ON th_device_report.id = d.report_id
<where> <where>
(th_device_report.zt='一级报警' or th_device_report.zt='二级报警') (th_device_report.zt='一级报警' or th_device_report.zt='二级报警')
<if test="deptId != null"> <if test="deptId != null and deptId != 228">
and th_device_report.sn IN ( and th_device_report.sn IN (
SELECT td.sn SELECT td.sn
FROM th_device td FROM th_device td
@ -262,7 +285,7 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<if test="sn != null">and th_device_report.sn= #{sn}</if> <if test="sn != null">and th_device_report.sn= #{sn}</if>
<if test="name != null">and t.name like concat(concat('%',#{name, jdbcType=VARCHAR}),'%')</if> <if test="name != null">and t.name like concat(concat('%',#{name, jdbcType=VARCHAR}),'%')</if>
<if test="dealUser != null">and d.deal_user like concat(concat('%',#{dealUser, jdbcType=VARCHAR}),'%')</if> <if test="dealUser != null">and d.deal_user like concat(concat('%',#{dealUser, jdbcType=VARCHAR}),'%')</if>
<if test="status != null"> and d.staus=#{status}</if> <if test="status != null"> and d.status=#{status}</if>
</where> </where>
${params.dataScope} ${params.dataScope}
order by th_device_report.report_time desc order by th_device_report.report_time desc
@ -331,8 +354,8 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<if test="startTime != null">and report_time >= #{startTime,jdbcType=TIMESTAMP}</if> <if test="startTime != null">and report_time >= #{startTime,jdbcType=TIMESTAMP}</if>
<if test="endTime != null">and report_time &lt;= #{endTime,jdbcType=TIMESTAMP}</if> <if test="endTime != null">and report_time &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
<if test="sn != null">and th_device_report.sn= #{sn}</if> <if test="sn != null">and th_device_report.sn= #{sn}</if>
<if test="name != null">and t.name like concat('%', #{name}, '%')</if> <if test="name != null"> and t.name like concat(concat('%', #{name}), '%')</if>
<if test="deptId != null">and t.dept_id IN <if test="deptId != null and deptId != 228">and t.dept_id IN
(SELECT dept_id (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)</if> CONNECT BY PRIOR dept_id = parent_id)</if>
@ -474,6 +497,6 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<select id="countThDeviceDealByYear" parameterType="string" resultType="java.lang.Integer"> <select id="countThDeviceDealByYear" parameterType="string" resultType="java.lang.Integer">
SELECT COUNT(1) FROM th_device_deal SELECT COUNT(1) FROM th_device_deal
WHERE to_char(create_time, 'yyyy') = #{year} WHERE to_char(deal_time, 'yyyy') = #{year}
</select> </select>
</mapper> </mapper>

View File

@ -35,12 +35,12 @@
AND d.sn = #{sn} AND d.sn = #{sn}
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"> <if test="params.beginTime != null and params.beginTime != ''">
AND d.report_time &gt;= TO_DATE(#{params.beginTime}, 'YYYY-MM-DD HH24:MI:SS') AND TRUNC(d.REPORT_TIME)>= TO_DATE(#{params.beginTime}, 'YYYY-MM-DD HH24:MI:SS')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"> <if test="params.endTime != null and params.endTime != ''">
AND d.report_time &lt;= TO_DATE(#{params.endTime}, 'YYYY-MM-DD HH24:MI:SS') AND TRUNC(d.REPORT_TIME)&lt;= TO_DATE(#{params.endTime}, 'YYYY-MM-DD HH24:MI:SS')
</if> </if>
ORDER BY d.report_time ASC ORDER BY d.report_time
</select> </select>
<select id="selectAvgDsByMonth" parameterType="map" resultType="map"> <select id="selectAvgDsByMonth" parameterType="map" resultType="map">
@ -53,8 +53,8 @@
WHERE d.dept_id IN (SELECT dept_id WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)) CONNECT BY PRIOR dept_id = parent_id))
AND d.report_time &gt;= TO_DATE(#{startMonth}, 'YYYY-MM') AND TRUNC(d.REPORT_TIME) &gt;= TO_DATE(#{startMonth}, 'YYYY-MM')
AND d.report_time &lt;= ADD_MONTHS(TO_DATE(#{endMonth}, 'YYYY-MM'), 1) AND TRUNC(d.REPORT_TIME)&lt;= ADD_MONTHS(TO_DATE(#{endMonth}, 'YYYY-MM'), 1)
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM') GROUP BY TO_CHAR(d.report_time, 'YYYY-MM')
ORDER BY month ORDER BY month
</select> </select>
@ -73,8 +73,8 @@
LEFT JOIN th_device td ON d.sn = td.sn LEFT JOIN th_device td ON d.sn = td.sn
LEFT JOIN sys_dept p ON td.dept_id = p.dept_id LEFT JOIN sys_dept p ON td.dept_id = p.dept_id
WHERE td.dept_id IN (SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} OR parent_id = #{deptId}) WHERE td.dept_id IN (SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} OR parent_id = #{deptId})
AND d.report_time &gt;= TO_DATE(#{startMonth}, 'YYYY-MM') AND TRUNC(d.REPORT_TIME) &gt;= TO_DATE(#{startMonth}, 'YYYY-MM')
AND d.report_time &lt;= ADD_MONTHS(TO_DATE(#{endMonth}, 'YYYY-MM'), 1) AND TRUNC(d.REPORT_TIME)&lt;= ADD_MONTHS(TO_DATE(#{endMonth}, 'YYYY-MM'), 1)
GROUP BY d.sn, p.dept_name, td.name, td.address, td.longitude, td.latitude GROUP BY d.sn, p.dept_name, td.name, td.address, td.longitude, td.latitude
ORDER BY p.dept_name ORDER BY p.dept_name
</select> </select>
@ -128,9 +128,9 @@
<select id="monthReportDataOverviewDeviceDs" parameterType="map" resultType="map"> <select id="monthReportDataOverviewDeviceDs" parameterType="map" resultType="map">
SELECT d.sn, SELECT d.sn,
p.dept_name, p.dept_name,
pp.dept_name as "gang_qu", pp.dept_name AS "gang_qu",
ROUND(AVG(TO_NUMBER(d.ds)), 8) AS avg_ds d.avg_value AS avg_ds
FROM th_device_report d FROM th_device_report_month1 d
LEFT JOIN th_device td ON d.sn = td.sn LEFT JOIN th_device td ON d.sn = td.sn
LEFT JOIN sys_dept p ON td.dept_id = p.dept_id LEFT JOIN sys_dept p ON td.dept_id = p.dept_id
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
@ -140,17 +140,15 @@
WHERE d.dept_id IN (SELECT dept_id WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)) CONNECT BY PRIOR dept_id = parent_id))
AND TO_CHAR(d.report_time, 'YYYY-MM') = #{month} AND TO_CHAR(TO_DATE(d.year || '-' || d.month, 'YYYY-MM'), 'YYYY-MM') = #{month}
GROUP BY d.sn, p.dept_name, pp.dept_name
ORDER BY pp.dept_name, p.dept_name ORDER BY pp.dept_name, p.dept_name
</select> </select>
<select id="monthReportDataOverviewGangQuCompare" parameterType="map" resultType="map"> <select id="monthReportDataOverviewGangQuCompare" parameterType="map" resultType="map">
SELECT SELECT pp.dept_name as "gang_qu",
pp.dept_name as "gang_qu",
ppp.dept_name as "gang_kou", ppp.dept_name as "gang_kou",
ROUND(AVG(TO_NUMBER(d.ds)), 8) AS avg_ds ROUND(AVG(TO_NUMBER(d.avg_value)), 2) AS avg_ds
FROM th_device_report d FROM th_device_report_month1 d
LEFT JOIN th_device td ON d.sn = td.sn LEFT JOIN th_device td ON d.sn = td.sn
LEFT JOIN sys_dept p ON td.dept_id = p.dept_id LEFT JOIN sys_dept p ON td.dept_id = p.dept_id
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
@ -162,7 +160,7 @@
WHERE d.dept_id IN (SELECT dept_id WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)) CONNECT BY PRIOR dept_id = parent_id))
AND TO_CHAR(d.report_time, 'YYYY-MM') = #{month} AND TO_CHAR(TO_DATE(d.year || '-' || d.month, 'YYYY-MM'), 'YYYY-MM') = #{month}
GROUP BY pp.dept_name, ppp.dept_name GROUP BY pp.dept_name, ppp.dept_name
ORDER BY ppp.dept_name, pp.dept_name ORDER BY ppp.dept_name, pp.dept_name
</select> </select>
@ -171,9 +169,11 @@
<select id="dailyReportDataOverview" parameterType="map" resultType="map"> <select id="dailyReportDataOverview" parameterType="map" resultType="map">
SELECT TO_CHAR(d.report_time, 'YYYY-MM-DD') AS day, SELECT TO_CHAR(d.report_time, 'YYYY-MM-DD') AS day,
d.sn, d.sn,
td.name,
p.dept_name as "p", p.dept_name as "p",
pp.dept_name as "pp", pp.dept_name as "pp",
ppp.dept_name as "ppp", ppp.dept_name as "ppp",
ppp.dept_id as "ppp_id",
ROUND(AVG(TO_NUMBER(d.ds)), 8) AS avg_ds ROUND(AVG(TO_NUMBER(d.ds)), 8) AS avg_ds
FROM th_device_report d FROM th_device_report d
LEFT JOIN th_device td ON d.sn = td.sn LEFT JOIN th_device td ON d.sn = td.sn
@ -181,9 +181,14 @@
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
LEFT JOIN sys_dept ppp ON pp.parent_id = ppp.dept_id LEFT JOIN sys_dept ppp ON pp.parent_id = ppp.dept_id
WHERE d.sn IN (SELECT d.sn FROM th_device d) WHERE d.sn IN (SELECT d.sn FROM th_device d)
and p.dept_id IN (
SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id
)
AND TO_CHAR(d.report_time, 'YYYY-MM-DD') = #{day} AND TO_CHAR(d.report_time, 'YYYY-MM-DD') = #{day}
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD'), ppp.dept_name, pp.dept_name, p.dept_name, d.sn GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD'), ppp.dept_name, pp.dept_name, p.dept_name, d.sn, ppp.dept_id, td.name
ORDER BY ppp.dept_name, pp.dept_name, p.dept_name ORDER BY ppp.dept_id ASC
</select> </select>
<!-- 选择日期范围内 某个部门id下的所有子部门的所有设备的报警每日数量统计(d.zt = '一级报警' OR d.zt = '二级报警')的alarm_count 统计当天全部的数量count --> <!-- 选择日期范围内 某个部门id下的所有子部门的所有设备的报警每日数量统计(d.zt = '一级报警' OR d.zt = '二级报警')的alarm_count 统计当天全部的数量count -->
<select id="selectAlarmCountByDeptIdAndDateRange" parameterType="map" resultType="map"> <select id="selectAlarmCountByDeptIdAndDateRange" parameterType="map" resultType="map">
@ -199,8 +204,11 @@
WHERE d.dept_id IN (SELECT dept_id WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)) CONNECT BY PRIOR dept_id = parent_id))
AND d.report_time &gt;= TO_DATE(#{beginDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) &gt;= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
AND d.report_time &lt;= TO_DATE(#{endDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) &lt;= TO_DATE(#{endDate}, 'YYYY-MM-DD')
<if test="deviceSn != null and deviceSn != ''">
AND d.sn = #{deviceSn}
</if>
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD') GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD')
ORDER BY day ORDER BY day
</select> </select>
@ -213,8 +221,7 @@
pp.dept_name as "pp", pp.dept_name as "pp",
ppp.dept_name as "ppp", ppp.dept_name as "ppp",
td.address, td.address,
td.name, td.name
d.zt
FROM th_device_report d FROM th_device_report d
LEFT JOIN th_device td ON d.sn = td.sn LEFT JOIN th_device td ON d.sn = td.sn
@ -227,10 +234,13 @@
WHERE d.dept_id IN (SELECT dept_id WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId} FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)) CONNECT BY PRIOR dept_id = parent_id))
AND d.report_time &gt;= TO_DATE(#{beginDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) &gt;= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
AND d.report_time &lt;= TO_DATE(#{endDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) &lt;= TO_DATE(#{endDate}, 'YYYY-MM-DD')
AND (d.zt = '一级报警' OR d.zt = '二级报警') AND (d.zt = '一级报警' OR d.zt = '二级报警')
GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt <if test="deviceSn != null and deviceSn != ''">
AND d.sn = #{deviceSn}
</if>
GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name
ORDER BY count DESC ORDER BY count DESC
</select> </select>
@ -271,4 +281,20 @@
GROUP BY d.sn, td.address, p.dept_name, pp.dept_name, ppp.dept_name GROUP BY d.sn, td.address, p.dept_name, pp.dept_name, ppp.dept_name
ORDER BY p.dept_name, pp.dept_name, ppp.dept_name, d.sn ORDER BY p.dept_name, pp.dept_name, ppp.dept_name, d.sn
</select> </select>
<select id="selectAvgDsByDateRange" parameterType="map" resultType="map">
SELECT TO_CHAR(d.report_time, 'YYYY-MM-DD') AS day,
ROUND(AVG(TO_NUMBER(d.ds)), 8) AS avg_value
FROM th_device_report d
WHERE d.sn IN (SELECT d.sn
FROM th_device d
LEFT JOIN sys_dept p ON d.dept_id = p.dept_id
WHERE d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id))
AND TRUNC(d.REPORT_TIME) &gt;= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
AND TRUNC(d.REPORT_TIME) &lt;= TO_DATE(#{endDate}, 'YYYY-MM-DD')
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD')
ORDER BY day
</select>
</mapper> </mapper>

View File

@ -48,13 +48,16 @@
<select id="selectThDeviceReportYearList" parameterType="map" resultType="map"> <select id="selectThDeviceReportYearList" parameterType="map" resultType="map">
select select
m.sn, m.sn,
td.name,
m.year, m.year,
round(AVG(TO_NUMBER(m.avg_value)), 8) AS avg_value, round(AVG(TO_NUMBER(m.avg_value)), 8) AS avg_value,
p.dept_name, p.dept_name,
p.dept_name as "p", p.dept_name as "p",
pp.dept_name as "pp", pp.dept_name as "pp",
ppp.dept_name as "ppp" ppp.dept_name as "ppp",
ppp.dept_id as "ppp_id"
from th_device_report_month1 m from th_device_report_month1 m
LEFT JOIN th_device td ON m.sn = td.sn
left join sys_dept p on m.dept_id = p.dept_id left join sys_dept p on m.dept_id = p.dept_id
left join sys_dept pp on p.parent_id = pp.dept_id left join sys_dept pp on p.parent_id = pp.dept_id
left join sys_dept ppp on pp.parent_id = ppp.dept_id left join sys_dept ppp on pp.parent_id = ppp.dept_id
@ -66,8 +69,8 @@
<if test="year != null and year != ''"> <if test="year != null and year != ''">
AND m.year = #{year} AND m.year = #{year}
</if> </if>
GROUP BY m.sn, m.year, p.dept_name, pp.dept_name, ppp.dept_name GROUP BY m.sn, td.name, m.year, p.dept_name, pp.dept_name, ppp.dept_name, ppp.dept_id
ORDER BY ppp.dept_name, pp.dept_name, p.dept_name ORDER BY ppp.dept_id
</select> </select>
<update <update

View File

@ -39,21 +39,20 @@
<select id="queryMonth" resultMap="SensorMonthResultMap"> <select id="queryMonth" resultMap="SensorMonthResultMap">
SELECT SELECT
r.SN, t.SN,
AVG(DS) AS "avg_value", ROUND(COALESCE(AVG(r.DS), 0), 4) AS "avg_value",
dept.dept_id, dept.dept_id,
TO_CHAR(r.REPORT_TIME, 'YYYY') AS year, TO_CHAR(TO_DATE(#{lastMonth}, 'YYYY-MM'), 'YYYY') AS year,
TO_CHAR(r.REPORT_TIME, 'MM') AS month TO_CHAR(TO_DATE(#{lastMonth}, 'YYYY-MM'), 'MM') AS month
FROM FROM
th_device_report r JOIN th_device t on r.sn=t.sn join sys_dept dept on t.dept_id=dept.dept_id th_device t
WHERE LEFT JOIN th_device_report r ON t.sn = r.sn AND TO_CHAR(r.REPORT_TIME, 'YYYY-MM') = #{lastMonth}
TO_CHAR(r.REPORT_TIME, 'YYYY-MM') = #{lastMonth} LEFT JOIN sys_dept dept ON t.dept_id = dept.dept_id
GROUP BY GROUP BY
r.SN, t.SN,
dept.dept_id, dept.dept_id,
TO_CHAR(r.REPORT_TIME, 'YYYY'), TO_CHAR(TO_DATE(#{lastMonth}, 'YYYY-MM'), 'YYYY'),
TO_CHAR(r.REPORT_TIME, 'MM') TO_CHAR(TO_DATE(#{lastMonth}, 'YYYY-MM'), 'MM')
</select> </select>
<insert id="insertMonth"> <insert id="insertMonth">
@ -64,4 +63,18 @@
</foreach> </foreach>
SELECT * FROM dual SELECT * FROM dual
</insert> </insert>
<delete id="deleteSampleDevice">
delete from th_device_report where sn=#{sn} and report_time= TO_DATE(#{reportTime}, 'yyyy-mm-dd hh24:mi:ss')
</delete>
<update id="updateData">
${date}
</update>
<select id="getMonthData" resultType="java.util.Map">
select * from th_device_report_month1
WHERE
TO_CHAR(REPORT_TIME, 'YYYY-MM') = #{date}
</select>
</mapper> </mapper>

View File

@ -80,7 +80,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int"> <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and FIND_IN_SET(#{deptId}, ancestors) <![CDATA[ <> ]]> 0 SELECT count(*)
FROM sys_dept
WHERE status = 0
AND del_flag = '0'
AND INSTR(',' || ancestors || ',', ',' || #{deptId} || ',') > 0;
</select> </select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> <select id="checkDeptNameUnique" resultMap="SysDeptResult">

View File

@ -82,7 +82,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND to_char(u.create_time, 'yyyy-mm-dd') &lt;= #{params.endTime} AND to_char(u.create_time, 'yyyy-mm-dd') &lt;= #{params.endTime}
</if> </if>
<if test="deptId != null and deptId != 0"> <if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET(#{deptId}, ancestors) <![CDATA[ <> ]]> 0 )) AND (u.dept_id = #{deptId}
OR u.dept_id IN (
SELECT t.dept_id
FROM sys_dept t
WHERE INSTR(',' || t.ancestors || ',', ',' || #{deptId} || ',') > 0
)
)
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
@ -148,9 +155,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- <selectKey keyProperty="userId" order="BEFORE" resultType="Long">--> <!-- <selectKey keyProperty="userId" order="BEFORE" resultType="Long">-->
<!-- select seq_sys_user.nextval as userId from DUAL--> <!-- select seq_sys_user.nextval as userId from DUAL-->
<!-- </selectKey>--> <!-- </selectKey>-->
<!-- <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">--> <!-- <insert id="insertUser" parameterType="SysUser" >-->
<insert id="insertUser" parameterType="SysUser" > <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
<selectKey keyProperty="userId" order="BEFORE" resultType="Long">
select seq_sys_user.nextval as userId from DUAL
</selectKey>
insert into sys_user( insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if> <if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>

View File

@ -1,13 +1,15 @@
package com.business.message.forest; package com.business.message.forest;
import com.dtflys.forest.annotation.Body; import com.dtflys.forest.annotation.Body;
import com.dtflys.forest.annotation.JSONBody;
import com.dtflys.forest.annotation.Post; import com.dtflys.forest.annotation.Post;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public interface MyClient { public interface MyClient {
@Post("http://218.58.79.146:13080/prod-api/outside/sensorData") @Post("http://10.167.96.13/prod-api/outside/sensorData")
String receiveSensorData(@Body("data") String data); // @Post("http://127.0.0.1:8080/outside/sensorData")
String receiveSensorData(@JSONBody String data);
} }

View File

@ -19,6 +19,18 @@ export function login(username, password, code, uuid) {
}) })
} }
export function singleSign(username, password) {
return request({
url: '/singleSign',
headers: {
isToken: false,
repeatSubmit: false
},
method: 'post',
data: { username, password }
})
}
// 注册方法 // 注册方法
export function register(data) { export function register(data) {
return request({ return request({
@ -66,3 +78,11 @@ export function getAccountName(data) {
params: data params: data
}) })
} }
export function redirectToAuth(data) {
return request({
url: '/redirectToAuth',
method: 'get',
params: data
})
}

View File

@ -117,3 +117,12 @@ export function deviceBackAdd(data) {
data: data data: data
}) })
} }
// 根据部门id查询设备列表
export function getDeviceListByDeptId(query) {
return request({
url: '/statistics/getDeviceListByDeptId',
method: 'get',
params: query
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 453 B

View File

@ -0,0 +1,107 @@
<template>
<div>
<el-select
v-model="deviceValue"
:placeholder="placeholder"
:disabled="disabled"
:clearable="clearable"
:filterable="filterable"
:multiple="multiple"
@change="handleChange"
:filter-method="dataFilter"
>
<el-option
v-for="item in deviceList"
:key="item.sn"
:label="item.name"
:value="item.sn"
>
<span>
{{ item.name }}
(<span style="color: #8492a6; font-size: 13px">{{ item.sn }}</span>)
</span>
</el-option>
</el-select>
</div>
</template>
<script>
import { getDeviceListByDeptId } from '@/api/oil/device.js';
import to from "@/utils/await-to.js";
export default {
name: "DeviceSelect",
props: {
value: {
type: String,
default: null,
},
deptId: {
type: [Number, String],
},
placeholder: {
type: String,
default: "请选择设备",
},
disabled: {
type: Boolean,
default: false,
},
clearable: {
type: Boolean,
default: true,
},
filterable: {
type: Boolean,
default: true,
},
multiple: {
type: Boolean,
default: false,
},
},
data() {
return {
deviceList: [],
deviceListCopy: [],
deviceValue: this.value,
};
},
watch: {
deptId(val) {
this.getDeviceList();
},
value(val) {
this.deviceValue = val;
}
},
methods: {
dataFilter(query) {
if (!query) return this.deviceList = this.deviceListCopy;
this.deviceList = this.deviceListCopy.filter(item => item.name.includes(query) || item.sn.includes(query));
},
handleChange(val) {
this.$emit("input", val);
this.$emit("change", val);
},
async getDeviceList() {
if (!this.deptId) return;
const [err, res] = await to(getDeviceListByDeptId({ deptId: this.deptId }));
if (err) return this.$message.error(err.message);
this.deviceList = res.rows;
this.deviceListCopy = JSON.parse(JSON.stringify(this.deviceList));
// value deviceList deviceValue
if (!this.deviceList.some(item => item.sn === this.deviceValue)) {
this.deviceValue = null;
}
},
},
mounted() {
this.getDeviceList();
},
}
</script>
<style scoped>
</style>

View File

@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register', '/LoginSso'] const whiteList = ['/login', '/register', '/LoginSso', '/LoginRedirect', '/SingleSign']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start()

View File

@ -51,6 +51,16 @@ export const constantRoutes = [
component: () => import('@/views/login-sso'), component: () => import('@/views/login-sso'),
hidden: true hidden: true
}, },
{
path: '/SingleSign',
component: () => import('@/views/single-sign'),
hidden: true
},
{
path: '/LoginRedirect',
component: () => import('@/views/login-redirect'),
hidden: true
},
{ {
path: '/register', path: '/register',
component: () => import('@/views/register'), component: () => import('@/views/register'),

View File

@ -1,4 +1,4 @@
import { login, logout, getInfo, getAccountName } from '@/api/login' import { login, logout, getInfo, getAccountName, singleSign } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth' import { getToken, setToken, removeToken } from '@/utils/auth'
import {encrypt, decrypt} from '@/utils/secret' import {encrypt, decrypt} from '@/utils/secret'
const user = { const user = {
@ -51,6 +51,21 @@ const user = {
}) })
}, },
SingleSign({ commit }, userInfo) {
const username = userInfo.userName.trim();
const password = userInfo.password;
let encodePs = encrypt(password)//加密
return new Promise((resolve, reject) => {
singleSign(username, encodePs).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -5,13 +5,18 @@
<dept-tree @deptChange="handleDeptChange" style="width: 150px" /> <dept-tree @deptChange="handleDeptChange" style="width: 150px" />
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="equipmentName"> <el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="queryParams.name"></el-input> <device-select
v-model="queryParams.sn"
:deptId="queryParams.deptId || ''"
placeholder="请选择设备"
@change="handleDeviceSelectChange"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="设备编号" prop="sn"> <!-- <el-form-item label="设备编号" prop="sn">
<el-input v-model="queryParams.sn"></el-input> <el-input v-model="queryParams.sn"></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="处理状态"> <el-form-item label="处理状态">
<el-select v-model="queryParams.status" placeholder="请选择处理状态" style="width: 150px;"> <el-select v-model="queryParams.status" placeholder="请选择处理状态" clearable style="width: 150px;">
<el-option label="正在处理" value="1"></el-option> <el-option label="正在处理" value="1"></el-option>
<el-option label="处理完成" value="2"></el-option> <el-option label="处理完成" value="2"></el-option>
</el-select> </el-select>
@ -22,7 +27,7 @@
<el-form-item> <el-form-item>
<span>日期</span> <span>日期</span>
<el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期" <el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"> end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -53,10 +58,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-if="scope.row.zt == '二级报警'" style="color: #e23434"> <span v-else style="color: #000">
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -64,9 +69,9 @@
<el-table-column prop="isDeal" label="处理状态" header-align="center" align="center"> <el-table-column prop="isDeal" label="处理状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="openDetailWindows(scope.row)" v-if="scope.row.status == 1" <span @click="openDetailWindows(scope.row)" v-if="scope.row.status == '1'"
style="color: orange;text-decoration: underline;cursor: pointer; "> 正在处理 </span> style="color: orange;text-decoration: underline;cursor: pointer; "> 正在处理 </span>
<span @click="openDetailWindows(scope.row)" v-else-if="scope.row.status == 2" <span @click="openDetailWindows(scope.row)" v-else-if="scope.row.status == '2'"
style="color: green;text-decoration: underline;cursor: pointer;"> 处理完成 </span> style="color: green;text-decoration: underline;cursor: pointer;"> 处理完成 </span>
<span v-else style="color: red"> 未处理 </span> <span v-else style="color: red"> 未处理 </span>
</template> </template>
@ -74,7 +79,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-thumb" @click="handleUpdate(scope.row)">下发通知</el-button> <el-button v-if="checkRole(['admin', 'notice'])" size="mini" type="text" icon="el-icon-thumb" @click="handleUpdate(scope.row)">下发通知</el-button>
<!--v-if="userName == scope.row.dealUser" --> <!--v-if="userName == scope.row.dealUser" -->
<el-button size="mini" type="text" icon="el-icon-dish-1" @click="handleAlarm(scope.row)">处理报警</el-button> <el-button size="mini" type="text" icon="el-icon-dish-1" @click="handleAlarm(scope.row)">处理报警</el-button>
<el-button size="mini" type="text" icon="el-icon-location-information" <el-button size="mini" type="text" icon="el-icon-location-information"
@ -94,7 +99,7 @@
<!--处理报警--> <!--处理报警-->
<deal-alarm :deviceInfo="deviceInfo" v-if="isOpenAlarm" :isOpenAlarm="isOpenAlarm" <deal-alarm :deviceInfo="deviceInfo" v-if="isOpenAlarm" :isOpenAlarm="isOpenAlarm"
@closeAlarm="closeAlarm"></deal-alarm> @closeAlarm="closeAlarm"></deal-alarm>
<el-dialog :title="mapDialogTitle" :visible.sync="mapDialogVisible" width="30%"> <el-dialog :title="mapDialogTitle" :visible.sync="mapDialogVisible" width="30%" append-to-body>
<div> <div>
<baidu-map :center="position" :zoom="16" :scroll-wheel-zoom="true" style="width: auto; height: 40vh" <baidu-map :center="position" :zoom="16" :scroll-wheel-zoom="true" style="width: auto; height: 40vh"
:map-type="currentMapType"> :map-type="currentMapType">
@ -104,20 +109,20 @@
</div> </div>
</el-dialog> </el-dialog>
<!--处理详情--> <!--处理详情-->
<el-dialog title="处理详情" :visible.sync="isOpenDetail" width="50%"> <el-dialog title="处理详情" :visible.sync="isOpenDetail" width="50%" append-to-body>
<div> <div>
<el-form :model="detailParams" label-width="130px"> <el-form :model="detailParams" label-width="130px">
<!-- 处理状态 --> <!-- 处理状态 -->
<el-form-item> <el-form-item>
<h3>处理状态</h3> <h3>处理状态</h3>
<p>{{ detailParams.status === '1' ? '正在处理' : '处理完成' }}</p> <p>{{ detailParams.status == '1' ? '正在处理' : '处理完成' }}</p>
</el-form-item> </el-form-item>
<!-- 报警信息 --> <!-- 报警信息 -->
<el-form-item> <el-form-item>
<h3>报警信息</h3> <h3>报警信息</h3>
<p>报警上报时间: <strong>{{ detailParams.reportTime }}</strong></p> <p>报警上报时间: <strong>{{ detailParams.reportTime }}</strong></p>
<p>报警值: <strong>{{ detailParams.ds }}</strong></p> <p>报警值: <strong>{{ detailParams.ds }}mg/</strong></p>
</el-form-item> </el-form-item>
<!-- 处理过程 --> <!-- 处理过程 -->
@ -127,7 +132,7 @@
</el-form-item> </el-form-item>
<!-- 如果状态为 1 (正在处理) 展示处理人备注 --> <!-- 如果状态为 1 (正在处理) 展示处理人备注 -->
<el-form-item v-if="detailParams.status === '1'"> <el-form-item v-if="detailParams.status == '1'">
<h3>处理信息</h3> <h3>处理信息</h3>
<p>处理人: <strong>{{ detailParams.dealUser }}</strong></p> <p>处理人: <strong>{{ detailParams.dealUser }}</strong></p>
<p>备注: <strong>{{ detailParams.remark }}</strong></p> <p>备注: <strong>{{ detailParams.remark }}</strong></p>
@ -139,7 +144,7 @@
</el-form-item> </el-form-item>
<!-- 如果状态为 2 (处理完成) 展示报警原因处理人处理方式 --> <!-- 如果状态为 2 (处理完成) 展示报警原因处理人处理方式 -->
<el-form-item v-if="detailParams.status === '2'"> <el-form-item v-if="detailParams.status == '2'">
<h3>处理结果</h3> <h3>处理结果</h3>
<p>报警原因: <strong>{{ detailParams.reason }}</strong></p> <p>报警原因: <strong>{{ detailParams.reason }}</strong></p>
<p>处理人: <strong>{{ detailParams.dealUser }}</strong></p> <p>处理人: <strong>{{ detailParams.dealUser }}</strong></p>
@ -154,18 +159,31 @@
</template> </template>
<script> <script>
import { checkRole } from "@/utils/permission";
import { listAlarm } from "@/api/demostrate/monitor"; import { listAlarm } from "@/api/demostrate/monitor";
import sendMsg from "@/views/demostrate/alarm/sendMsg"; import sendMsg from "@/views/demostrate/alarm/sendMsg";
import dealAlarm from "@/views/demostrate/alarm/dealAlarm"; import dealAlarm from "@/views/demostrate/alarm/dealAlarm";
import DeptTree from "@/components/DeptTree/index.vue"; import DeptTree from "@/components/DeptTree/index.vue";
import { BmlHeatmap } from "vue-baidu-map"; // import { BmlHeatmap } from "vue-baidu-map"; //
import moment from "moment";
import DeviceSelect from '@/components/DeviceSelect/index.vue';
export default { export default {
name: "alarm", name: "alarm",
components: { sendMsg, dealAlarm, DeptTree, BmlHeatmap }, components: { sendMsg, dealAlarm, DeptTree, BmlHeatmap, DeviceSelect },
dicts: [], dicts: [],
props: {
queryParamsName: {
type: String,
default: "",
},
queryParamsDate: {
type: Array,
default: () => [],
},
},
data() { data() {
return { return {
position : {},
detailParams: {}, detailParams: {},
isOpenDetail: false, isOpenDetail: false,
loading: false, loading: false,
@ -204,15 +222,32 @@ export default {
currentMapType: "BMAP_HYBRID_MAP", currentMapType: "BMAP_HYBRID_MAP",
mapDialogVisible: false, mapDialogVisible: false,
position: { lng: 116.404, lat: 39.915 }, // position: { lng: 116.404, lat: 39.915 }, //
mapDialogTitle: "",
}; };
}, },
created() { created() {
// this.userName = store.getters.user.userName; // this.userName = store.getters.user.userName;
}, },
watch: {
queryParamsName: {
handler: function (val) {
this.queryParams.name = val;
this.getList();
},
immediate: true,
},
queryParamsDate: {
handler: function (val) {
this.dateList = val;
},
immediate: true,
},
},
mounted() { mounted() {
this.init(); this.init();
}, },
methods: { methods: {
checkRole,
openDetailWindows(row) { openDetailWindows(row) {
this.detailParams = row this.detailParams = row
this.isOpenDetail = true this.isOpenDetail = true
@ -235,13 +270,20 @@ export default {
}, },
getList() { getList() {
if (this.dateList && this.dateList.length > 0) { if (this.dateList && this.dateList.length > 0) {
this.queryParams.startTime = this.dateList[0]; this.queryParams.startTime = moment(this.dateList[0]).format("YYYY-MM-DD 00:00:00");
this.queryParams.endTime = this.dateList[1]; this.queryParams.endTime = moment(this.dateList[1]).format("YYYY-MM-DD 23:59:59");
} else { } else {
this.queryParams.startTime = null; this.queryParams.startTime = null;
this.queryParams.endTime = null; this.queryParams.endTime = null;
} }
this.loading = true; this.loading = true;
if (this.queryParamsName) {
this.queryParams.name = this.queryParamsName;
}
if (this.queryParamsDate && this.queryParamsDate.length > 0) {
this.queryParams.startTime = moment(this.queryParamsDate[0]).format("YYYY-MM-DD 00:00:00");
this.queryParams.endTime = moment(this.queryParamsDate[1]).format("YYYY-MM-DD 23:59:59");
}
listAlarm(this.queryParams).then((response) => { listAlarm(this.queryParams).then((response) => {
this.dataList = response.rows; this.dataList = response.rows;
this.total = response.total; this.total = response.total;
@ -274,10 +316,10 @@ export default {
this.queryParams.dealUser = null; this.queryParams.dealUser = null;
this.queryParams.startTime = null; this.queryParams.startTime = null;
this.queryParams.endTime = null; this.queryParams.endTime = null;
this.getList();
}, },
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
handleSizeChange(val) { handleSizeChange(val) {
@ -293,9 +335,12 @@ export default {
lng: parseFloat(row.longitude), lng: parseFloat(row.longitude),
lat: parseFloat(row.latitude), lat: parseFloat(row.latitude),
}; };
this.mapDialogTitle = `读数:${row.ds}|低报值:${row.dbz}|高报值:${row.gbz}`; this.mapDialogTitle = `读数:${row.ds}mg/m³`;
this.mapDialogVisible = true; this.mapDialogVisible = true;
}, },
handleDeviceSelectChange(val) {
this.queryParams.sn = val;
},
}, },
}; };
</script> </script>

View File

@ -56,10 +56,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -442,4 +442,3 @@
}; };
</script> </script>

View File

@ -56,10 +56,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -442,4 +442,3 @@
}; };
</script> </script>

View File

@ -18,6 +18,14 @@
> >
</el-date-picker> </el-date-picker>
</el-col> </el-col>
<el-col :span="6">
<device-select
v-model="queryDeviceSn"
:deptId="dept ? dept.deptId : ''"
placeholder="请选择设备"
@change="handleDeviceSelectChange"
/>
</el-col>
</el-row> </el-row>
<div style="display: flex; height: 700px; margin-top: 10px;"> <div style="display: flex; height: 700px; margin-top: 10px;">
@ -33,10 +41,11 @@
<el-table-column label="放置区域" align="center" prop="address" /> <el-table-column label="放置区域" align="center" prop="address" />
<el-table-column label="报警次数" align="center" prop="count"> <el-table-column label="报警次数" align="center" prop="count">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{ color: 'red' }">{{ scope.row.count }}</span> <el-tag type="danger" class="count-tag" @click="clickAlarmTag(scope.row)">{{ scope.row.count }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="checkRole(['admin', 'notice'])"
label="操作" label="操作"
align="center" align="center"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
@ -55,6 +64,10 @@
</div> </div>
</div> </div>
<el-dialog title="报警管理" :visible.sync="dialogAlarmVisible">
<alarm-monitor :queryParamsName="queryParamsName" :queryParamsDate="queryParamsDate"/>
</el-dialog>
<!--发送通知--> <!--发送通知-->
<send-msg <send-msg
:deviceInfo="deviceInfo" :deviceInfo="deviceInfo"
@ -69,14 +82,17 @@
import { queryAlarmChart } from "@/api/demostrate/monitor"; import { queryAlarmChart } from "@/api/demostrate/monitor";
import { queryMonitorPrediction } from "@/api/demostrate/monitor"; import { queryMonitorPrediction } from "@/api/demostrate/monitor";
import sendMsg from "@/views/demostrate/alarm/sendMsg.vue"; import sendMsg from "@/views/demostrate/alarm/sendMsg.vue";
import DeviceSelect from '@/components/DeviceSelect/index.vue';
const echarts = require("echarts"); const echarts = require("echarts");
import { factoryBoundaryOnline } from "@/api/analysis" import { factoryBoundaryOnline } from "@/api/analysis"
import to from '@/utils/await-to.js'; import to from '@/utils/await-to.js';
import moment from 'moment'; import moment from 'moment';
import { debounce } from '@/utils'; import { debounce } from '@/utils';
import { checkRole } from "@/utils/permission";
import AlarmMonitor from '@/views/alarmMonitor/bound/index.vue';
export default { export default {
name: "alarm", name: "alarm",
components: { sendMsg }, components: { sendMsg, DeviceSelect, AlarmMonitor },
dicts: [], dicts: [],
data() { data() {
return { return {
@ -112,12 +128,17 @@ export default {
total: 0, total: 0,
isOpenMsg: false, isOpenMsg: false,
deviceInfo: {}, deviceInfo: {},
queryDeviceSn: "",
// //
queryParams: { queryParams: {
deptId: null, deptId: null,
beginDate: null, beginDate: null,
endDate: null, endDate: null,
deviceSn: null,
}, },
dialogAlarmVisible: false,
queryParamsName: null,
queryParamsDate: null,
}; };
}, },
mounted() { mounted() {
@ -142,11 +163,18 @@ export default {
}, },
}, },
methods: { methods: {
checkRole,
clickAlarmTag(row) {
this.dialogAlarmVisible = true;
this.queryParamsName = row.name;
this.queryParamsDate = [...this.dateList];
},
dateChange() { dateChange() {
this.queryDebounce(); this.queryDebounce();
}, },
handleDeptChange(dept) { handleDeptChange(dept) {
this.dept = dept; this.dept = dept;
this.queryDeviceSn = "";
this.queryDebounce(); this.queryDebounce();
}, },
async query() { async query() {
@ -154,7 +182,7 @@ export default {
this.queryParams.deptId = this.dept.deptId; this.queryParams.deptId = this.dept.deptId;
this.queryParams.beginDate = this.dateList[0]; this.queryParams.beginDate = this.dateList[0];
this.queryParams.endDate = this.dateList[1]; this.queryParams.endDate = this.dateList[1];
console.log(this.queryParams); this.queryParams.deviceSn = this.queryDeviceSn || '';
const [err, res] = await to(factoryBoundaryOnline(this.queryParams)); const [err, res] = await to(factoryBoundaryOnline(this.queryParams));
if (err) { if (err) {
console.error(err); console.error(err);
@ -165,7 +193,6 @@ export default {
this.$message.error(res.msg); this.$message.error(res.msg);
return; return;
} }
console.log(res);
this.alarmCount = res.data.alarmCount; this.alarmCount = res.data.alarmCount;
this.alarmCountDesc = res.data.alarmCountDesc; this.alarmCountDesc = res.data.alarmCountDesc;
this.queryChart(); this.queryChart();
@ -328,6 +355,9 @@ export default {
this.myChart = echarts.init(this.$refs.qdCityMap1); this.myChart = echarts.init(this.$refs.qdCityMap1);
this.myChart.setOption(option); this.myChart.setOption(option);
}, },
handleDeviceSelectChange() {
this.queryDebounce();
},
}, },
}; };
</script> </script>
@ -341,4 +371,7 @@ export default {
background-position-y: 7px; background-position-y: 7px;
} }
.count-tag {
cursor: pointer;
}
</style> </style>

View File

@ -11,9 +11,9 @@
<el-col :span="6"> <el-col :span="6">
<el-date-picker <el-date-picker
v-model="dateTimeRange" v-model="dateTimeRange"
type="monthrange" :type="isDaily ? 'daterange' : 'monthrange'"
format="yyyy-MM" :format="isDaily ? 'yyyy-MM-dd' : 'yyyy-MM'"
value-format="yyyy-MM" :value-format="isDaily ? 'yyyy-MM-dd' : 'yyyy-MM'"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@ -21,6 +21,9 @@
> >
</el-date-picker> </el-date-picker>
</el-col> </el-col>
<div class="switch-wrapper">
<el-checkbox v-model="isDaily">日维度</el-checkbox>
</div>
</el-row> </el-row>
<el-row :gutter="10" class="chart-wrapper"> <el-row :gutter="10" class="chart-wrapper">
@ -49,12 +52,22 @@ export default {
id: "comparisonChart", id: "comparisonChart",
Xdata: [], Xdata: [],
Ydata: [], Ydata: [],
option: {}, option: {
tooltip: {
trigger: "axis",
formatter: function (params) {
return `${params[0].name}<br />${params
.map((item) => `${item.marker} ${item.seriesName}: ${item.value} mg/m³`)
.join("<br />")}`;
},
},
},
series: { series: {
data: [], data: [],
}, },
}, },
queryDebounce: null, queryDebounce: null,
isDaily: false,
}; };
}, },
mounted() { mounted() {
@ -66,6 +79,22 @@ export default {
]; ];
this.queryDebounce = debounce(this.query, 100); this.queryDebounce = debounce(this.query, 100);
}, },
watch: {
isDaily: function (value) {
if (value) {
this.dateTimeRange = [
moment().startOf("month").format("YYYY-MM-DD"),
moment().format("YYYY-MM-DD"),
];
} else {
this.dateTimeRange = [
moment().startOf("month").format("YYYY-MM"),
moment().format("YYYY-MM"),
];
}
this.queryDebounce();
},
},
methods: { methods: {
handleDateTimeChange() { handleDateTimeChange() {
this.queryDebounce(); this.queryDebounce();
@ -89,6 +118,7 @@ export default {
ids: this.deptIds.join(","), ids: this.deptIds.join(","),
startDate: this.dateTimeRange[0], startDate: this.dateTimeRange[0],
endDate: this.dateTimeRange[1], endDate: this.dateTimeRange[1],
isDaily: this.isDaily,
}) })
); );
@ -102,6 +132,7 @@ export default {
return; return;
} }
const { data } = res; const { data } = res;
const that = this;
// month // month
function sortDataByMonth(data) { function sortDataByMonth(data) {
// //
@ -110,7 +141,10 @@ export default {
// //
data[key].sort((a, b) => { data[key].sort((a, b) => {
// month // month
return new Date(a.month) - new Date(b.month); // return new Date(a.month) - new Date(b.month);
return that.isDaily
? new Date(a.day) - new Date(b.day)
: new Date(a.month) - new Date(b.month);
}); });
} }
} }
@ -120,12 +154,15 @@ export default {
this.chartData.series.data = Object.keys(sortedData).map((key) => { this.chartData.series.data = Object.keys(sortedData).map((key) => {
return { return {
name: this.deptList.find((item) => item.deptId === parseInt(key))?.deptName, name: this.deptList.find((item) => item.deptId === parseInt(key))
?.deptName,
type: "line", type: "line",
data: data[key].map((item) => item.avgValue.toFixed(2)), data: data[key].map((item) => item.avgValue.toFixed(2)),
}; };
}); });
this.chartData.Xdata = data[Object.keys(data)[0]].map((item) => item.month); this.chartData.Xdata = data[Object.keys(data)[0]].map((item) =>
that.isDaily ? item.day : item.month
);
}, },
}, },
}; };
@ -139,4 +176,9 @@ export default {
margin-top: 20px; margin-top: 20px;
} }
} }
.switch-wrapper {
height: 36px;
display: flex;
align-items: center;
}
</style> </style>

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="daily-data"> <div class="daily-data">
<el-row :gutter="10" class="tool-bar"> <el-row :gutter="14" class="tool-bar">
<el-col :span="6" >
<dept-tree @deptChange="handleDeptChange" :showQuickGroup="true" />
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-date-picker <el-date-picker
v-model="day" v-model="day"
@ -12,7 +15,7 @@
> >
</el-date-picker> </el-date-picker>
</el-col> </el-col>
<el-col :span="18"> <el-col :span="10">
<div class="export_btn"> <div class="export_btn">
<el-button <el-button
type="primary" type="primary"
@ -38,7 +41,7 @@
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag> <el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag>
<el-tag type="warning" <el-tag type="warning"
>平均值: {{ calculateChildAvg(row, "ppp") }}</el-tag >平均值: {{ calculateChildAvg(row, "ppp") }} mg/</el-tag
> >
</div> </div>
</template> </template>
@ -50,7 +53,7 @@
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag> <el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag>
<el-tag type="warning" <el-tag type="warning"
>平均值: {{ calculateChildAvg(row, "pp") }}</el-tag >平均值: {{ calculateChildAvg(row, "pp") }} mg/</el-tag
> >
</div> </div>
</template> </template>
@ -62,19 +65,23 @@
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag> <el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag>
<el-tag type="warning" <el-tag type="warning"
>平均值: {{ calculateChildAvg(row, "p") }}</el-tag >平均值: {{ calculateChildAvg(row, "p") }} mg/</el-tag
> >
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="sn" label="设备编号"></el-table-column> <el-table-column prop="name" label="设备名称"></el-table-column>
<el-table-column <el-table-column
prop="avgDs" prop="avgDs"
label="当日均值" label="当日均值"
align="center" align="center"
></el-table-column> >
<template slot-scope="{ row }">
<div>{{ row.avgDs }} mg/</div>
</template>
</el-table-column>
</el-table> </el-table>
</el-row> </el-row>
</div> </div>
@ -88,13 +95,18 @@ export default {
name: "Daily", name: "Daily",
data() { data() {
return { return {
dept: null,
deptId:null,
day: "", day: "",
tableData: [], tableData: [],
}; };
}, },
created() { created() {
},
mounted() {
this.day = moment().format("YYYY-MM-DD"); this.day = moment().format("YYYY-MM-DD");
this.queryData(); this.queryData()
}, },
computed: { computed: {
pppList() { pppList() {
@ -102,6 +114,11 @@ export default {
}, },
}, },
methods: { methods: {
handleDeptChange(value) {
this.deptId = value.deptId;
this.queryData();
},
tableRowClassName({ row, rowIndex }) { tableRowClassName({ row, rowIndex }) {
const classNames = ["default-row", "success-row", "error-row", "warning-row", "info-row"]; const classNames = ["default-row", "success-row", "error-row", "warning-row", "info-row"];
const index = this.pppList.findIndex((item) => item === row.ppp); const index = this.pppList.findIndex((item) => item === row.ppp);
@ -112,7 +129,11 @@ export default {
this.queryData(); this.queryData();
}, },
queryData() { queryData() {
getDailyData({ day: this.day }).then((res) => { debugger
if (!this.deptId || !this.day) {
return;
}
getDailyData({ day: this.day, deptId: this.deptId, }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.tableData = res.data.map((item) => { this.tableData = res.data.map((item) => {
return { return {
@ -187,16 +208,20 @@ export default {
</script> </script>
<style> <style>
.el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
background-color: transparent !important; /* 移除背景色 */
cursor: default !important; /* 移除光标效果 */
}
.el-table .warning-row { .el-table .warning-row {
background: rgba(248,236,216,0.3); background: rgba(197 170 27 , 0.3);
} }
.el-table .success-row { .el-table .success-row {
background: rgba(225,243,216,0.3); background: rgba(94, 158, 63, 0.3);
} }
.el-table .error-row { .el-table .error-row {
background: rgba(252,226,226,0.3); background: rgba(197, 103, 103, 0.3);
} }
.el-table .default-row { .el-table .default-row {
@ -204,7 +229,7 @@ export default {
} }
.el-table .info-row { .el-table .info-row {
background: rgba(233,233,235,0.3); background: rgba(105, 105, 228, 0.3);
} }
</style> </style>
<style scoped> <style scoped>

View File

@ -35,7 +35,7 @@
<div @dblclick="changeAvgValue(scope.$index, scope.row)"> <div @dblclick="changeAvgValue(scope.$index, scope.row)">
<span v-show="!scope.row.enable_edit">{{ <span v-show="!scope.row.enable_edit">{{
scope.row.avgValue scope.row.avgValue
}}</span> }} mg/</span>
<el-input <el-input
:ref="'changeAvgValue' + scope.$index" :ref="'changeAvgValue' + scope.$index"
@ -71,6 +71,7 @@ import {
getDeviceReportMonthList, getDeviceReportMonthList,
updateDeviceReportMonth, updateDeviceReportMonth,
} from "@/api/statistics/monthData.js"; } from "@/api/statistics/monthData.js";
import { checkRole } from "@/utils/permission";
export default { export default {
name: "CreateReport", name: "CreateReport",
@ -117,6 +118,7 @@ export default {
this.dateValue = `${year}-${month}`; this.dateValue = `${year}-${month}`;
}, },
changeAvgValue(index, row) { changeAvgValue(index, row) {
if (!checkRole(['admin','power'])) return;
this.$set(row, "enable_edit", true); this.$set(row, "enable_edit", true);
this.oldValue = row.avgValue; this.oldValue = row.avgValue;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -124,6 +124,7 @@ export default {
this.tableData = res.rows.map((item, index) => { this.tableData = res.rows.map((item, index) => {
return { return {
...item, ...item,
ds: item.ds + " mg/m³",
reportTime: moment(item.reportTime).format( reportTime: moment(item.reportTime).format(
"YYYY-MM-DD HH:mm:ss" "YYYY-MM-DD HH:mm:ss"
), ),

View File

@ -41,7 +41,29 @@ export default {
id: "main", id: "main",
Xdata: [], Xdata: [],
Ydata: [], Ydata: [],
option: {}, option: {
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985",
},
},
formatter: function (params) {
return (
`${params[0].name}
<br />
${params[0].marker}
读数
:
<strong>${params[0].value}</strong>
mg/
`
);
},
},
},
}, },
refreshDebounce: null, refreshDebounce: null,
}; };
@ -49,20 +71,17 @@ export default {
watch: { watch: {
queryParam: { queryParam: {
handler: function (newVal, oldVal) { handler: function (newVal, oldVal) {
this.refreshDebounce(); this.refresh();
}, },
deep: true, deep: true,
}, },
selectedDept: { selectedDept: {
handler: function (newVal, oldVal) { handler: function (newVal, oldVal) {
this.refreshDebounce(); this.refresh();
}, },
deep: true, deep: true,
}, },
}, },
mounted() {
this.refreshDebounce = debounce(this.refresh, 100);
},
methods: { methods: {
refresh() { refresh() {
if (this.selectedDept && this.selectedDept.sn && this.queryParam) { if (this.selectedDept && this.selectedDept.sn && this.queryParam) {
@ -80,10 +99,18 @@ export default {
const seriesData = res.rows.map((item) => parseFloat(item.ds)); const seriesData = res.rows.map((item) => parseFloat(item.ds));
this.chartData.Xdata = axisData; this.chartData.Xdata = axisData;
this.chartData.Ydata = seriesData; this.chartData.Ydata = seriesData;
} else {
this.resetChart();
} }
}); });
} else {
this.resetChart();
} }
}, },
resetChart() {
this.chartData.Xdata = [];
this.chartData.Ydata = [];
},
}, },
}; };
</script> </script>

View File

@ -32,8 +32,8 @@ export default {
computed: { computed: {
position() { position() {
return { return {
lng: parseFloat(this.selectedDept.longitude), lng: parseFloat(this.selectedDept?.longitude),
lat: parseFloat(this.selectedDept.latitude), lat: parseFloat(this.selectedDept?.latitude),
}; };
}, },
}, },

View File

@ -87,7 +87,12 @@ export default {
refresh() { refresh() {
if (this.queryParam.deptId) { if (this.queryParam.deptId) {
getDeviceList(this.queryParam.deptId, this.pager).then((res) => { getDeviceList(this.queryParam.deptId, this.pager).then((res) => {
if (res.code === 200 && res.rows.length > 0) { if (res.code === 200) {
if (res.rows.length === 0) {
this.tableData = [];
this.deptSelect(null);
return;
}
this.tableData = res.rows; this.tableData = res.rows;
this.radio = res.rows[0].id; this.radio = res.rows[0].id;
this.pager.total = res.total; this.pager.total = res.total;

View File

@ -41,7 +41,7 @@
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag> <el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag>
<el-tag type="warning" <el-tag type="warning"
>平均值: {{ calculateChildAvg(row, "ppp") }}</el-tag >平均值: {{ calculateChildAvg(row, "ppp") }} mg/</el-tag
> >
</div> </div>
</template> </template>
@ -52,7 +52,7 @@
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag> <el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag>
<el-tag type="warning" <el-tag type="warning"
>平均值: {{ calculateChildAvg(row, "pp") }}</el-tag >平均值: {{ calculateChildAvg(row, "pp") }} mg/</el-tag
> >
</div> </div>
</template> </template>
@ -63,32 +63,17 @@
<div style="display: flex; gap: 10px"> <div style="display: flex; gap: 10px">
<el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag> <el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag>
<el-tag type="warning" <el-tag type="warning"
>平均值: {{ calculateChildAvg(row, "p") }}</el-tag >平均值: {{ calculateChildAvg(row, "p") }} mg/</el-tag
> >
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="sn" label="设备编码" /> <el-table-column prop="name" label="设备名称" />
<!-- <el-table-column prop="year" label="年份" /> --> <!-- <el-table-column prop="year" label="年份" /> -->
<el-table-column prop="avgValue" label="平均值"> <el-table-column prop="avgValue" label="平均值">
<!-- <template slot-scope="scope"> <template slot-scope="{ row }">
<div @dblclick="changeAvgValue(scope.$index, scope.row)"> <div>{{ row.avgValue }} mg/</div>
<span v-show="!scope.row.enable_edit">{{ </template>
scope.row.avgValue
}}</span>
<el-input
:ref="'changeAvgValue' + scope.$index"
@blur="changeAvgValueBlur(scope.$index, scope.row)"
@keyup.enter.native="$event.target.blur"
clearable
v-show="scope.row.enable_edit"
size="mini"
v-model="scope.row.avgValue"
placeholder="请输入内容"
></el-input>
</div>
</template> -->
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- <div class="page-ele"> <!-- <div class="page-ele">
@ -114,8 +99,7 @@ import {
getDeviceReportYearListAll, getDeviceReportYearListAll,
} from "@/api/statistics/yearData.js"; } from "@/api/statistics/yearData.js";
import { dataToExcel } from "@/utils/excel.js"; import { dataToExcel } from "@/utils/excel.js";
import to from '@/utils/await-to.js'; import to from "@/utils/await-to.js";
export default { export default {
data() { data() {
@ -145,10 +129,18 @@ export default {
}, },
methods: { methods: {
tableRowClassName({ row, rowIndex }) { tableRowClassName({ row, rowIndex }) {
const classNames = ["default-row", "success-row", "error-row", "warning-row", "info-row"]; const classNames = [
"default-row",
"success-row",
"error-row",
"warning-row",
"info-row",
];
const index = this.pppList.findIndex((item) => item === row.ppp); const index = this.pppList.findIndex((item) => item === row.ppp);
if (index === -1) return "info-row"; if (index === -1) return "info-row";
return index > classNames.length - 1 ? classNames[index % classNames.length] : classNames[index]; return index > classNames.length - 1
? classNames[index % classNames.length]
: classNames[index];
}, },
getChildCount(row, key, childKey) { getChildCount(row, key, childKey) {
const childSet = new Set(); const childSet = new Set();
@ -235,7 +227,12 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.tableData = res.data; this.tableData = res.data.map((item) => {
return {
...item,
avgValue: parseFloat(item.avgValue.toFixed(2)),
};
});
// this.total = res.total; // this.total = res.total;
} }
}) })
@ -245,16 +242,18 @@ export default {
}, },
async handleExport() { async handleExport() {
const fileName = `${this.dept.deptName} ${this.year}年数据统计`; const fileName = `${this.dept.deptName} ${this.year}年数据统计`;
const [err, response] = await to(getDeviceReportYearListAll({ const [err, response] = await to(
getDeviceReportYearListAll({
deptId: this.dept.deptId, deptId: this.dept.deptId,
year: this.year, year: this.year,
})); })
);
if (err) { if (err) {
console.error(err); console.error(err);
this.$message.error("导出失败"); this.$message.error("导出失败");
return; return;
} }
const {data} = response; const { data } = response;
dataToExcel({ dataToExcel({
data: [ data: [
[fileName], [fileName],

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog title="处理报警" :visible.sync="openConfig1" :before-close="handleClose"> <el-dialog title="处理报警" :visible.sync="openConfig1" :before-close="handleClose" append-to-body>
<el-form :model="queryParams" ref="addform" label-width="130px" :rules="dealRule"> <el-form :model="queryParams" ref="addform" label-width="130px" :rules="dealRule">
<el-form-item label="处理状态" prop="status"> <el-form-item label="处理状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择处理状态" style="width: 500px;"> <el-select v-model="queryParams.status" placeholder="请选择处理状态" style="width: 500px;">
@ -185,4 +185,3 @@ export default {
color: #FFF; color: #FFF;
} }
</style> </style>

View File

@ -56,10 +56,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -216,4 +216,3 @@ export default {
}; };
</script> </script>

View File

@ -3,6 +3,7 @@
title="下发通知" title="下发通知"
:visible.sync="openConfig1" :visible.sync="openConfig1"
:before-close="handleClose" :before-close="handleClose"
append-to-body
> >
<div style="display: inline-flex; height: 30px; line-height: 30px"> <div style="display: inline-flex; height: 30px; line-height: 30px">
<el-button class="agreeButton" style="width: 120px" @click="chooseUser1()" <el-button class="agreeButton" style="width: 120px" @click="chooseUser1()"
@ -116,15 +117,7 @@ export default {
dealUser: this.userList[0].userName, dealUser: this.userList[0].userName,
}; };
addAlarm(data).then((res) => {
if (res.code == 200) {
this.$message.success("分配修复任务成功!");
this.handleClose();
bus.$emit("msgReaded");
} else {
this.$message.success("分配修复任务失败!");
}
});
} }
}); });
}, },

View File

@ -45,13 +45,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -158,4 +155,3 @@ export default {
}; };
</script> </script>

View File

@ -1,45 +1,91 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px"> <el-form
<el-form-item label="部门" prop="deptId"> :model="queryParams"
<treeselect style="width:300px" v-model="queryParams.deptId" :multiple="false" :options="deptList" ref="queryForm"
:normalizer="normalizer" placeholder="请选择组织部门" /> size="small"
:inline="true"
label-width="100px"
>
<el-form-item label="选择部门" prop="deptId">
<dept-tree @deptChange="handleDeptChange" style="width: 150px" />
</el-form-item> </el-form-item>
<el-form-item label="设备编号" prop="monitorNo"> <el-form-item label="设备编号" prop="monitorNo">
<el-input v-model="queryParams.monitorNo" placeholder="请输入设备编号"></el-input> <el-input
v-model="queryParams.monitorNo"
placeholder="请输入设备编号"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="monitorName"> <el-form-item label="设备名称" prop="monitorName">
<el-input v-model="queryParams.monitorName" placeholder="请输入设备名称"></el-input> <el-input
v-model="queryParams.monitorName"
placeholder="请输入设备名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备状态" prop="status"> <el-form-item label="设备状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择设备状态" style="width: 150px;"> <el-select
v-model="queryParams.status"
placeholder="请选择设备状态"
style="width: 150px"
>
<el-option label="运行" value="1"></el-option> <el-option label="运行" value="1"></el-option>
<el-option label="停运" value="0"></el-option> <el-option label="停运" value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> type="primary"
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button> <el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" v-hasRole="['admin', 'epa', 'factory']" plain icon="el-icon-delete" size="mini" <el-button
:disabled="multiple" @click="handleDelete">删除</el-button> type="danger"
v-hasRole="['admin', 'epa', 'factory']"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button
>
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="monitorList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="monitorList"
@selection-change="handleSelectionChange"
>
<el-table-column label="设备编号" align="center" prop="monitorNo" /> <el-table-column label="设备编号" align="center" prop="monitorNo" />
<el-table-column label="设备名称" align="center" prop="monitorName" /> <el-table-column label="设备名称" align="center" prop="monitorName" />
<el-table-column label="安装部门" align="center" prop="deptName" /> <el-table-column label="安装部门" align="center" prop="deptName" />
<el-table-column label="安装位置" align="center" prop="address" /> <el-table-column label="安装位置" align="center" prop="address" />
<el-table-column label="系统编码(原有)" align="center" prop="systemNo" /> <el-table-column label="负责人" align="center" prop="userName" />
<el-table-column label="唯一编码(原有)" align="center" prop="unitNo" /> <el-table-column
label="系统编码(原有)"
align="center"
prop="systemNo"
/>
<!-- <el-table-column label="唯一编码(原有)" align="center" prop="unitNo" /> -->
<el-table-column prop="status" label="设备状态" align="center"> <el-table-column prop="status" label="设备状态" align="center">
<!-- 使用 scoped slot 来自定义显示 --> <!-- 使用 scoped slot 来自定义显示 -->
<template slot-scope="scope"> <template slot-scope="scope">
@ -47,49 +93,110 @@
<span v-else-if="scope.row.status == '0'">停运</span> <span v-else-if="scope.row.status == '0'">停运</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上传时间" align="center" prop="createTime" /> <!-- <el-table-column label="上传时间" align="center" prop="createTime" />
<el-table-column label="设备图片" align="center" prop="fileUrl" width="100"> <el-table-column
<template slot-scope="scope"> label="设备图片"
align="center"
prop="fileUrl"
width="100"
> -->
<!-- <template slot-scope="scope">
<image-preview :src="scope.row.fileUrl" :width="50" :height="50" /> <image-preview :src="scope.row.fileUrl" :width="50" :height="50" />
</template> </template> -->
</el-table-column> <!-- </el-table-column> -->
<el-table-column label="经度" align="center" prop="longitude" /> <el-table-column label="经度" align="center" prop="longitude" />
<el-table-column label="纬度" align="center" prop="latitude" /> <el-table-column label="纬度" align="center" prop="latitude" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="报警阈值" align="center" prop="bjyz" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-hasRole="['admin', 'epa', 'factory']" size="mini" type="text" icon="el-icon-edit" <el-button
@click="handleUpdate(scope.row)">修改</el-button> v-hasRole="['admin', 'epa', 'factory']"
<el-button v-hasRole="['admin', 'epa', 'factory']" size="mini" type="text" icon="el-icon-delete" size="mini"
@click="handleDelete(scope.row)">删除</el-button> type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button
>
<el-button
v-hasRole="['admin', 'epa', 'factory']"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button size="mini" type="text" icon="el-icon-location-information"
@click="handleShowMap(scope.row)">查看位置</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" <pagination
@pagination="getList" /> v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改密封点群组对话框 --> <!-- 添加或修改密封点群组对话框 -->
<el-dialog :title="title" :visible.sync="isOpenAdd" width="500px" append-to-body> <el-dialog
:title="title"
:visible.sync="isOpenAdd"
width="500px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="140px"> <el-form ref="form" :model="form" :rules="rules" label-width="140px">
<el-form-item label="设备编号" prop="monitorNo"> <el-form-item label="设备编号" prop="monitorNo">
<el-input v-model="form.monitorNo" placeholder="请输入设备编号" :disabled="disAdd" /> <el-input
v-model="form.monitorNo"
placeholder="请输入设备编号"
:disabled="disAdd"
/>
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="monitorName"> <el-form-item label="设备名称" prop="monitorName">
<el-input v-model="form.monitorName" placeholder="请输入设备名称" /> <el-input v-model="form.monitorName" placeholder="请输入设备名称" />
</el-form-item> </el-form-item>
<el-form-item label="安装部门" prop="deptId"> <el-form-item label="安装部门" prop="deptId">
<treeselect v-model="form.deptId" :multiple="false" :options="deptList" :normalizer="normalizer" <treeselect
placeholder="请选择组织部门" /> v-model="form.deptId"
:multiple="false"
:options="deptList"
:normalizer="normalizer"
placeholder="请选择组织部门"
/>
</el-form-item> </el-form-item>
<el-form-item label="安装地址"> <el-form-item label="安装地址">
<el-input v-model="form.address" placeholder="请输入安装地址" /> <el-input v-model="form.address" placeholder="请输入安装地址" />
</el-form-item> </el-form-item>
<el-form-item label="负责人">
<el-input
v-model="form.userName"
placeholder="请选择负责人"
readonly
@click.native="isShowUser = true"
/>
<user-select
v-if="isShowUser"
:isShowUser="isShowUser"
:multiple="false"
:selectedList="userList"
@closeUser="closeUser"
@chooseUser="chooseUser"
/>
</el-form-item>
<el-form-item label="经度"> <el-form-item label="经度">
<el-input v-model="form.longitude" placeholder="请输入经度" /> <el-input v-model="form.longitude" placeholder="请输入经度" />
</el-form-item> </el-form-item>
<el-form-item label="纬度"> <el-form-item label="纬度">
<el-input v-model="form.latitude" placeholder="纬度" /> <el-input v-model="form.latitude" placeholder="纬度" />
</el-form-item> </el-form-item>
<el-form-item label="报警阈值">
<el-input v-model="form.bjyz" placeholder="报警阈值" />
</el-form-item>
<el-form-item label="系统编码(原有)"> <el-form-item label="系统编码(原有)">
<el-input v-model="form.systemNo" placeholder="系统编码(原有)" /> <el-input v-model="form.systemNo" placeholder="系统编码(原有)" />
</el-form-item> </el-form-item>
@ -97,7 +204,11 @@
<el-input v-model="form.unitNo" placeholder="唯一编码(原有)" /> <el-input v-model="form.unitNo" placeholder="唯一编码(原有)" />
</el-form-item> </el-form-item>
<el-form-item label="设备状态" prop="status"> <el-form-item label="设备状态" prop="status">
<el-select v-model="form.status" placeholder="请选择设备状态" style="width: 150px;"> <el-select
v-model="form.status"
placeholder="请选择设备状态"
style="width: 150px"
>
<el-option label="运行" value="1"></el-option> <el-option label="运行" value="1"></el-option>
<el-option label="停运" value="0"></el-option> <el-option label="停运" value="0"></el-option>
</el-select> </el-select>
@ -114,30 +225,49 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!--处理报警-->
<el-dialog title="查看位置" :visible.sync="mapDialogVisible" width="30%" append-to-body>
<div>
<baidu-map :center="position" :zoom="16" :scroll-wheel-zoom="true" style="width: auto; height: 40vh"
:map-type="currentMapType">
<bm-map-type :map-types="['BMAP_NORMAL_MAP', 'BMAP_HYBRID_MAP']" anchor="BMAP_ANCHOR_TOP_LEFT"></bm-map-type>
<bm-marker :position="position"></bm-marker>
</baidu-map>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import DeptTree from "@/components/DeptTree/index.vue";
import store from "@/store"; import store from "@/store";
import bus from '@/utils/bus.js' import bus from "@/utils/bus.js";
import { updateMonitor, addMonitor, delMonitor, listMonitor } from "@/api/demostrate/monitor"; import {
updateMonitor,
addMonitor,
delMonitor,
listMonitor,
} from "@/api/demostrate/monitor";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { listDept } from "@/api/system/dept"; import { listDept } from "@/api/system/dept";
import UserSelect from "@/views/home/components/UserSelect.vue";
export default { export default {
name: "MonitorDetail", name: "MonitorDetail",
components: { Treeselect }, components: { Treeselect, UserSelect ,DeptTree},
dicts: [], dicts: [],
data() { data() {
return { return {
currentMapType: 'BMAP_HYBRID_MAP',
position : {},
mapDialogVisible: false,
normalizer(node) { normalizer(node) {
return { return {
id: node.deptId, id: node.deptId,
label: node.deptName, label: node.deptName,
children: node.children, children: node.children,
} };
}, },
deptList: [], deptList: [],
disAdd: true, disAdd: true,
@ -145,104 +275,115 @@ export default {
multiple: true, multiple: true,
rules: { rules: {
monitorName: [ monitorName: [
{ required: true, message: "设备名称不能为空", trigger: "blur" } { required: true, message: "设备名称不能为空", trigger: "blur" },
], ],
monitorNo: [ monitorNo: [
{ required: true, message: "设备编号不能为空", trigger: "blur" } { required: true, message: "设备编号不能为空", trigger: "blur" },
],
deptId: [
{ required: true, message: "部门不能为空", trigger: "blur" }
], ],
deptId: [{ required: true, message: "部门不能为空", trigger: "blur" }],
status: [ status: [
{ required: true, message: "设备状态不能为空", trigger: "blur" } { required: true, message: "设备状态不能为空", trigger: "blur" },
] ],
}, },
title: '', title: "",
monitorList: [], // monitorList: [], //
loading: false, loading: false,
total: 0, total: 0,
isOpenAdd: false,// isOpenAdd: false, //
// //
queryParams: { queryParams: {
factoryId:null,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
monitorNo: null, monitorNo: null,
monitorName: null, monitorName: null,
id: null, id: null,
deptId: null, deptId: null,
status:null, status: null,
}, },
ids: [], ids: [],
form: {}, form: {},
isShowUser: false,
userList: [],
}; };
}, },
created() { created() {
this.queryParams.factoryId = store.getters.user.factoryId
bus.$on('toMonitorDetail', (val) => {
this.queryParams.monitorNo = val.monitorNo bus.$on("toMonitorDetail", (val) => {
this.queryParams.id = val.id this.queryParams.monitorNo = val.monitorNo;
this.queryParams.monitorName = val.monitorName this.queryParams.id = val.id;
this.queryParams.monitorName = val.monitorName;
// this.getList() // this.getList()
});
})
}, },
mounted() { mounted() {
this.getOrganizeTree() this.getOrganizeTree();
}, },
methods: { methods: {
handleDeptChange(value) {
this.queryParams.deptId = value.deptId;
this.emitChange();
},
handleShowMap(row) {
this.position = {
lng: parseFloat(row.longitude),
lat: parseFloat(row.latitude),
};
// this.mapDialogTitle = `:${row.ds}mg/m³`;
this.mapDialogVisible = true;
},
getOrganizeTree() { getOrganizeTree() {
listDept({ listDept({
deptName: undefined, deptName: undefined,
}).then((response) => {
}).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.deptList = this.handleTree(response.data, "deptId"); this.deptList = this.handleTree(response.data, "deptId");
this.getList() this.getList();
} else { } else {
console.error(response); console.error(response);
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}); });
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除?').then(function () { this.$modal
.confirm("是否确认删除?")
.then(function () {
return delMonitor(ids); return delMonitor(ids);
}).then((res) => { })
.then((res) => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }); })
.catch(() => {});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.disAdd = true this.disAdd = true;
this.form = row this.form = row;
this.isOpenAdd = true; this.isOpenAdd = true;
this.userList = [row];
this.title = "修改监控装置"; this.title = "修改监控装置";
}, },
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateMonitor(this.form).then(response => { updateMonitor(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.isOpenAdd = false; this.isOpenAdd = false;
this.getList(); this.getList();
}); });
} else { } else {
addMonitor(this.form).then(response => { addMonitor(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
} else { } else {
@ -256,36 +397,55 @@ export default {
} }
}); });
}, },
cancel() {
this.isOpenAdd = false;
},
// //
handleAdd() { handleAdd() {
this.disAdd = false;
this.disAdd = false this.form = {};
this.form = {} this.isOpenAdd = true;
this.isOpenAdd = true this.selectedList = [];
this.title = '新增监控装置' this.title = "新增监控装置";
}, },
// //
getImage(data) { getImage(data) {
this.form.fileUrl = data this.form.fileUrl = data;
}, },
resetQuery() { resetQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.queryParams.monitorName = null this.queryParams.monitorName = null;
this.queryParams.monitorNo = null this.queryParams.monitorNo = null;
this.getList() this.getList();
}, },
handleQuery() { handleQuery() {
this.getList() this.getList();
}, },
/** 查询密封点群组列表 */ /** 查询密封点群组列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listMonitor(this.queryParams).then(response => { listMonitor(this.queryParams).then((response) => {
this.monitorList = response.rows; this.monitorList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
closeUser(val) {
this.isShowUser = val;
},
//
chooseUser(val) {
if (val && val.length < 1) {
this.$message.error("请至少选择一名处理人员!");
this.isShowUser = false;
} else {
this.userList = val;
this.form.userName = val[0].userName;
this.form.userId = val[0].userId;
this.isShowUser = false;
} }
console.log(this.userList);
},
},
}; };
</script> </script>

View File

@ -5,8 +5,8 @@
<dept-tree @deptChange="handleDeptChange" style="width: 150px;" /> <dept-tree @deptChange="handleDeptChange" style="width: 150px;" />
</el-form-item> </el-form-item>
<el-form-item label="设备编号"> <el-form-item label="选择设备">
<el-input v-model="queryParams.sn"></el-input> <device-select v-model="queryParams.sn" :deptId="queryParams.deptId || ''" />
</el-form-item> </el-form-item>
<el-form-item label="日期" prop="equipmentName"> <el-form-item label="日期" prop="equipmentName">
<el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期" <el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期"
@ -41,13 +41,10 @@
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -66,9 +63,10 @@
import store from "@/store"; import store from "@/store";
import DeptTree from "@/components/DeptTree/index.vue"; import DeptTree from "@/components/DeptTree/index.vue";
import { listAlarmHistory } from "@/api/demostrate/monitor"; import { listAlarmHistory } from "@/api/demostrate/monitor";
import DeviceSelect from '@/components/DeviceSelect/index.vue';
export default { export default {
name: "alarm", name: "alarm",
components: { DeptTree }, components: { DeptTree, DeviceSelect },
dicts: [], dicts: [],
data() { data() {
return { return {
@ -153,9 +151,6 @@ export default {
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1

View File

@ -43,13 +43,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -373,4 +370,3 @@
}; };
</script> </script>

View File

@ -43,13 +43,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -372,4 +369,3 @@
}; };
</script> </script>

View File

@ -32,7 +32,7 @@
<div class="river-ships"> <div class="river-ships">
<div class="ship-describe"> <div class="ship-describe">
<p> <p>
<span>厂界在线监测设备在线</span> <span>厂界监测设备在线</span>
<span class="num-class" >{{numTotal.onlineTotal}}</span><span></span> <span class="num-class" >{{numTotal.onlineTotal}}</span><span></span>
</p> </p>
</div> </div>
@ -56,6 +56,8 @@
<third-title title="设备分布情况"> <third-title title="设备分布情况">
</third-title> </third-title>
<div class="bottom-bottom"> <div class="bottom-bottom">
<div style="font-size: 16px;
color: #fff; "> 监测设备共分布{{ factoryTotal}}家企业如下</div>
<div class="left-list"> <div class="left-list">
<div class="left-list1">港区名称</div> <div class="left-list1">港区名称</div>
<div class="left-list22">企业名称</div> <div class="left-list22">企业名称</div>
@ -118,6 +120,7 @@ export default {
data() { data() {
// //
return { return {
factoryTotal:0,
time: '', time: '',
dateTimer: '', dateTimer: '',
// //
@ -149,6 +152,7 @@ export default {
this.examList = [] this.examList = []
queryDeviceByFactory(this.queryParams).then(response => { queryDeviceByFactory(this.queryParams).then(response => {
this.examList = response.data this.examList = response.data
this.factoryTotal=response.data.length
}); });
}, },

View File

@ -10,7 +10,7 @@
<div class="left-list22">企业名称</div> <div class="left-list22">企业名称</div>
<div class="left-list1">设备编号</div> <div class="left-list1">设备编号</div>
<div class="left-list1">设备读数</div> <div class="left-list1">设备读数</div>
<div class="left-list1">报警级别</div> <!-- <div class="left-list1">报警级别</div> -->
</div> </div>
<div class="left-over"> <div class="left-over">
<template v-if="alarmList.length > 0"> <template v-if="alarmList.length > 0">
@ -38,7 +38,7 @@
</template> </template>
<div class="left-list1" style="color: rgb(0 255 255);">{{ item.ds }}</div> <div class="left-list1" style="color: rgb(0 255 255);">{{ item.ds }}</div>
<div class="left-list1">{{ item.level }}</div> <!-- <div class="left-list1">{{ item.level }}</div> -->
</div> </div>
</template> </template>
<template v-else> <template v-else>

View File

@ -70,7 +70,11 @@ export default {
}, },
selectedList: { selectedList: {
type: Array, type: Array,
default: [], default: () => [],
},
multiple: {
type: Boolean,
default: true,
}, },
}, },
watch: { watch: {
@ -114,8 +118,15 @@ export default {
this.$emit("chooseUser", this.selectList); this.$emit("chooseUser", this.selectList);
} }
}, },
handleSelectionChange(val) { handleSelectionChange(selection) {
this.selectList = val; this.selectList = selection;
if (!this.multiple && selection.length > 1) {
selection.forEach((item,index) => {
if (index != selection.length - 1) {
this.$refs.userTable.toggleRowSelection(item, false)
}
})
}
}, },
quetyList() { quetyList() {
listUser(this.userParams).then((response) => { listUser(this.userParams).then((response) => {

View File

@ -9,12 +9,12 @@
</div> </div>
<!--左侧--> <!--左侧-->
<div v-if="showBeside" class="reservoir-left"> <div class="reservoir-left">
<left /> <left />
</div> </div>
<!--右侧--> <!--右侧-->
<div v-if="showBeside" class="reservoir-right"> <div class="reservoir-right">
<right /> <right />
</div> </div>
<div class="reservoir-map"> <div class="reservoir-map">

View File

@ -0,0 +1,24 @@
<template>
<div></div>
</template>
<script>
export default {
name: "LoginRedirect",
data() {
return {
authorizeUrl: "https://iam.sd-port.com:18010/idp/oauth2/authorize",
clientId: "hfxyjwzxjc",
redirectUri: `${window.location.origin}/prod-api/redirectToAuth&response_type=code&state=123`,
};
},
created() {
this.loginRedirect();
},
methods: {
loginRedirect() {
window.location = `${this.authorizeUrl}?client_id=${this.clientId}&redirect_uri=${this.redirectUri}`;
},
}
};
</script>

View File

@ -7,11 +7,6 @@ export default {
name: "LoginSso", name: "LoginSso",
data() { data() {
return { return {
loginRules: {},
//
captchaOnOff: true,
//
register: false,
// //
redirect: undefined redirect: undefined
}; };
@ -24,7 +19,6 @@ export default {
loginSso() { loginSso() {
//code //code
const code = this.$route.query.code; const code = this.$route.query.code;
console.log("code="+code)
// //
if(code==''||code==undefined||code==null){ if(code==''||code==undefined||code==null){
//code //code

View File

@ -99,7 +99,7 @@
data() { data() {
return { return {
title: { title: {
chinese: '山东港口集团在线监控管理平台', chinese: '山东港口挥发性有机物在线监测管理平台',
english: 'Online Monitoring And Management System' english: 'Online Monitoring And Management System'
}, },
codeUrl: "", codeUrl: "",

View File

@ -43,13 +43,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -372,4 +369,3 @@
}; };
</script> </script>

View File

@ -43,13 +43,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -373,4 +370,3 @@
}; };
</script> </script>

View File

@ -43,13 +43,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="zt" label="报警状态" header-align="center" align="center"> <el-table-column prop="zt" label="报警状态" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zt == '一级报警'" style="color: #c00808;"> <span v-if="scope.row.zt === '一级报警' || scope.row.zt === '二级报警'" style="color: #c00808">
{{ scope.row.zt }} 报警
</span> </span>
<span v-else-if="scope.row.zt == '二级报警'" style="color: #e23434;"> <span v-else style="color: #000">
{{ scope.row.zt }}
</span>
<span v-else>
{{ scope.row.zt }} {{ scope.row.zt }}
</span> </span>
</template> </template>
@ -372,4 +369,3 @@
}; };
</script> </script>

View File

@ -95,7 +95,7 @@ export default {
], ],
password: [ password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }, { required: true, trigger: "blur", message: "请输入您的密码" },
{ min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 10 和 20 之间", trigger: "blur" },
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
], ],
confirmPassword: [ confirmPassword: [

View File

@ -36,7 +36,7 @@
<el-table-column property="ppp" label="港口" width="80" /> <el-table-column property="ppp" label="港口" width="80" />
<el-table-column property="pp" label="港区" width="130" /> <el-table-column property="pp" label="港区" width="130" />
<el-table-column property="p" label="公司" show-overflow-tooltip /> <el-table-column property="p" label="公司" show-overflow-tooltip />
<el-table-column property="name" label="名称" show-overflow-tooltip /> <!-- <el-table-column property="name" label="名称" show-overflow-tooltip /> -->
<el-table-column property="sn" label="编号" show-overflow-tooltip /> <el-table-column property="sn" label="编号" show-overflow-tooltip />
<el-table-column <el-table-column
property="address" property="address"

View File

@ -116,15 +116,7 @@ export default {
dealUser: this.userList[0].userName, dealUser: this.userList[0].userName,
}; };
addAlarm(data).then((res) => {
if (res.code == 200) {
this.$message.success("分配修复任务成功!");
this.handleClose();
bus.$emit("msgReaded");
} else {
this.$message.success("分配修复任务失败!");
}
});
} }
}); });
}, },

View File

@ -0,0 +1,25 @@
<template>
<div></div>
</template>
<script>
export default {
name: "SingleSign",
data() {
return {
redirect: undefined
};
},
created() {
this.singleSign();
},
methods: {
singleSign() {
const { userName, password = "123456" } = this.$route.query;
this.$store.dispatch("SingleSign", { userName, password }).finally(() => {
this.$router.push({ path: "/" }).catch(()=>{});
});
},
}
};
</script>

View File

@ -374,7 +374,22 @@ export default {
dicts: ['sys_normal_disable', 'sys_user_sex'], dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect }, components: { Treeselect },
data() { data() {
const equalToPassword1 = (rule, value, callback) => {
let password = this.form.password
let hasUpperCase = /[A-Z]/.test(password);
let hasLowerCase = /[a-z]/.test(password);
let hasNumber = /[0-9]/.test(password);
let hasSpecialCharacter = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password);
if (!hasUpperCase || !hasLowerCase || !hasNumber || !hasSpecialCharacter) {
callback(new Error("密码10位以上请包含大小写、特殊字符以及数字"));
}
else {
callback();
}
};
return { return {
// //
loading: true, loading: true,
// //
@ -455,8 +470,9 @@ export default {
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" }, { required: true, validator: equalToPassword1, trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, // { required: true, message: "", trigger: "blur" },
{ min: 10, max: 20, message: '用户密码长度必须介于 10 和 20 之间', trigger: 'blur' },
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
], ],
email: [ email: [
@ -590,7 +606,8 @@ export default {
this.roleOptions = response.roles; this.roleOptions = response.roles;
this.open = true; this.open = true;
this.title = "添加用户"; this.title = "添加用户";
this.form.password = this.initPassword; // this.form.password = this.initPassword;
this.form.password ='Gkjt123...';
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
@ -614,18 +631,23 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
closeOnClickModal: false, closeOnClickModal: false,
inputPattern: /^.{5,20}$/, inputPattern: /^.{10,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", inputErrorMessage: "密码长度10-20位包含大小写、数字以及特殊字符"
inputValidator: (value) => {
if (/<|>|"|'|\||\\/.test(value)) {
return "不能包含非法字符:< > \" ' \\\ |"
}
},
}).then(({ value }) => { }).then(({ value }) => {
let password = value
let hasUpperCase = /[A-Z]/.test(password);
let hasLowerCase = /[a-z]/.test(password);
let hasNumber = /[0-9]/.test(password);
let hasSpecialCharacter = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password);
if (!hasUpperCase || !hasLowerCase || !hasNumber || !hasSpecialCharacter) {
this.$message.error("密码不符合要求密码长度10-20位包含大小写、数字以及特殊字符");
} else {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value); this.$modal.msgSuccess("密码修改成功!");
}); });
}).catch(() => {}); }
}).catch(() => { });
}, },
/** 分配角色操作 */ /** 分配角色操作 */
handleAuthRole: function(row) { handleAuthRole: function(row) {

View File

@ -36,6 +36,7 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`, target: `http://localhost:8080`,
// target: `http://10.167.96.13/prod-api`,
// target: `http://218.58.79.146:13081/prod-api/`, // target: `http://218.58.79.146:13081/prod-api/`,
//target: `http://218.58.79.146:13080/prod-api/`, //target: `http://218.58.79.146:13080/prod-api/`,
changeOrigin: true, changeOrigin: true,