Commit 91235138 authored by agping's avatar agping

部门添加站点

parent c97e0d49
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
× ×
</button> </button>
<h4 class="modal-title"> <h4 class="modal-title edit-bumen">
编辑部门 编辑部门
</h4> </h4>
</div> </div>
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭 <button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button> </button>
<button type="button" class="btn btn-primary submit_edit" data-dismiss="modal"> <button type="button" class="btn btn-primary submit_edit">
提交 提交
</button> </button>
</div> </div>
......
...@@ -4,7 +4,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa ...@@ -4,7 +4,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
pageSize: 15, /*每页显示多少条*/ pageSize: 15, /*每页显示多少条*/
pageNum:10, pageNum:10,
district : 0, district : 0,
agent_id : 0, agent_id : '',
init: function () { init: function () {
//初始化dot //初始化dot
$ ("body").append (template); $ ("body").append (template);
...@@ -13,7 +13,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa ...@@ -13,7 +13,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
}, },
event: function () { event: function () {
district.getDistrict(function() { district.getDistrict(function() {
$ (document).on('input', '[name=district_id],#district_id2', function() { $(document).on('input', '[name=district_id],#district_id2', function() {
var _this = $(this); var _this = $(this);
var _id = _this.val(); var _id = _this.val();
_this.next().html(''); //先清空 _this.next().html(''); //先清空
...@@ -21,35 +21,35 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa ...@@ -21,35 +21,35 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
var _objTemp = _this.parent().next().find('select'); var _objTemp = _this.parent().next().find('select');
_objTemp.html(''); //先清空 _objTemp.html(''); //先清空
if(_id && _id != '0') { if(_id && _id != '0') {
agent.getDistrictStoreList(_id, function(_data) {
// var _str = '';
var _str = '<option value="0">全部</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.id + '">' + item.store_name + '</option>';
});
_objTemp.html(_str);
_this.next().html(_str);
});
} else {}; } else {};
}); });
}); });
$ (document).delegate ("#search", "click", function () {//点击搜索 $(document).delegate("#search", "click", function () {//点击搜索
district.getList(1); district.getList(1);
}); });
// 点击 新增 // 点击 新增
$ (document).delegate (".edit-add", "click", function () {//点击编辑 $(document).delegate(".edit_add", "click", function () {//点击新增
district.district_id = ''; district.district_id = '';
$("input[name = agents_id]").val('');
$("input[name = title]").val('');
$("select[name =district_id]").val('')
$("select[name =district_id]").removeAttr("disabled");
$('.edit-bumen').html('新增部门');
district.agent_id='';
console.log(1)
}); });
$ (document).delegate (".edit", "click", function () {//点击编辑 $(document).delegate(".edit", "click", function () {//点击编辑
district.district_id = $ (this).attr ("data-id"); district.district_id = $ (this).attr ("data-id");
$("select[name =district_id]").attr("disabled","disabled");
$('.edit-bumen').html('编辑部门');
console.log(1)
district.Edit(); district.Edit();
}); });
$ (document).delegate (".submit_edit", "click", function () {//提交编辑 $(document).delegate(".submit_edit", "click", function () {//提交编辑
district.Submit_edit(); district.Submit_edit();
}); });
$ (document).delegate (".mend", "click", function () {//点击门店列表 $(document).delegate (".mend", "click", function () {//点击门店列表
district.district_id = $ (this).attr ("data-id"); district.district_id = $ (this).attr ("data-id");
district.Mend(); district.Mend();
}); });
...@@ -64,12 +64,13 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa ...@@ -64,12 +64,13 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
district.loadMain(valueCurrent); district.loadMain(valueCurrent);
_this.parent().next().show(); _this.parent().next().show();
}else{ }else{
district.ldHtml.html(''); district.agent_id = '';
ldHtml.html('');
return false; return false;
} }
}); });
$ (document).delegate (".mend_list li", "click", function () {//点击列表 $(document).delegate (".mend_list li", "click", function () {//点击列表
var phone_name=$(this).find(".phone_name").html(); var phone_name=$(this).find(".phone_name").html();
var phone_id=$(this).find(".phone_id").html(); var phone_id=$(this).find(".phone_id").html();
var phone_phone=$(this).find(".phone-phone").html(); var phone_phone=$(this).find(".phone-phone").html();
...@@ -106,6 +107,19 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa ...@@ -106,6 +107,19 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
par.department_name = $("input[name =title]").val(); par.department_name = $("input[name =title]").val();
par.agents_id = district.agent_id; par.agents_id = district.agent_id;
par.site_id = $("select[name =district_id]").val(); par.site_id = $("select[name =district_id]").val();
if(par.site_id == ''){
alert('请选择城市');
return;
}
if(par.department_name == ''){
alert('请选择部门');
return;
}
if(par.agents_id == ''){
alert('请选择部门总监');
return;
}
$.ajax({ $.ajax({
'type': 'POST', 'type': 'POST',
'url' : '/index/adddistrict', 'url' : '/index/adddistrict',
...@@ -113,6 +127,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa ...@@ -113,6 +127,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
dataType: "json", dataType: "json",
success: function(data){ success: function(data){
if(data.code == 200){ if(data.code == 200){
$("#modal-edit").modal('hide');
district.getList(1); district.getList(1);
} else { } else {
alert(data.msg); alert(data.msg);
......
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