Commit 91235138 authored by agping's avatar agping

部门添加站点

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