修改所属泵站和权限

This commit is contained in:
2026-03-05 10:18:06 +08:00
parent 96605402a5
commit 26031a77da
6 changed files with 127 additions and 102 deletions

View File

@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sipai.entity.base.Result;
import com.sipai.entity.sparepart.Sewage;
import com.sipai.entity.user.ProcessSection;
import com.sipai.entity.user.Unit;
import com.sipai.entity.user.User;
import com.sipai.service.sparepart.SewageService;
@ -85,7 +86,13 @@ public class SewageController {
wherestr += " and (contract_number like '%"+request.getParameter("search_name")+"%' or name like '%"+request.getParameter("search_name")+"%' ) ";
}
if (request.getParameter("processSectionId")!= null && !request.getParameter("processSectionId").isEmpty()) {
wherestr += " and process_section_id = '"+request.getParameter("processSectionId")+"'";
String processSectionId = request.getParameter("processSectionId");
ProcessSection processSection = this.processSectionService.selectById(processSectionId);
if (processSection != null) {
wherestr += " and (process_section_id = '" + processSectionId + "' or process_section_id = '" + processSection.getCode() + "')";
} else {
wherestr += " and process_section_id = '"+processSectionId+"'";
}
}
if (request.getParameter("city")!= null && !request.getParameter("city").isEmpty()) {
wherestr += " and city like '%"+request.getParameter("city")+"%'";
@ -192,6 +199,31 @@ public class SewageController {
return "result";
}
/**
* 排污源页面专用泵站下拉value 使用 process_section.id避免前端提交 code 导致无法正确保存/查询
*/
@RequestMapping("/getProcessSectionId4Select.do")
public ModelAndView getProcessSectionId4Select(HttpServletRequest request, Model model) {
String companyId = request.getParameter("companyId");
String wherestr = "where 1=1 and active='1' ";
if (companyId != null && !companyId.isEmpty()) {
wherestr += " and unit_id = '" + companyId + "' ";
}
wherestr += " order by code asc";
List<ProcessSection> processSections = this.processSectionService.selectListByWhere(wherestr);
JSONArray jsonArray = new JSONArray();
if (processSections != null && processSections.size() > 0) {
for (ProcessSection processSection : processSections) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", processSection.getId());
jsonObject.put("text", processSection.getSname() == null ? processSection.getName() : processSection.getSname());
jsonArray.add(jsonObject);
}
}
model.addAttribute("result", jsonArray.toString());
return new ModelAndView("result");
}
@RequestMapping("/view.do")
public String doview(HttpServletRequest request,Model model,
@ -222,7 +254,13 @@ public class SewageController {
wherestr += " and city like '%"+request.getParameter("search_name1")+"%'";
}
if (request.getParameter("processSectionId")!= null && !request.getParameter("processSectionId").isEmpty()) {
wherestr += " and process_section_id = '"+request.getParameter("processSectionId")+"'";
String processSectionId = request.getParameter("processSectionId");
ProcessSection processSection = this.processSectionService.selectById(processSectionId);
if (processSection != null) {
wherestr += " and (process_section_id = '" + processSectionId + "' or process_section_id = '" + processSection.getCode() + "')";
} else {
wherestr += " and process_section_id = '"+processSectionId+"'";
}
}
List<Sewage> list = this.sewageService.selectListByWhere(wherestr+orderstr);

View File

@ -46,14 +46,30 @@ public class SewageService implements CommService<Sewage>{
@Resource
private JsywPointService jsywPointService;
private ProcessSection getProcessSectionByStoredValue(String processSectionValue) {
if (processSectionValue == null || processSectionValue.isEmpty()) {
return null;
}
ProcessSection processSection = this.processSectionService.selectById(processSectionValue);
if (processSection != null) {
return processSection;
}
List<ProcessSection> processSectionList = this.processSectionService.selectListByWhere(
"where code = '" + processSectionValue + "' and unit_id = 'JSBZ'");
if (processSectionList != null && processSectionList.size() > 0) {
return processSectionList.get(0);
}
return null;
}
@Override
public Sewage selectById(String id) {
Sewage sewage = SewageDao.selectByPrimaryKey(id);
sewage.setCompany(this.unitService.getCompById(sewage.getUnitId()));
List<ProcessSection> processSectionList = this.processSectionService.selectListByWhere("where code = '"+sewage.getProcessSectionId()+"' and unit_id = 'JSBZ'");
if (processSectionList.size()>0) {
sewage.setProcessSection(processSectionList.get(0));
ProcessSection processSection = this.getProcessSectionByStoredValue(sewage.getProcessSectionId());
if (processSection != null) {
sewage.setProcessSection(processSection);
}
List<SewageInput> sewageInputList = this.sewageInputService.selectListByWhere("where sewage_id='"+sewage.getContractNumber()+"' order by insdt");
if(sewageInputList!=null && sewageInputList.size()>0){
@ -92,9 +108,9 @@ public class SewageService implements CommService<Sewage>{
List<Sewage> list = SewageDao.selectListByWhere(sewage);
for (Sewage item : list) {
item.setCompany(this.unitService.getCompById(item.getUnitId()));
List<ProcessSection> processSectionList = this.processSectionService.selectListByWhere("where code = '"+item.getProcessSectionId()+"' and unit_id = 'JSBZ'");
if (processSectionList.size()>0) {
item.setProcessSection(processSectionList.get(0));
ProcessSection processSection = this.getProcessSectionByStoredValue(item.getProcessSectionId());
if (processSection != null) {
item.setProcessSection(processSection);
}
List<SewageInput> sewageInputList = this.sewageInputService.selectListByWhere4Pure("where sewage_id='"+item.getContractNumber()+"' order by insdt");
if(sewageInputList!=null && sewageInputList.size()>0){

View File

@ -23,35 +23,25 @@
}
},'json');
}
}
}
function getProcessSectionFun() {
var selectType = $("#processsectionCode").select2({minimumResultsForSearch: 10})
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: "JSBZ"}, function (data) {
$("#processsectionCode").empty();
var selelct_ = $("#processsectionCode").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过10个启用搜索框
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
var $processSection = $("#processsectionCode");
// 弹窗内该字段使用原生select规避select2在部分环境下无法点选的问题
if ($processSection.hasClass("select2-hidden-accessible")) {
$processSection.select2("destroy");
}
$processSection.removeClass("select2-hidden-accessible").removeAttr("data-select2-id").show();
$processSection.next(".select2").remove();
$.post(ext.contextPath + "/sparepart/sewage/getProcessSectionId4Select.do", {companyId: "JSBZ"}, function (data) {
$processSection.empty();
if (typeof data === "string") {
try { data = JSON.parse(data); } catch (e) { data = []; }
}
$processSection.append('<option value="">请选择</option>');
$.each(data || [], function (idx, item) {
$processSection.append('<option value="' + item.id + '">' + item.text + '</option>');
});
selelct_.val('').trigger("change");
selelct_.on('change', function (e) {
$('#processSectionId').val(e.target.value);
//给设备编码(工艺段部分)赋值
// var name = $("#processsectionCode").find("option:selected").text();
// $('#processsectionCodeAuto').val(getParenthesesStr(name));
})
$processSection.val('');
}, 'json');
}
//输入框验证
@ -165,10 +155,8 @@
</div>
<label class="col-sm-2 control-label">所属泵站</label>
<div class="col-sm-4">
<select class="form-control select2" id="processsectionCode" name="processsectionCode"
<select class="form-control" id="processsectionCode" name="processSectionId"
style="width: 170px;"></select>
<input type="hidden" class="form-control" id="processSectionId" name="processSectionId"
value=""/>
</div>
</div>

View File

@ -33,35 +33,26 @@
}
},'json');
}
}
}
function getProcessSectionFun() {
var selectType = $("#processsectionCode").select2({minimumResultsForSearch: 10})
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: "JSBZ"}, function (data) {
$("#processsectionCode").empty();
var selelct_ = $("#processsectionCode").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过10个启用搜索框
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
var $processSection = $("#processsectionCode");
var selectedProcessSectionId = "${not empty sewage.processSection ? sewage.processSection.id : sewage.processSectionId}";
// 弹窗内该字段使用原生select规避select2在部分环境下无法点选的问题
if ($processSection.hasClass("select2-hidden-accessible")) {
$processSection.select2("destroy");
}
$processSection.removeClass("select2-hidden-accessible").removeAttr("data-select2-id").show();
$processSection.next(".select2").remove();
$.post(ext.contextPath + "/sparepart/sewage/getProcessSectionId4Select.do", {companyId: "JSBZ"}, function (data) {
$processSection.empty();
if (typeof data === "string") {
try { data = JSON.parse(data); } catch (e) { data = []; }
}
$processSection.append('<option value="">请选择</option>');
$.each(data || [], function (idx, item) {
$processSection.append('<option value="' + item.id + '">' + item.text + '</option>');
});
selelct_.val("${sewage.processSectionId}").trigger("change");
selelct_.on('change', function (e) {
$('#processSectionId').val(e.target.value);
//给设备编码(工艺段部分)赋值
// var name = $("#processsectionCode").find("option:selected").text();
// $('#processsectionCodeAuto').val(getParenthesesStr(name));
})
$processSection.val(selectedProcessSectionId);
}, 'json');
}
//输入框验证
@ -171,9 +162,8 @@
</div>
<label class="col-sm-2 control-label">所属泵站</label>
<div class="col-sm-4">
<select class="form-control select2" id="processsectionCode" name="processsectionCode"
<select class="form-control" id="processsectionCode" name="processSectionId"
style="width: 170px;"></select>
<input type="hidden" class="form-control" id="processSectionId" name="processSectionId" value="${sewage.processSectionId}"/>
</div>
</div>

