Commit f61e2c34 by sunxin

多选下拉框数据回显

parent 8825972e
......@@ -38,8 +38,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
/**
* 举报Controller
......@@ -562,6 +561,10 @@ public class ReportController extends BaseController {
@RequestMapping(value = "track")
public String track(ReportEntity reportEntity, HttpServletRequest request, HttpServletResponse
response, Model model) {
String oldType=""; //先记录下转换前的type id组
String oldCat=""; //先记录下转换前的cat id组
//判断登录人的角色
User user = UserUtils.getUser();
String isAdmin = reportService.checkRole(user);
......@@ -596,6 +599,7 @@ public class ReportController extends BaseController {
/*遍历集合*/
if(StringUtils.isNoneBlank(reportEntity1.getSupplementType())){
oldType=reportEntity1.getSupplementType();
String[] getSupplementTypeStr = reportEntity1.getSupplementType().split(",");
for (String str:getSupplementTypeStr) {
CtBbtcBusType ctBbtcBusType = CtBbtcBusTypeService.get(str);
......@@ -611,6 +615,7 @@ public class ReportController extends BaseController {
if(StringUtils.isNoneBlank(reportEntity1.getSupplementCategory())){
oldCat=reportEntity1.getSupplementCategory();
String[] getSupplementCategory = reportEntity1.getSupplementCategory().split(",");
for (String str:getSupplementCategory) {
CtBbtcBusCategory ctBbtcBusCategory = ctBbtcBusCategoryService.get(str);
......@@ -648,10 +653,33 @@ public class ReportController extends BaseController {
model.addAttribute("ifClue", true);
}
}
Map<String,String> typeMap=new HashMap();
if(oldType != ""){
String[] typeArr= oldType.split(",");
CtBbtcBusType ctBbtcBusType002=null;
for (String arr:typeArr) {
ctBbtcBusType002 = CtBbtcBusTypeService.get(arr);
typeMap.put(ctBbtcBusType002.getName(),arr);
}
}
Map<String,String> catgoryMap=new HashMap();
if(oldCat != ""){
String[] typeArr= oldCat.split(",");
CtBbtcBusCategory ctBbtcBusCategory002=null;
for (String arr:typeArr) {
ctBbtcBusCategory002 = ctBbtcBusCategoryService.get(arr);
catgoryMap.put(ctBbtcBusCategory002.getName(),arr);
}
}
model.addAttribute("page", page);
model.addAttribute("user", userEntity);
model.addAttribute("userName", user.getName());
model.addAttribute("report", reportEntity1);
model.addAttribute("typeMap", typeMap);
model.addAttribute("catgoryMap", catgoryMap);
model.addAttribute("companyList", companyList);
model.addAttribute("officeList", officeList);
model.addAttribute("positionList", positionList);
......
......@@ -9,8 +9,10 @@
<!--[if lte IE 6]><link href="${ctxStatic}/bootstrap/bsie/css/bootstrap-ie6.min.css" type="text/css" rel="stylesheet" /><![endif]-->
<!--[if lte IE 6]><script src="${ctxStatic}/bootstrap/bsie/js/bootstrap-ie.min.js" type="text/javascript"></script><![endif]-->
<link href="${ctxStatic}/jquery-select2/3.4/select2.min.css" rel="stylesheet" />
<script src="${ctxStatic}/jquery-select2/3.4/select2.min.js" type="text/javascript"></script>
<link href="${ctxStatic}/jquery-validation/1.11.0/jquery.validate.min.css" type="text/css" rel="stylesheet" />
<script src="${ctxStatic}/jquery-select2/3.4/select2.min.js" type="text/javascript">
</script><link href="${ctxStatic}/jquery-validation/1.11.0/jquery.validate.min.css" type="text/css" rel="stylesheet" />
<script src="${ctxStatic}/jquery-validation/1.11.0/jquery.validate.min.js" type="text/javascript"></script>
<link href="${ctxStatic}/jquery-jbox/2.3/Skins/Bootstrap/jbox.min.css" rel="stylesheet" />
<script src="${ctxStatic}/jquery-jbox/2.3/jquery.jBox-2.3.min.js" type="text/javascript"></script>
......
......@@ -4,9 +4,16 @@
<html>
<head>
<title>举报管理</title>
<script src="${ctxStatic}/common/test.js" type="text/javascript"></script>
<link href="${ctxStatic}/common/test.css" rel="stylesheet" />
<meta name="decorator" content="default"/>
<script type="text/javascript">
window.onload = function () {
var ifClue = "${report.ifClue}";
if (ifClue == '1') {
$("#ifClue").prop("checked", true);
......@@ -92,6 +99,7 @@
$("#fade").hide();
});
/*页面一加载,跟据举报集团 查询对应区域列表 业务列表 跟据业务列表查询类别列表 */
getRegion();
getType();
......@@ -99,6 +107,7 @@
getTranArea();
getBusCategory();
/* var checkedNumber = "${report.supplementType}";
if (checkedNumber != null && checkedNumber.length != 0) {
var number = checkedNumber.split(",");
......@@ -532,8 +541,7 @@
/*跟据 集团区域 查询类型*/
function getType(){
var selectNode = $("#supplementType");
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
var ts_describe1= $("#supplementGroup").val();
var ts_describe2= $("#supplementArea").val();
......@@ -548,22 +556,29 @@
if (data2 != '') {
var slsb=$("#supplementType");
for (var i = 0;i < data2.length;i++){
/* slsb.append(new Option(data1[i].name,data1[i].id) );*/
var value=data2[i].parentId;
var label=data2[i].typeName;
if(supplementType == label){
slsb.append("<option value="+value+" selected='true' >"+label+"</option>");
try {
$('#s2id_supplementType').find('.select2-chosen').html(label);
} catch (e) {
console.log(e);
if(supplementType != ''){
if(supplementType.search(label) != -1){
/*slsb.append("<option value="+value+" selected='true' >"+label+"</option>");*/
/* try {
$('#s2id_supplementType').find('.select2-choices').append(label+",");
} catch (e) {
console.log(e);
}*/
}else{
slsb.append("<option value="+value+" >"+label+"</option>");
}
}else{
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
slsb.append("<option value="+value+" >"+label+"</option>");
}
}
getBusCategory();
}
},error:function(data){
......@@ -676,8 +691,7 @@
*/
function getBusCategory(){
var selectNode = $("#supplementCategory");
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
/*获取类型选项框中的多个值 逗号分隔*/
var ts_describe= $("#supplementType").val();
......@@ -701,23 +715,28 @@
if (data != '') {
var slsb=$("#supplementCategory");
for (var i = 0;i < data.length;i++){
/* slsb.append(new Option(data1[i].name,data1[i].id) );*/
var value=data[i].id;
var label=data[i].name;
if(supplementCategory == label){
slsb.append("<option value="+value+" selected='true' >"+label+"</option>");
try {
$('#s2id_supplementCategory').find('.select2-chosen').html(label);
} catch (e) {
console.log(e);
if(supplementCategory != ''){
if(supplementCategory.search(label) != -1){
/* slsb.append("<option value="+value+" selected='true' >"+label+"</option>");*/
/* try {
$('#s2id_supplementCategory').find('.select2-choices').append(label+",");
} catch (e) {
console.log(e);
}*/
}else{
slsb.append("<option value="+value+" >"+label+"</option>");
}
}else{
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
slsb.append("<option value="+value+" >"+label+"</option>");
}
}
}
}
},error:function(data){
......@@ -734,7 +753,6 @@
$("#pageNo").val(0);
}
</script>
<style type="text/css">
.title {
......@@ -965,21 +983,47 @@
<form:option value="">请选择</form:option>
<form:option value="">请选择02</form:option>
</form:select>--%>
<form:select id="supplementType" path="supplementType" class="input-small required" onchange="getBusCategory();" multiple="true" cssStyle="width: 280px">
<%-- <form:option value="">请选择</form:option>--%>
</form:select>
<%-- <form:select id="supplementType" path="supplementType" class="input-small required" onchange="getBusCategory();" multiple="true" cssStyle="width: 280px">
&lt;%&ndash; <form:option value="">请选择</form:option>&ndash;%&gt;
</form:select>--%>
<%-- <select id="supplementType" name="supplementType" class="input-small required" onchange="getBusCategory()" style="width: 280px" multiple="multiple">
</select>--%>
<select id="supplementType" name="supplementType" class="selectpicker bla bla bli" onchange="getBusCategory()" style="width: 280px" multiple data-live-search="true" >
<option value="">请选择</option>
<c:if test="${report.supplementType != null}">
<c:forEach items="${typeMap}" var="type" >
<option selected value="${type.value}">${type.key}</option>
</c:forEach>
</c:if>
</select>
<%--<options items="${ctBbtcRegionList}" itemLabel="name" itemValue="id"--%>
<%--htmlEscape="false"/></select>--%>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">业务类别:</label>
<div class="controls">
<form:select id="supplementCategory" path="supplementCategory" class="input-small required" onchange="resetPageNo();" multiple="true" cssStyle="width: 280px">
<%-- <form:option value="">请选择</form:option>--%>
</form:select>
<%-- <form:select id="supplementCategory" path="supplementCategory" class="input-small required" onchange="resetPageNo();" multiple="true" cssStyle="width: 280px">
&lt;%&ndash; <form:option value="">请选择</form:option>&ndash;%&gt;
</form:select>--%>
<select id="supplementCategory" name="supplementCategory" class="selectpicker bla bla bli" onchange="resetPageNo()" style="width: 280px" multiple data-live-search="true" >
<option value="">请选择</option>
<c:if test="${report.supplementCategory != null}">
<c:forEach items="${catgoryMap}" var="catgory" >
<option selected value="${catgory.value}">${catgory.key}</option>
</c:forEach>
</c:if>
</select>
<%--<options items="${ctBbtcRegionList}" itemLabel="name" itemValue="id"--%>
<%--htmlEscape="false"/></select>--%>
<span class="help-inline"><font color="red">*</font> </span>
......
/*!
* bootstrap-select v1.4.3
* http://silviomoreto.github.io/bootstrap-select/
*
* Copyright 2013 bootstrap-select
* Licensed under the MIT license
*/
.bootstrap-select.btn-group,
.bootstrap-select.btn-group[class*="span"] {
float: none;
display: inline-block;
margin-bottom: 10px;
margin-left: 0;
}
.form-search .bootstrap-select.btn-group,
.form-inline .bootstrap-select.btn-group,
.form-horizontal .bootstrap-select.btn-group {
margin-bottom: 0;
}
.bootstrap-select.form-control {
margin-bottom: 0;
padding: 0;
border: none;
}
.bootstrap-select.btn-group.pull-right,
.bootstrap-select.btn-group[class*="span"].pull-right,
.row-fluid .bootstrap-select.btn-group[class*="span"].pull-right {
float: right;
}
.input-append .bootstrap-select.btn-group {
margin-left: -1px;
}
.input-prepend .bootstrap-select.btn-group {
margin-right: -1px;
}
.bootstrap-select:not([class*="span"]):not([class*="col-"]):not([class*="form-control"]) {
width: 220px;
}
.bootstrap-select {
/*width: 220px\9; IE8 and below*/
width: 220px\0; /*IE9 and below*/
}
.bootstrap-select.form-control:not([class*="span"]) {
width: 100%;
}
.bootstrap-select > .btn {
width: 100%;
}
.error .bootstrap-select .btn {
border: 1px solid #b94a48;
}
.dropdown-menu {
z-index: 2000;
}
.bootstrap-select.show-menu-arrow.open > .btn {
z-index: 2051;
}
.bootstrap-select .btn:focus {
outline: thin dotted #333333 !important;
outline: 5px auto -webkit-focus-ring-color !important;
outline-offset: -2px;
}
.bootstrap-select.btn-group .btn .filter-option {
overflow: hidden;
position: absolute;
left: 12px;
right: 25px;
text-align: left;
}
.bootstrap-select.btn-group .btn .caret {
position: absolute;
top: 50%;
right: 12px;
margin-top: -2px;
vertical-align: middle;
}
.bootstrap-select.btn-group > .disabled,
.bootstrap-select.btn-group .dropdown-menu li.disabled > a {
cursor: not-allowed;
}
.bootstrap-select.btn-group > .disabled:focus {
outline: none !important;
}
.bootstrap-select.btn-group[class*="span"] .btn {
width: 100%;
}
.bootstrap-select.btn-group .dropdown-menu {
min-width: 100%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.bootstrap-select.btn-group .dropdown-menu.inner {
position: static;
border: 0;
padding: 0;
margin: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.bootstrap-select.btn-group .dropdown-menu dt {
display: block;
padding: 3px 20px;
cursor: default;
}
.bootstrap-select.btn-group .div-contain {
overflow: hidden;
}
.bootstrap-select.btn-group .dropdown-menu li {
position: relative;
}
.bootstrap-select.btn-group .dropdown-menu li > a.opt {
position: relative;
padding-left: 35px;
}
.bootstrap-select.btn-group .dropdown-menu li > a {
cursor: pointer;
}
.bootstrap-select.btn-group .dropdown-menu li > dt small {
font-weight: normal;
}
.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a i.check-mark {
display: inline-block;
position: absolute;
right: 15px;
margin-top: 2.5px;
}
.bootstrap-select.btn-group .dropdown-menu li a i.check-mark {
display: none;
}
.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text {
margin-right: 34px;
}
.bootstrap-select.btn-group .dropdown-menu li small {
padding-left: 0.5em;
}
.bootstrap-select.btn-group .dropdown-menu li:not(.disabled) > a:hover small,
.bootstrap-select.btn-group .dropdown-menu li:not(.disabled) > a:focus small,
.bootstrap-select.btn-group .dropdown-menu li.active:not(.disabled) > a small {
color: #64b1d8;
color: rgba(255,255,255,0.4);
}
.bootstrap-select.btn-group .dropdown-menu li > dt small {
font-weight: normal;
}
.bootstrap-select.show-menu-arrow .dropdown-toggle:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #CCC;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: -4px;
left: 9px;
display: none;
}
.bootstrap-select.show-menu-arrow .dropdown-toggle:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
position: absolute;
bottom: -4px;
left: 10px;
display: none;
}
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before {
bottom: auto;
top: -3px;
border-top: 7px solid #ccc;
border-bottom: 0;
border-top-color: rgba(0, 0, 0, 0.2);
}
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after {
bottom: auto;
top: -3px;
border-top: 6px solid #ffffff;
border-bottom: 0;
}
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before {
right: 12px;
left: auto;
}
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after {
right: 13px;
left: auto;
}
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:before,
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle:after {
display: block;
}
.bootstrap-select.btn-group .no-results {
padding: 3px;
background: #f5f5f5;
margin: 0 5px;
}
.mobile-device {
position: absolute;
top: 0;
left: 0;
display: block !important;
width: 100%;
height: 100% !important;
opacity: 0;
}
.bootstrap-select.fit-width {
width: auto !important;
}
.bootstrap-select.btn-group.fit-width .btn .filter-option {
position: static;
}
.bootstrap-select.btn-group.fit-width .btn .caret {
position: static;
top: auto;
margin-top: -1px;
}
.control-group.error .bootstrap-select .dropdown-toggle{
border-color: #b94a48;
}
.bootstrap-select-searchbox {
padding: 4px 8px;
}
.bootstrap-select-searchbox input {
margin-bottom: 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment