Commit 8825972e by sunxin

业务类型数据回显修复

parent 4b366b17
...@@ -18,5 +18,10 @@ import com.ejweb.modules.sys.entity.Dict; ...@@ -18,5 +18,10 @@ import com.ejweb.modules.sys.entity.Dict;
public interface DictDao extends CrudDao<Dict> { public interface DictDao extends CrudDao<Dict> {
public List<String> findTypeList(Dict dict); public List<String> findTypeList(Dict dict);
/*跟据type查询集团信息*/
public List<Dict> getByType(Dict dict);
} }
...@@ -5,6 +5,7 @@ package com.ejweb.modules.sys.service; ...@@ -5,6 +5,7 @@ package com.ejweb.modules.sys.service;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -22,6 +23,9 @@ import com.ejweb.modules.sys.utils.DictUtils; ...@@ -22,6 +23,9 @@ import com.ejweb.modules.sys.utils.DictUtils;
@Service @Service
@Transactional(readOnly = true) @Transactional(readOnly = true)
public class DictService extends CrudService<DictDao, Dict> { public class DictService extends CrudService<DictDao, Dict> {
@Autowired
private DictDao dao;
/** /**
* 查询字段类型列表 * 查询字段类型列表
...@@ -42,5 +46,10 @@ public class DictService extends CrudService<DictDao, Dict> { ...@@ -42,5 +46,10 @@ public class DictService extends CrudService<DictDao, Dict> {
super.delete(dict); super.delete(dict);
CacheUtils.remove(DictUtils.CACHE_DICT_MAP); CacheUtils.remove(DictUtils.CACHE_DICT_MAP);
} }
/*跟据type查询集团信息*/
@Transactional(readOnly = false)
public List<Dict> getByType(Dict dict) {
return dao.getByType(dict);
}
} }
...@@ -120,4 +120,13 @@ public class DictController extends BaseController { ...@@ -120,4 +120,13 @@ public class DictController extends BaseController {
return dictService.findList(dict); return dictService.findList(dict);
} }
/*跟据type查询集团信息*/
@ResponseBody
@RequestMapping(value = "getByType")
public List<Dict> getByType(String type) {
Dict dict = new Dict();
dict.setType(type);
return dictService.getByType(dict);
}
} }
...@@ -8,7 +8,15 @@ ...@@ -8,7 +8,15 @@
FROM ct_bbtc_sys_dict FROM ct_bbtc_sys_dict
WHERE id = #{id} WHERE id = #{id}
</select> </select>
<!--跟据type查询集团信息-->
<select id="getByType" resultType="Dict">
SELECT
*
FROM ct_bbtc_sys_dict
WHERE type = #{type}
</select>
<select id="findList" resultType="Dict"> <select id="findList" resultType="Dict">
SELECT SELECT
* *
......
...@@ -28,11 +28,7 @@ ...@@ -28,11 +28,7 @@
$(list).append(Mustache.render(tpl, { $(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row idx: idx, delBtn: true, row: row
})); }));
getGroup(list,idx);
$(list + idx).find("select").each(function () {
$(this).val($(this).attr("data-value"));
});
genSeqNo(); genSeqNo();
} }
...@@ -54,15 +50,62 @@ ...@@ -54,15 +50,62 @@
}); });
} }
/* 获取集团列表并选中 */
function getGroup(scopeList,idx){
$.ajax({
type: "POST",
url: "${ctx}/sys/dict/getByType?type=supplement_group",
dataType: "json",
success: function(returnedData) {
var data1 = returnedData;
var data00 = ${fns:toJson(cloudAreaList)};
if (data1 != '') {
var slsb=$(scopeList+idx+"_group");
for (var i = 0;i < data1.length;i++){
/* slsb.append(new Option(data1[i].name,data1[i].id) );*/
var value=data1[i].id;
var label=data1[i].label;
if(data00[idx] != null){
if(data00[idx].group == label){
slsb.append("<option value="+value+" selected='true' >"+label+"</option>");
}else{
slsb.append("<option value="+value+" >"+label+"</option>");
}
getRegion(scopeList,idx);
}else{
slsb.append("<option value="+value+" >"+label+"</option>");
}
}
}
},error:function(data){
alert("系统错误");
}
});
}
/*跟据集团 获取对应的业务类型 和业务类别 */ /*跟据集团 获取对应的业务类型 和业务类别 */
function getRegion(scopeList){ function getRegion(scopeList,idx){
var selectNode = $(scopeList+"_area"); if(idx !=null){
var selectNode = $(scopeList+idx+"_area");
}else{
var selectNode = $(scopeList+"_area");
}
selectNode.empty();//每次需要将上一次的数据进行清空 selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>"); selectNode.append("<option value=''>请选择</option>");
if(idx !=null){
var ts_describe= $(scopeList+idx+"_group").val();
}else{
var ts_describe= $(scopeList+"_group").val();
}
var ts_describe= $(scopeList+"_group").val();
if(ts_describe != null && ts_describe != ''){ if(ts_describe != null && ts_describe != ''){
$.ajax({ $.ajax({
type: "POST", type: "POST",
...@@ -70,11 +113,30 @@ ...@@ -70,11 +113,30 @@
dataType: "json", dataType: "json",
success: function(returnedData) { success: function(returnedData) {
var data1 = returnedData.ctBbtcRegionList; var data1 = returnedData.ctBbtcRegionList;
var data00 = ${fns:toJson(cloudAreaList)};
if (data1 != '') { if (data1 != '') {
var slsb=$(scopeList+"_area"); if(idx !=null){
var slsb=$(scopeList+idx+"_area");
}else{
var slsb=$(scopeList+"_area");
}
for (var i = 0;i < data1.length;i++){ for (var i = 0;i < data1.length;i++){
slsb.append(new Option(data1[i].name,data1[i].id)); /* slsb.append(new Option(data1[i].name,data1[i].id) );*/
var value=data1[i].id;
var label=data1[i].name;
if(data00[idx] != null){
if(data00[idx].area == label){
slsb.append("<option value="+value+" selected='true' >"+label+"</option>");
}else{
slsb.append("<option value="+value+" >"+label+"</option>");
}
}else{
slsb.append("<option value="+value+" >"+label+"</option>");
}
} }
} }
},error:function(data){ },error:function(data){
alert("系统错误"); alert("系统错误");
...@@ -165,8 +227,7 @@ ...@@ -165,8 +227,7 @@
<td> <td>
<form:select id="scopeList{{idx}}_group" path="group" class="input-small required" onchange="getRegion('#scopeList{{idx}}')" cssStyle="width: 280px" > <form:select id="scopeList{{idx}}_group" path="group" class="input-small required" onchange="getRegion('#scopeList{{idx}}')" cssStyle="width: 280px" >
<form:option value="">请选择</form:option> <form:option value="">请选择</form:option>
<form:options items="${fns:getDictList('supplement_group')}" itemLabel="label" itemValue="id"
htmlEscape="false"/>
</form:select> </form:select>
</td> </td>
<td> <td>
...@@ -189,7 +250,7 @@ ...@@ -189,7 +250,7 @@
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
addRow('#scopeList',scopeRowIdx, scopeTpl, data[i]); addRow('#scopeList',scopeRowIdx, scopeTpl, data[i]);
scopeRowIdx = scopeRowIdx + 1; scopeRowIdx = scopeRowIdx + 1;
} }
}); });
</script> </script>
</div> </div>
......
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