View File

@ -174,24 +174,26 @@
// dosearch();
// });
//选择工艺段
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:"JSBZ"}, function(data) {
$("#processSection").empty();
var selelct_ =$("#processSection").select2({
data: data,
placeholder:'请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
});
selelct_.val("").trigger("change");
selelct_.on("change",function(e){
//选择工艺段使用原生select并直接返回process_section.id避免select2/编码值导致无法选择或查询失效
$.post(ext.contextPath + "/sparepart/sewage/getProcessSectionId4Select.do", {companyId:"JSBZ"}, function(data) {
var $processSection = $("#processSection");
if ($processSection.hasClass("select2-hidden-accessible")) {
$processSection.select2("destroy");
}
$processSection.removeClass("select2-hidden-accessible").removeAttr("data-select2-id").show();
$processSection.next(".select2").remove();
$processSection.empty();
if (typeof data === "string") {
try { data = JSON.parse(data); } catch (e) { data = []; }
}
$processSection.append('<option value="">请选择</option>');
$.each(data || [], function (idx, item) {
$processSection.append('<option value="' + item.id + '">' + item.text + '</option>');
});
$processSection.val("");
$processSection.off("change.sewageSearch").on("change.sewageSearch", function(){
dosearch();
});
});
},'json');
//选择工艺段
$.post(ext.contextPath + "/sparepart/sewage/getSewageCity4Select.do", {unitId: unitId}, function(data) {
@ -432,9 +434,9 @@
<select class="form-control select2" id="type_name1" name ="type_name1" style="width: 160px;">
</select>
</div> -->
<div class="input-group input-group-sm pull-left">
<label class="form-label " >所属泵站:</label>
<select id ="processSection" class="form-control select2 " style="width: 180px;">
<div class="form-group pull-left" style="margin-right: 10px;">
<label class="form-label " style="margin-right: 6px;">所属泵站:</label>
<select id ="processSection" class="form-control" style="width: 180px; display: inline-block; float: none; vertical-align: middle;">
</select>
</div>
<!-- <div class="input-group input-group-sm" style="width: 250px;">
@ -486,4 +488,4 @@
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/JS/commonFileUpload.js" charset="utf-8"></script>
</html>
</html>

View File

@ -3,21 +3,12 @@
function doSaveMainRole() {
var checkedtree = $('#menu_func_tree').treeview('getChecked');
var datas = "";
var lis = $('[data-nodeid]');
for (var i = 0; i < lis.length; i++) {
if (lis[i].dataset.nodeid.split('.').length == 4) {
var lis_element = $('#' + lis[i].id);
if (lis_element.hasClass('node-checked')) {
var span = lis_element.children('.check-icon');
if (span.hasClass('glyphicon-check')) {
datas += lis[i].id + ",";
}
}
$.each(checkedtree, function (index, item) {
// 只保存最终菜单节点,避免依赖固定树层级导致勾选后无法落库
if (!item.nodes || item.nodes.length === 0) {
datas += item.id + ",";
}
}
/*$.each(checkedtree,function(index,item){
datas+=item.id+",";
});*/
});
$.post(ext.contextPath + "/user/updateRoleMenu.do", {menustr: datas, roleid: "${roleid}"}, function (result) {
if (result >= 0) {
closeModal('menuFuncModal');