bug
This commit is contained in:
@ -242,11 +242,20 @@ public class ProcessSectionController {
|
||||
@RequestMapping("/getProcessSection4Select.do")
|
||||
public String getProcessSection4Select(HttpServletRequest request, Model model) {
|
||||
String companyId = request.getParameter("companyId"); // 默认查询JSBZ???
|
||||
// 使用unitService获取Unit信息,因为companyId来自tb_unit表
|
||||
// companyId在不同页面可能来自tb_unit或tb_company,统一兼容两种来源
|
||||
Unit unit = this.unitService.getUnitById(companyId);
|
||||
String unitType = null;
|
||||
if (unit != null) {
|
||||
unitType = unit.getType();
|
||||
} else if (companyId != null && !companyId.isEmpty()) {
|
||||
Company company = this.unitService.getCompById(companyId);
|
||||
if (company != null) {
|
||||
unitType = company.getType();
|
||||
}
|
||||
}
|
||||
|
||||
String wherestr = "where 1=1 and active='" + CommString.Active_True + "' ";
|
||||
if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司
|
||||
if (CommString.UNIT_TYPE_COMPANY.equals(unitType)) { // "C";//公司
|
||||
String bizs = "";//公司下属所有厂id
|
||||
List<Unit> blist = this.unitService.getParentCompanyChildrenBizByUnitid(companyId);
|
||||
if (blist != null && blist.size() > 0) {
|
||||
@ -258,7 +267,7 @@ public class ProcessSectionController {
|
||||
}
|
||||
bizs = bizs.replace(",", "','");
|
||||
wherestr += " and (unit_id='" + ProcessSection.UnitId_Sys + "' or (code not in (select code from tb_process_section where unit_id='" + ProcessSection.UnitId_Sys + "')) and unit_id in ('" + bizs + "') ) ";
|
||||
} else if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_BIZ)) { // B 水厂
|
||||
} else if (CommString.UNIT_TYPE_BIZ.equals(unitType)) { // B 水厂
|
||||
wherestr += " and unit_id='" + companyId + "' ";
|
||||
}
|
||||
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
|
||||
@ -273,13 +282,16 @@ public class ProcessSectionController {
|
||||
for (int i = 0; i < processSections.size(); i++) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", processSections.get(i).getCode());
|
||||
if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司
|
||||
if (CommString.UNIT_TYPE_COMPANY.equals(unitType)) { // "C";//公司
|
||||
if (!processSections.get(i).getUnitId().equals(ProcessSection.UnitId_Sys)) {
|
||||
jsonObject.put("text", processSections.get(i).getSname() + "(" + processSections.get(i).getCompanySname() + ")");
|
||||
} else {
|
||||
jsonObject.put("text", processSections.get(i).getSname());
|
||||
}
|
||||
} else if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_BIZ)) { // "B";//水厂
|
||||
} else if (CommString.UNIT_TYPE_BIZ.equals(unitType)) { // "B";//水厂
|
||||
jsonObject.put("text", processSections.get(i).getSname());
|
||||
} else {
|
||||
// 兜底,避免前端下拉出现有id无text导致显示为空
|
||||
jsonObject.put("text", processSections.get(i).getSname());
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
@ -17,6 +18,7 @@
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.select2-selection__arrow {
|
||||
margin-top: 3px;
|
||||
}
|
||||
@ -37,7 +39,11 @@ var companyId = "";
|
||||
});
|
||||
};
|
||||
var viewEquipmentFun = function (equipmentName, equipmentCardID, id) {
|
||||
$.post(ext.contextPath + '/equipment/viewEquipmentCard.do', {equipmentName:equipmentName,equipmentCardID:equipmentCardID,id:id} , function(data) {
|
||||
$.post(ext.contextPath + '/equipment/viewEquipmentCard.do', {
|
||||
equipmentName: equipmentName,
|
||||
equipmentCardID: equipmentCardID,
|
||||
id: id
|
||||
}, function (data) {
|
||||
$("#subEquipmentDiv").html(data);
|
||||
openModal('subEquipmentModal');
|
||||
});
|
||||
@ -147,12 +153,46 @@ var companyId = "";
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
var loadProcessSectionSelect = function (bizId) {
|
||||
if (!bizId) {
|
||||
refreshSelect();
|
||||
return;
|
||||
}
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: bizId}, function (data) {
|
||||
$("#processSection").empty();
|
||||
var selelct_ = $("#processSection").select2({
|
||||
data: data,
|
||||
cache: false,
|
||||
placeholder: '请选择',
|
||||
allowClear: true,
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
},
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,
|
||||
formatResult: function formatRepo(repo) {
|
||||
return repo.text;
|
||||
},
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
return repo.text;
|
||||
}
|
||||
});
|
||||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
||||
selelct_.val('').trigger("change");
|
||||
selelct_.off("change").on("change", function () {
|
||||
dosearch();
|
||||
});
|
||||
}, 'json');
|
||||
};
|
||||
var refreshSelect = function () {
|
||||
var selelct_ = $("#processSection").select2({
|
||||
data: null,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
@ -170,40 +210,33 @@ var companyId = "";
|
||||
$("#search_code").css("display", "none");
|
||||
$("#company").text(data[0].text);
|
||||
companyId = data[0].id;
|
||||
loadProcessSectionSelect(companyId);
|
||||
dosearch();
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||||
$("#processSection").empty();
|
||||
var selelct_ =$("#processSection").select2({
|
||||
data: data,
|
||||
cache : false,
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
|
||||
selelct_.val('').trigger("change");
|
||||
selelct_.on("change",function(e){
|
||||
dosearch();
|
||||
});
|
||||
|
||||
},'json');
|
||||
} else {
|
||||
// 当前页面可能不展示厂区下拉(search_code被注释),兜底按当前厂区/首个厂区加载工艺段
|
||||
if ($("#search_code").length == 0) {
|
||||
companyId = (typeof unitId !== "undefined" && unitId) ? unitId : data[0].id;
|
||||
loadProcessSectionSelect(companyId);
|
||||
dosearch();
|
||||
return;
|
||||
}
|
||||
$("#company").css("display", "none");
|
||||
var selelct = $("#search_code").select2({
|
||||
data: data,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
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;} // 函数用于呈现当前的选择
|
||||
formatResult: function formatRepo(repo) {
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
return repo.text;
|
||||
} // 函数用于呈现当前的选择
|
||||
});
|
||||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
|
||||
selelct.val('').trigger("change");
|
||||
@ -212,26 +245,7 @@ var companyId = "";
|
||||
companyId = $(this).val();
|
||||
dosearch();
|
||||
refreshSelect();
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||||
$("#processSection").empty();
|
||||
var selelct_ =$("#processSection").select2({
|
||||
data: data,
|
||||
cache : false,
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
|
||||
selelct_.val('').trigger("change");
|
||||
selelct_.on("change",function(e){
|
||||
dosearch();
|
||||
});
|
||||
},'json');
|
||||
loadProcessSectionSelect(companyId);
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
@ -252,7 +266,7 @@ var companyId = "";
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
companyId: unitId,
|
||||
companyId: companyId,
|
||||
pSectionId: $("#processSection").val(),
|
||||
}
|
||||
},
|
||||
@ -354,23 +368,30 @@ var companyId = "";
|
||||
<div class="form-group form-inline">
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<security:authorize buttonUrl="work/scadaPic/add.do">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
|
||||
class="fa fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
|
||||
class="fa fa-trash-o"></i> 删除
|
||||
</button>
|
||||
</security:authorize>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group pull-right">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="编号">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="编号">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group pull-right">
|
||||
<label class="form-label">工艺段</label>
|
||||
<select class="form-control select2 " id="processSection" name ="processSection" style="width: 220px;"></select>
|
||||
<select class="form-control select2 " id="processSection" name="processSection"
|
||||
style="width: 220px;"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -378,7 +399,6 @@ var companyId = "";
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
@ -395,12 +415,16 @@ document.write("<scr"+"ipt src=\"<%=request.getContextPath()%>/node_modules/boot
|
||||
document.write("<scr" + "ipt src=\"<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js\"></sc" + "ript>")
|
||||
</script>
|
||||
<!-- 引入ChartJS-->
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.bundle.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/chart.js/dist/Chart.bundle.min.js"
|
||||
charset="utf-8"></script>
|
||||
<!-- 引入daterangepicker-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
|
||||
charset="utf-8"></script>
|
||||
<!-- echarts-->
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/echarts.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/macarons.js" charset="utf-8"></script>
|
||||
|
||||
Reference in New Issue
Block a user