增加DOE分析-表头固定,筛选两个功能

This commit is contained in:
kingsfighter 2020-09-19 15:15:23 +08:00
parent 214f074628
commit 2391a297b3
3 changed files with 91 additions and 35 deletions

View File

@ -2,10 +2,6 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('DOE分析')" /> <th:block th:include="include :: header('DOE分析')" />
<!--<link href="https://unpkg.com/bootstrap-table@1.17.1/dist/bootstrap-table.min.css" rel="stylesheet">-->
<!--<script src="https://unpkg.com/bootstrap-table@1.17.1/dist/bootstrap-table.min.js"></script>-->
<!--<script src="https://unpkg.com/bootstrap-table@1.17.1/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>-->
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
@ -35,9 +31,13 @@
</form> </form>
</div> </div>
<div id="search-result-div" class="col-sm-12 select-table table-striped" style="overflow: scroll;height:90%;"> <div id="search-result-div1" class="col-sm-12 select-table table-striped" style="overflow: scroll;height:90%;">
<table id="search-result-keyparam-table"></table> <table id="search-result-keyparam-table" class="table table-striped table-fixed-header" data-filter-control="true"
<table id="search-result-rework-table" style="display: none"></table> data-filter-show-clear="true" ></table>
</div>
<div id="search-result-div2" class="col-sm-12 select-table table-striped" style="overflow: scroll;height:90%; display: none;">
<table id="search-result-rework-table" class="table table-striped table-fixed-header" data-filter-control="true"
data-filter-show-clear="true"></table>
</div> </div>
</div> </div>
<div class="row" style="height: 50%;"> <div class="row" style="height: 50%;">
@ -58,7 +58,7 @@
</div> </div>
<div id="calculate-result-div" class="col-sm-12 select-table table-striped" style="overflow: scroll;height:80%;"> <div id="calculate-result-div" class="col-sm-12 select-table table-striped" style="overflow: scroll;height:80%;">
<table id="calculate-result-table" style="display: none"></table> <table id="calculate-result-table" class="table table-striped table-fixed-header" data-height="300" style="display: none"></table>
</div> </div>
</div> </div>
</div> </div>
@ -71,18 +71,31 @@
var currentVersion = ""; var currentVersion = "";
$(document).ready(function(){ $(document).ready(function(){
initKeyParamTable();
initReworkTable(); var divHeight = $("#search-result-div1").height() - 40;
$("#search-result-rework-table").hide(); initKeyParamTable(divHeight);
initReworkTable(divHeight);
$("#search-result-div2").hide();
initCalculateResultTable(); initCalculateResultTable();
$("#calculate-result-table").hide(); $("#calculate-result-table").hide();
}); });
//onmouseup松开鼠标时执行
//模拟鼠标滚动事件,以实现横向滚动条的移动,表头跟数据对应
function onmouseUP(){
var scrollTop = document.getElementsByTagName("body")[0].scrollTop;
scrollTop -= 10;
// $(".table-fixed-header").fixedHeader();
//alert(scrollTop)
}
function initKeyParamTable() {
function initKeyParamTable(divHeight) {
var options = { var options = {
sortName: "roleSort", sortName: "roleSort",
pagination: false, pagination: false,
modalName: "DOE分析-关键工艺参数", modalName: "DOE分析-关键工艺参数",
height: divHeight,
filterControl: true,
columns: [ columns: [
{ {
checkbox: true checkbox: true
@ -98,59 +111,79 @@
{ {
field: 'keyparamtype', field: 'keyparamtype',
title: '规则名', title: '规则名',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'refdes', field: 'refdes',
title: '位号', title: '位号',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'keyparttype', field: 'keyparttype',
title: '器件类型', title: '器件类型',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'relativerefdes', field: 'relativerefdes',
title: '关联位号', title: '关联位号',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'relativeparttype', field: 'relativeparttype',
title: '关联类型', title: '关联类型',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'measurementvalue', field: 'measurementvalue',
title: '测量值', title: '测量值',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'checkvalue', field: 'checkvalue',
title: '规则值', title: '规则值',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'isRework', field: 'isRework',
title: '是否维修', title: '是否维修',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'defecttype', field: 'defecttype',
title: '维修类型关联', title: '维修类型关联',
sortable: false sortable: false,
filterControl: 'select'
} }
] ]
}; };
$("#search-result-keyparam-table").bootstrapTable(options); $("#search-result-keyparam-table").bootstrapTable(options);
//固定表头
$("#search-result-keyparam-table").on("post-body.bs.table",function(){
//alert(1);
$("#search-result-keyparam-table thead").addClass("header");
// $(".table-fixed-header").fixedHeader();
onmouseUP();
});
} }
function initReworkTable() { function initReworkTable(divHeight) {
var options = { var options = {
sortName: "roleSort", sortName: "roleSort",
pagination: false, pagination: false,
modalName: "DOE分析-关键工艺参数", modalName: "DOE分析-关键工艺参数",
filterControl: true,
height: divHeight,
columns: [ columns: [
{ {
checkbox: true checkbox: true
@ -166,36 +199,49 @@
{ {
field: 'refdes', field: 'refdes',
title: '位号', title: '位号',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'defecttype', field: 'defecttype',
title: '维修类型', title: '维修类型',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'isRelativeKeyParam', field: 'isRelativeKeyParam',
title: '是否关联关键工艺参数', title: '是否关联关键工艺参数',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'keyparamtype', field: 'keyparamtype',
title: '规则名', title: '规则名',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'measurementvalue', field: 'measurementvalue',
title: '测量值', title: '测量值',
sortable: false sortable: false,
filterControl: 'select'
}, },
{ {
field: 'checkvalue', field: 'checkvalue',
title: '规则值', title: '规则值',
sortable: false sortable: false,
filterControl: 'select'
} }
] ]
}; };
$("#search-result-rework-table").bootstrapTable(options); $("#search-result-rework-table").bootstrapTable(options);
//固定表头
$("#search-result-rework-table").on("post-body.bs.table",function(){
//alert(1);
$("#search-result-rework-table thead").addClass("header");
// $(".table-fixed-header").fixedHeader();
onmouseUP();
});
} }
function fillKeyParamTable(data) { function fillKeyParamTable(data) {
@ -223,12 +269,12 @@
currentVersion = $("#version").val(); currentVersion = $("#version").val();
if("keyParam"== dataType) { if("keyParam"== dataType) {
fillKeyParamTable(json); fillKeyParamTable(json);
$("#search-result-rework-table").hide(); $("#search-result-div2").hide();
$("#search-result-keyparam-table").show(); $("#search-result-div1").show();
} else { } else {
fillReworkTable(json); fillReworkTable(json);
$("#search-result-keyparam-table").hide(); $("#search-result-div1").hide();
$("#search-result-rework-table").show(); $("#search-result-div2").show();
} }
} }
}); });
@ -353,6 +399,13 @@
}; };
$("#calculate-result-table").bootstrapTable(options); $("#calculate-result-table").bootstrapTable(options);
$("#calculate-result-table").show(); $("#calculate-result-table").show();
//固定表头
$("#calculate-result-table").on("post-body.bs.table",function(){
//alert(1);
$("#calculate-result-table thead").addClass("header");
// $(".table-fixed-header").fixedHeader();
onmouseUP();
});
} }
function doeSave() { function doeSave() {
@ -386,5 +439,7 @@
</script> </script>
<!--<script src="https://unpkg.com/bootstrap-table@1.17.1/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>-->
<script type="text/javascript" th:src="@{/ajax/libs/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.min.js}" th:inline="none"></script>
</body> </body>
</html> </html>

View File

@ -25,7 +25,7 @@
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script> <script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script> <script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727}"></script> <script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727}"></script>
<!--<script th:src="@{/ajax/libs/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.min.js?v=20200727"></script>--> <!--<script th:src="@{/ajax/libs/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.min.js?v=20200727}" ></script>-->
<!-- jquery-validate 表单验证插件 --> <!-- jquery-validate 表单验证插件 -->
<script th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script> <script th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
<script th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script> <script th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>

View File

@ -56,11 +56,12 @@ public class DoeAnalysisService {
JSONObject jsonObj = ((JSONObject)obj); JSONObject jsonObj = ((JSONObject)obj);
String defecttypes = jsonObj.getString("defecttype"); String defecttypes = jsonObj.getString("defecttype");
if(StringUtils.isEmpty(defecttypes)) { if(StringUtils.isEmpty(defecttypes)) {
newJSONArray.add(obj); newJSONArray.add(jsonObj);
} else { } else {
String[] defecttypeArr = defecttypes.split(","); String[] defecttypeArr = defecttypes.split(",");
for (String defecttype : defecttypeArr) { for (String defecttype : defecttypeArr) {
JSONObject newObj = new JSONObject(jsonObj); JSONObject newObj = new JSONObject();
newObj.putAll(jsonObj);
newObj.put("defecttype", defecttype); newObj.put("defecttype", defecttype);
newJSONArray.add(newObj); newJSONArray.add(newObj);
} }