Commit 04b43c48 authored by agping's avatar agping

经纪人搜索二级联动

parent 472738ae
This diff is collapsed.
...@@ -12,11 +12,10 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -12,11 +12,10 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
event: function () { event: function () {
var _doc = $(document); var _doc = $(document);
agent.getDistrict(function(){ agent.getDistrict(function(){
_doc.on('input', '[name=district_id]', function(){ _doc.on('input', '#district_id', function(){
var _this = $(this); var _this = $(this);
var _id = _this.val(); var _id = _this.val();
var _objTemp = _this.parent().next().find('select'); _this.next().html('');//先清空
_objTemp.html('');//先清空
if(_id && _id != '0'){ if(_id && _id != '0'){
agent.getDistrictStoreList(_id, function(_data){ agent.getDistrictStoreList(_id, function(_data){
// var _str = ''; // var _str = '';
...@@ -24,12 +23,12 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -24,12 +23,12 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
$.each(_data, function(i,item) { $.each(_data, function(i,item) {
_str += '<option value="'+item.id+'">'+item.store_name+'</option>'; _str += '<option value="'+item.id+'">'+item.store_name+'</option>';
}); });
_objTemp.html(_str); _this.next().html(_str);//先清空
}); });
}else{ }else{
}; };
}); });
}) });
$('#search').click(function (pageNo) { $('#search').click(function (pageNo) {
agent.getList(1); agent.getList(1);
}); });
...@@ -245,6 +244,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -245,6 +244,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
params.search = $("input[name='search']").val(); params.search = $("input[name='search']").val();
params.groupname = $("input[name='groupname']").val(); params.groupname = $("input[name='groupname']").val();
params.store_name = $("input[name='store_name']").val(); params.store_name = $("input[name='store_name']").val();
//后端加入两个字段搜索
$.ajax({ $.ajax({
url: '/index/AgentList', url: '/index/AgentList',
type: 'GET', type: 'GET',
...@@ -298,7 +298,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -298,7 +298,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
$.each(data.data, function(i,item) { $.each(data.data, function(i,item) {
str += '<option value="'+item.id+'">'+item.district_name+'</option>'; str += '<option value="'+item.id+'">'+item.district_name+'</option>';
}); });
$('[name=district_id]').append(str); $('#district_id').append(str);
fn && fn(); fn && fn();
} }
} }
......
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