change - 监控单元类型中的添加功能,类型编号是可以重复的。改进-出现重复提示不能添加

main
wenjy 3 years ago
parent 10b8264fe5
commit c3c7f534d5

@ -4,10 +4,13 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.system.domain.BaseSensorInfo;
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
import com.ruoyi.system.service.IBaseMonitorunitInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -182,4 +185,14 @@ public class BaseMonitorunitTypeController extends BaseController {
}
return ztrees;
}
@PostMapping("/checkUnitTypeIdUnique")
@ResponseBody
public String checkMonitorUnitTypeIdUnique(BaseMonitorunitType baseMonitorunitType){
List<BaseMonitorunitType> baseMonitorunitTypes = baseMonitorunitTypeService.selectBaseMonitorunitTypeList(baseMonitorunitType);
if(baseMonitorunitTypes.size() > 0){
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;
}
}

@ -113,6 +113,13 @@ public class BaseSubstationInfoController extends BaseController {
return toAjax(baseSubstationInfoService.deleteBaseSubstationInfoByObjIds(ids));
}
/**
*
* @author WenJY
* @date 2022/4/26 21:19
* @param baseSubstationInfo
* @return java.lang.String
*/
@PostMapping("/checkSubstationIdIdUnique")
@ResponseBody
public String checkSubstationIdIdUnique(BaseSubstationInfo baseSubstationInfo){

@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">监控单元类型编号:</label>
<div class="col-sm-8">
<input name="monitorunittypeId" class="form-control" type="text">
<input id="monitorunittypeId" name="monitorunittypeId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
@ -32,6 +32,29 @@
<script th:inline="javascript">
var prefix = ctx + "base/monitorUnitType"
$("#form-monitorUnitType-add").validate({
onkeyup: false,
rules:{
monitorunittypeId:{
remote: {
url: prefix + "/checkUnitTypeIdUnique",
type: "post",
dataType: "json",
data: {
"monitorunittypeId": function() {
return $("input[name='monitorunittypeId']").val();
},
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"monitorunittypeId": {
remote: "编号已存在"
}
},
focusCleanup: true
});

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

Loading…
Cancel
Save