| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- /**
- * 客户信息
- * */
- $(document).ready(function() {
- //初始化时间
- // laydate.render({
- // elem: '#sc_time',
- // range: '~',
- // theme: '#1ab394',
- // calendar: true
- // });
- //获取所属行业
- // helper.getDropList.getlistDropByDic($('#sc_subtrade'), 'KHSSHY');
- //获取客户信誉等级
- // helper.getDropList.getlistDropByDic($('#sc_layer'), 'KHLayer');
-
- //管理员 || 超级管理员
- if($.cookie("userRoleId") == '17' || $.cookie("userRoleId") == '57' ){
- $('.hide_btn').show();$('.hide_btnd').show();
- }
- //监管
- if($.cookie("userRoleId") == '54'){
- $('.hide_btn').show();$('.hide_btnd').hide();
- }
- initTable();
- $("#sc_btns").on('click',initTable);
- $('#btn_add').on('click', btn_add);
- });
- //客户信息的列表
- function initTable() {
- //先销毁表格
- $('#cusList').bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- $("#cusList").bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "CustomerNew/GetList", //获取数据的Servlet地址
- contentType: 'application/x-www-form-urlencoded',
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 10, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [10, 20, 50, 100], //记录数可选列表
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- pageindex: params.pageNumber, //int 页码,默认为1
- pagesize: params.pageSize, //int 条数,默认为10
- keywords: $('#sc_key').val(),//string 关键词
- code: $('#sc_code').val(),//string 客户编号
- cmpname: $('#sc_cmpname').val(),//string 公司名称
- cmpaddress: $('#sc_compaddress').val(),//string 公司地址
- legname: $('#sc_legname').val(),//string 法人姓名
- legtel: $('#sc_legtel').val(),//string 法人电话
- subtrade: $('#sc_subtrade').val(),//string 所属行业
- layer: $('#sc_layer').val(),//string 客户信誉等级
- bedept: $('#sc_bedept').val(),//string 客户归属部门
- berelacc: $('#sc_berelacc').val(),//string 归属涉税会计
- beaudacc: $('#sc_beaudacc').val(),//string 归属审核会计
- bemakeacc: $('#sc_bemakeacc').val(),//string 归属做账会计
- conname: $('#sc_conname').val(),//string 联系人姓名
- contel: $('#sc_contel').val(),//string 联系人电话
- token: $.cookie("token")
- };
- return param;
- },
- onLoadSuccess: function() { //加载成功时执行
- //layer.msg("加载成功");
- //管理员 || 超级管理员
- if($.cookie("userRoleId") == '17' || $.cookie("userRoleId") == '57' ){
- $('.hide_btn').show();$('.hide_btnd').show();
- }
- //监管
- if($.cookie("userRoleId") == '54'){
- $('.hide_btn').show();$('.hide_btnd').hide();
- }
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- //格式化操作
- function formatterOprate(val, row) {
- return '<ul class="tool_downs">' +
- '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_details_' + row.F_CustomerId + '" onclick="btn_details(\'' + row.F_CustomerId + '\')" title="详情">详情</a></li>' +
- '<li><a href="javascript:;" class="aBtn hide_btn" authorize="yes" id="HY_edit_' + row.F_CustomerId + '" onclick="btn_edit(\'' + row.F_CustomerId + '\')" title="修改">修改</a></li>' +
- // '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_addCus_' + row.F_CustomerId + '" onclick="btn_addCus(\'' + row.F_CustomerId + '\')" title="添加联系人信息">添加</a></li>' +
- '<li><a href="javascript:;" class="aBtn hide_btnd" authorize="yes" id="HY_delete_' + row.F_CustomerId + '" onclick="btn_delete(' + row.F_CustomerId + ')" title="删除">删除</a></li>' +
- '</ul>';
- }
- /**
- * 添加
- * */
- function btn_add() {
- layer.open({
- type: 2,
- title: '添加客户信息',
- maxmin: true, //开启最大化最小化按钮
- area: ['80%', '90%'],
- content: '../commonTpl/addOrEditCusInfo.html'
- });
- }
- /**
- * 修改
- * editId 客户id
- * */
- function btn_edit(editId) {
- layer.open({
- type: 2,
- title: '修改客户信息',
- maxmin: true, //开启最大化最小化按钮
- area: ['80%', '90%'],
- content: '../commonTpl/addOrEditCusInfo.html?edit_id=' + editId
- });
- }
- /**
- * 详情
- * editId 客户id
- * */
- function btn_details(editId) {
- layer.open({
- type: 2,
- title: '客户信息详情',
- maxmin: true, //开启最大化最小化按钮
- area: ['80%', '90%'],
- content: '../commonTpl/cusDetails.html?edit_id=' + editId
- });
- }
- /**
- * 添加联系人信息
- * editId 客户id
- * */
- function btn_addCus(editId) {
- layer.open({
- type: 2,
- title: '添加联系人信息',
- maxmin: true, //开启最大化最小化按钮
- area: ['60%', '70%'],
- content: '../commonTpl/addOrEditContacts.html?edit_id=' + editId
- });
- }
- //导入客户信息
- function btn_export() {
- layer.open({
- maxmin: true, //开启最大化最小化按钮
- type: 2,
- content: "../commonTpl/importCustomers.html", //iframe的url,no代表不显示滚动条
- title: '导入客户信息',
- area: ['50%', '55%'], //宽高
- });
- }
- //批量删除
- function btn_deletes() {
- var ids = $.map($('#cusList').bootstrapTable('getSelections'),
- function(row) {
- return row.F_CustomerId;
- });
- /*判断长度*/
- if (ids.length <= 0) {
- layer.confirm('请选择要删除的选项', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- btn_delete(ids);
- }
- //删除
- function btn_delete(cid) {
- layer.confirm('确定删除当前记录?', {
- icon: 7,
- btn: ['是', '否'] //按钮
- }, function(index) {
- /*执行删除*/
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "CustomerNew/DelCustomer",
- dataType: 'json',
- async: true,
- data: {
- ids: cid,//客户Id,可多选[1,2,3]
- token: $.cookie("token")
- },
- success: function(data) {
- layer.msg("删除成功!");
- $('#cusList').bootstrapTable('refresh');
- layer.close(index);
- }
- });
- });
- }
|