Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
5a9c5c57
Commit
5a9c5c57
authored
Jul 03, 2018
by
agping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
经纪人 列表 新增 编辑 搜索 部门和门店二级联动修改
parent
7fca7018
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
424 additions
and
2 deletions
+424
-2
agent.js
public/resource/js/agent.js
+424
-2
No files found.
public/resource/js/agent.js
View file @
5a9c5c57
...
@@ -12,10 +12,13 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
...
@@ -12,10 +12,13 @@ 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'
,
'#district_id2'
,
function
(){
_doc
.
on
(
'input'
,
'#district_id2
,[name=district_id]
'
,
function
(){
var
_this
=
$
(
this
);
var
_this
=
$
(
this
);
var
_id
=
_this
.
val
();
var
_id
=
_this
.
val
();
_this
.
next
().
html
(
''
);
//先清空
_this
.
next
().
html
(
''
);
//先清空
//新增 编辑
var
_objTemp
=
_this
.
parent
().
next
().
find
(
'select'
);
_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,11 +27,33 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
...
@@ -24,11 +27,33 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
_str
+=
'<option value="'
+
item
.
id
+
'">'
+
item
.
store_name
+
'</option>'
;
_str
+=
'<option value="'
+
item
.
id
+
'">'
+
item
.
store_name
+
'</option>'
;
});
});
_this
.
next
().
html
(
_str
);
//先清空
_this
.
next
().
html
(
_str
);
//先清空
_objTemp
.
html
(
_str
);
});
});
}
else
{
}
else
{
};
};
});
});
});
});
//新增 编辑
// agent.getDistrict(function(){
// _doc.on('input', '[name=district_id]', function(){
// var _this = $(this);
// var _id = _this.val();
// 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);
// });
// }else{
// };
// });
// })
$
(
'#search'
).
click
(
function
(
pageNo
)
{
$
(
'#search'
).
click
(
function
(
pageNo
)
{
agent
.
getList
(
1
);
agent
.
getList
(
1
);
});
});
...
@@ -300,7 +325,8 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
...
@@ -300,7 +325,8 @@ 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>'
;
});
});
$
(
'#district_id'
).
append
(
str
);
$
(
'#district_id2'
).
append
(
str
);
$
(
'[name=district_id]'
).
append
(
str
);
fn
&&
fn
();
fn
&&
fn
();
}
}
}
}
...
@@ -326,3 +352,399 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
...
@@ -326,3 +352,399 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
};
};
return
agent
;
return
agent
;
});
});
//define(['doT', 'text!temp/agent_template_tpl.html', 'text!temp/phoneBinding_template_tpl.html','css!style/home.css', 'pagination', 'bootstrapJs','ckfinder', 'ckfinderStart', 'blow-up'], function (doT, template,template_binding) {
// var agent = {
// pageNo : 1,
// pageSize : 15,
// agent_id : 0,
// init: function () {
// //初始化dot
// $("body").append(template+template_binding);
// agent.getList();
// agent.event();
// },
// event: function () {
// var _doc = $(document);
// agent.getDistrict(function(){
// _doc.on('input', '[name=district_id]', function(){
// var _this = $(this);
// var _id = _this.val();
// 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);
// });
// }else{
// };
// });
// })
// $('#search').click(function (pageNo) {
// agent.getList(1);
// });
//
// $("#reset").click(function () {//重置
// document.getElementById("form_search").reset();
// });
//
// $(document).delegate(".agent_add", "click", function () {//新增
// $("#title").html("新增经纪人");
// $("#password").parent().addClass('hide'); //新增不显示密码
// $(".form-horizontal")[0].reset(); //重置表单
// agent.emptyInput();//清空表单
// });
//
// $(document).delegate(".edit", "click", function () {//点击编辑
// $("#title").html("编辑经纪人");
// $(".form-horizontal")[0].reset(); //重置表单
// agent.agent_id = $(this).attr("data-id");
// $("#password").parent().removeClass('hide'); //编辑显示密码
// $("#password").attr('type','text');
// agent.emptyInput();//清空表单
// agent.Edit();
// });
//
// $(document).delegate("#password", "click",function () {
// $(this).val('').attr('type','password');
// });
//
// $(document).on("click", ".phone-bundling",function () {
// agent.agent_id = $(this).attr("data-id");
// agent.getPhoneBindingList();
// });
// $(document).delegate(".submit_edit", "click", function () {//提交编辑
// agent.Submit_edit();
// });
//
// $(document).delegate("#role", "click", function (e) {//变更角色
// var _this = $(this);
// var _tempVal = _this.closest('tr').attr('data-groupname');
// agent.agent_id = $(this).attr("data-id");
// agent.getRole(_tempVal);
// });
//
// $(document).delegate(".submit_user", "click", function () {//提交变更
// agent.Submit_user();
// });
//
// $(document).delegate(".is_show", "click", function () {//点击禁用
// if (!confirm('是否继续?')) {
// return;
// }
// agent.id = $(this).attr("data-id");
// var params = {
//
// };
// params.id = $(this).attr("data-id");
// var str = $.trim($(this).html());
// if (str === "正常") {
// $(this).attr('class','btn1 btn-default is_show');
// params.type = 1;
// $(this).html('冻结');
// } else if (str === "冻结") {
// $(this).attr('class','btn1 btn-info is_show');
// params.type = 0;
// $(this).html('正常');
// } else {
// params.type = 2;
// }
// $.ajax({//禁用
// 'type': 'POST',
// 'url': '/index/updateStatus',
// data: { "ids": agent.id, "status": params.type },
// dataType: "json",
// success: function (data) {
// if (data.code != 200) {
// alert("禁用失败!")
// }
// }
// });
// });
// //手机绑定状态切换
// $(document).delegate(".is_show2", "click", function () {//点击禁用
// if (!confirm('是否继续?')) {
// return;
// }
// agent.id = $(this).attr("data-id");
// var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo'))); //读取缓存
//// console.log(user_info_obj);
// var params = {
//
// };
// params.id = $(this).attr("data-id");
// var str = $.trim($(this).html());
// if (str === "允许") {
// $(this).attr('class','btn1 btn-default is_show2');
// params.type = 0;
// $(this).html('解绑');
// } else if (str === "解绑") {
// $(this).attr('class','btn1 btn-info is_show2');
// params.type = 1;
// $(this).html('允许');
// };
// $.ajax({//禁用
// 'type': 'POST',
// 'url': '/index/updateDevice',
// data: { "agent_id": agent.agent_id, "id": params.id,"operator_id": user_info_obj.id,"is_forbidden": params.type },
// /* $params = array(
// "agent_id" => 1,//解绑或者绑定的经纪人id
// "id" => 1, //关系id
// "operator_id" => 12,//操作人id 登陆后台的经纪人id
// "is_forbidden" => 0,//0正常 1禁止
// );*/
//
// dataType: "json",
// success: function (data) {
// if (data.code != 200) {
// alert("禁用失败!")
// }
// }
// });
// });
// },
// Submit_user: function () {//提交变更的信息
// var group_id = $("#edit_role").val();
// $.ajax({
// 'type': 'POST',
// 'url': '/index/updateRole',
// data: { 'ids': agent.agent_id, 'group_id': group_id },
// dataType: "json",
// success: function (data) {
// if (data.code == 200) {
// agent.getList(1);
// } else {
// alert("重复提交");
// }
// }
// });
// },
// Edit: function () {//获取
// $.ajax({
// 'type': 'GET',
// 'url': '/index/saveAgent',//获取编辑数据
// data: { "id": agent.agent_id },
// dataType: "json",
// success: function (data) {
//
// if (data.code == 200) {
// if(data.data){
// $("input[name = id]").val(data.data.id);
// $("input[name = phone]").val(data.data.phone);
// $("input[name = name]").val(data.data.name);
// $("[name = district_id]").val(data.data.district_id);
// if(data.data.district_id){
// agent.getDistrictStoreList(data.data.district_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>';
// });
// $("[name = store_id]").html(_str).val(data.data.store_id);
// });
// }else{
//
// }
//
// $("#remarks").val(data.data.remarks);
// $("#password").val(data.data.password);
// $("input[name='password']").attr('form-group');
// if (data.data.sex == '0') {
// $("#sex0").attr('checked', true);
// } else if (data.data.sex == '1') {
// $("#sex1").attr('checked', true);
// } else {
// $("#sex2").attr('checked', true);
// }
// }
//
// } else {
// alert('获取经纪人数据失败');
// }
//
// }
// });
// },
// Submit_edit: function () {
// //提交编辑的信息
// var params = {}
// params.id = agent.agent_id;
// params.name = $("input[name = name]").val();
// params.password = $("#password").val();
// params.district_id = $("[name = district_id]").val();
// params.store_id = $("[name = store_id]").val();
// params.phone = $("input[name = phone]").val();
// params.admin_off = $("#admin_off").val();
// params.sex = $("input[name =sex]:checked").val();
// params.remarks = $("#remarks").val();
// params.status = $("#status").val();
// params.password = $("input[name='password']").val();
//
//
// if (params.phone == '') {
// alert('手机号必填!');
// return false;
// }
//
// if (params.district_id == '') {
// alert('所属部门必填');
// $("#modal-edit").show();
// return false;
// }
//
//
// if (params.store_id == '') {
// alert('所属门店必填');
// $("#modal-edit").show();
// return false;
// }
//
// if (params.phone.length != 11) {
// alert('手机号码错误!');
// $("#modal-edit").show();
// return false;
// }
//
// $.ajax({
// 'type': 'POST',
// 'url': '/index/saveAgent',
// data: params,
// dataType: "json",
// success: function (data) {
// if (data.code == 200) {
// $("#modal-edit").modal('hide');
// agent.getList(1);
// } else {
// alert(data.msg);
// }
// }
// });
//
// },
// emptyInput: function(){
// console.count('emptyInput');
// $("input[name = name]").val('');
// $("input[name = phone]").val('');
// $("#password").val('');
// $("[name = district_id]").val('');
// $("[name = store_id]").html('');
// $("input[name =sex]").val('0');
// $("#admin_off").val('0');
// $("#remarks").val('');
// },
// getList: function (pageNo) {
// agent.pageNo = pageNo;
// var params = {};
// params.pageNo = agent.pageNo;
// params.pageSize = agent.pageSize;
// params.search = $("input[name='search']").val();
// params.groupname = $("input[name='groupname']").val();
// params.store_name = $("input[name='store_name']").val();
// $.ajax({
// url: '/index/AgentList',
// type: 'GET',
// async: true,
// data: params,
// dataType: 'json',
// success: function (data) {
// var temp = document.getElementById('agent_tpl').innerHTML;
// var doTempl = doT.template(temp);
// $("#agentlist").html(doTempl(data.data.list));
// /*分页代码*/
// add_page(data.data.total, pageNo, agent.pageSize, agent.getList);
// $ ('.J_preview').preview ();
//
// }
// })
// },
// //手机绑定权限
// getPhoneBindingList: function (pageNo) {
// var params = {};
// params.agent_id =agent.agent_id;
// console.log(agent.agent_id);
// $.ajax({
// url: '/index/deviceList',
// type: 'GET',
// async: true,
// data: params,
// dataType: 'json',
// success: function (data) {
// var temp = document.getElementById('phone_binding_tpl').innerHTML;
// var doTempl = doT.template(temp);
// $("#agent_phone_binding").html(doTempl(data.data));
// /*分页代码*/
// add_page(data.data.total, pageNo, agent.pageSize, agent.getList);
// $ ('.J_preview').preview ();
// }
// })
// },
//
// getRole : function (tempval) {
// $.ajax({
// url: '/index/getAuth2',
// type: 'GET',
// data:{},
// async: true,
// dataType: 'json',
// success: function (data) {
// var User_add="";
// var _tempid;
// $.each(data.data.list,function(i,item){
// User_add+='<option value="'+item.id+'">'+item.title+'</option>';
// if(item.title == tempval){
// _tempid = item.id;
// console.log(item.id);
// };
// });
// console.log(_tempid);
// $("#edit_role").html(User_add).val(_tempid);
//
// }
// });
// },
// getDistrict : function (fn) {
// $.ajax ({
// url: '/index/getDistrict',
// type: 'GET',
// async: true,
// data: {"pageSize":1000},
// dataType: 'json',
// success: function (data) {
// if (data.code == 200 && data.data != null) {
// var str = '';
// $.each(data.data, function(i,item) {
// str += '<option value="'+item.id+'">'+item.district_name+'</option>';
// });
// $('[name=district_id]').append(str);
// fn && fn();
// }
// }
// });
// },
// getDistrictStoreList: function(id, fn){
// $.ajax ({
// url: '/index/getDistrictStoreList',
// type: 'GET',
// async: true,
// data: {
// 'id':id,
// "pageSize":1000
// },
// dataType: 'json',
// success: function (data) {
// if (data.code == 200 && data.data != null) {
// fn && fn(data.data);
// }
// }
// });
// }
// };
// return agent;
//});
//
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment