修改所属泵站和权限

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.github.pagehelper.PageInfo;
import com.sipai.entity.base.Result; import com.sipai.entity.base.Result;
import com.sipai.entity.sparepart.Sewage; import com.sipai.entity.sparepart.Sewage;
import com.sipai.entity.user.ProcessSection;
import com.sipai.entity.user.Unit; import com.sipai.entity.user.Unit;
import com.sipai.entity.user.User; import com.sipai.entity.user.User;
import com.sipai.service.sparepart.SewageService; 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")+"%' ) "; 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()) { 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()) { if (request.getParameter("city")!= null && !request.getParameter("city").isEmpty()) {
wherestr += " and city like '%"+request.getParameter("city")+"%'"; wherestr += " and city like '%"+request.getParameter("city")+"%'";
@ -192,6 +199,31 @@ public class SewageController {
return "result"; 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") @RequestMapping("/view.do")
public String doview(HttpServletRequest request,Model model, public String doview(HttpServletRequest request,Model model,
@ -222,7 +254,13 @@ public class SewageController {
wherestr += " and city like '%"+request.getParameter("search_name1")+"%'"; wherestr += " and city like '%"+request.getParameter("search_name1")+"%'";
} }
if (request.getParameter("processSectionId")!= null && !request.getParameter("processSectionId").isEmpty()) { 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); List<Sewage> list = this.sewageService.selectListByWhere(wherestr+orderstr);

View File

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

View File

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

View File

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

View File

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

View File

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