change - 传感器报警类型和变电站信息中出现同样的类型编号,编号类型添加支持校验是否重复

main
wenjy 3 years ago
parent c29f1dc5bc
commit 10b8264fe5

@ -3,7 +3,10 @@ package com.ruoyi.web.controller.base;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.BaseSensorInfo;
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -165,4 +168,22 @@ public class BaseAlarmTypeController extends BaseController
List<Ztree> ztrees = baseAlarmTypeService.selectBaseAlarmTypeTree(); List<Ztree> ztrees = baseAlarmTypeService.selectBaseAlarmTypeTree();
return ztrees; return ztrees;
} }
/**
*
* @author WenJY
* @date 2022/4/26 21:05
* @param baseAlarmType
* @return java.lang.String
*/
@PostMapping("/checkAlarmTypeIdUnique")
@ResponseBody
public String checkAlarmTypeIdUnique(BaseAlarmType baseAlarmType){
List<BaseAlarmType> baseAlarmTypes = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType);
if(baseAlarmTypes.size() > 0){
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;
}
} }

@ -3,7 +3,9 @@ package com.ruoyi.web.controller.base;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.BaseAlarmType;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -110,4 +112,15 @@ public class BaseSubstationInfoController extends BaseController {
public AjaxResult remove(String ids) { public AjaxResult remove(String ids) {
return toAjax(baseSubstationInfoService.deleteBaseSubstationInfoByObjIds(ids)); return toAjax(baseSubstationInfoService.deleteBaseSubstationInfoByObjIds(ids));
} }
@PostMapping("/checkSubstationIdIdUnique")
@ResponseBody
public String checkSubstationIdIdUnique(BaseSubstationInfo baseSubstationInfo){
List<BaseSubstationInfo> baseSubstationInfos = baseSubstationInfoService.selectBaseSubstationInfoList(baseSubstationInfo);
if(baseSubstationInfos.size() > 0){
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;
}
} }

@ -42,6 +42,29 @@
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "base/alarmType" var prefix = ctx + "base/alarmType"
$("#form-alarmType-add").validate({ $("#form-alarmType-add").validate({
onkeyup: false,
rules:{
alarmtypeId:{
remote: {
url: prefix + "/checkAlarmTypeIdUnique",
type: "post",
dataType: "json",
data: {
"alarmtypeId": function() {
return $("input[name='alarmtypeId']").val();
},
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"alarmtypeId": {
remote: "编号已存在"
}
},
focusCleanup: true focusCleanup: true
}); });

@ -10,7 +10,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">报警类型编号:</label> <label class="col-sm-3 control-label">报警类型编号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="alarmtypeId" th:field="*{alarmtypeId}" class="form-control" type="text"> <input name="alarmtypeId" th:field="*{alarmtypeId}" class="form-control" type="text" readonly="true" >
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

@ -32,6 +32,29 @@
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "base/stationInfo" var prefix = ctx + "base/stationInfo"
$("#form-stationInfo-add").validate({ $("#form-stationInfo-add").validate({
onkeyup: false,
rules:{
substationId:{
remote: {
url: prefix + "/checkSubstationIdIdUnique",
type: "post",
dataType: "json",
data: {
"substationId": function() {
return $("input[name='substationId']").val();
},
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"substationId": {
remote: "编号已存在"
}
},
focusCleanup: true focusCleanup: true
}); });

@ -10,7 +10,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">变电站编号:</label> <label class="col-sm-3 control-label">变电站编号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="substationId" th:field="*{substationId}" class="form-control" type="text"> <input name="substationId" th:field="*{substationId}" class="form-control" type="text" readonly="true">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

Loading…
Cancel
Save