开封利通水务前端

customerInfo.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /**
  2. * 客户信息
  3. * */
  4. $(document).ready(function() {
  5. //初始化时间
  6. // laydate.render({
  7. // elem: '#sc_time',
  8. // range: '~',
  9. // theme: '#1ab394',
  10. // calendar: true
  11. // });
  12. //获取所属行业
  13. // helper.getDropList.getlistDropByDic($('#sc_subtrade'), 'KHSSHY');
  14. //获取客户信誉等级
  15. // helper.getDropList.getlistDropByDic($('#sc_layer'), 'KHLayer');
  16. //管理员 || 超级管理员
  17. if($.cookie("userRoleId") == '17' || $.cookie("userRoleId") == '57' ){
  18. $('.hide_btn').show();$('.hide_btnd').show();
  19. }
  20. //监管
  21. if($.cookie("userRoleId") == '54'){
  22. $('.hide_btn').show();$('.hide_btnd').hide();
  23. }
  24. initTable();
  25. $("#sc_btns").on('click',initTable);
  26. $('#btn_add').on('click', btn_add);
  27. });
  28. //客户信息的列表
  29. function initTable() {
  30. //先销毁表格
  31. $('#cusList').bootstrapTable('destroy');
  32. //初始化表格,动态从服务器加载数据
  33. $("#cusList").bootstrapTable({
  34. method: "get", //使用get请求到服务器获取数据
  35. url: huayi.config.callcenter_url + "CustomerNew/GetList", //获取数据的Servlet地址
  36. contentType: 'application/x-www-form-urlencoded',
  37. striped: true, //表格显示条纹
  38. pagination: true, //启动分页
  39. pageSize: 10, //每页显示的记录数
  40. pageNumber: 1, //当前第几页
  41. pageList: [10, 20, 50, 100], //记录数可选列表
  42. search: false, //是否启用查询
  43. showColumns: false, //显示下拉框勾选要显示的列
  44. showRefresh: false, //显示刷新按钮
  45. sidePagination: "server", //表示服务端请求
  46. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  47. //设置为limit可以获取limit, offset, search, sort, order
  48. queryParamsType: "undefined",
  49. queryParams: function queryParams(params) { //设置查询参数
  50. var param = {
  51. pageindex: params.pageNumber, //int 页码,默认为1
  52. pagesize: params.pageSize, //int 条数,默认为10
  53. keywords: $('#sc_key').val(),//string 关键词
  54. code: $('#sc_code').val(),//string 客户编号
  55. cmpname: $('#sc_cmpname').val(),//string 公司名称
  56. cmpaddress: $('#sc_compaddress').val(),//string 公司地址
  57. legname: $('#sc_legname').val(),//string 法人姓名
  58. legtel: $('#sc_legtel').val(),//string 法人电话
  59. subtrade: $('#sc_subtrade').val(),//string 所属行业
  60. layer: $('#sc_layer').val(),//string 客户信誉等级
  61. bedept: $('#sc_bedept').val(),//string 客户归属部门
  62. berelacc: $('#sc_berelacc').val(),//string 归属涉税会计
  63. beaudacc: $('#sc_beaudacc').val(),//string 归属审核会计
  64. bemakeacc: $('#sc_bemakeacc').val(),//string 归属做账会计
  65. conname: $('#sc_conname').val(),//string 联系人姓名
  66. contel: $('#sc_contel').val(),//string 联系人电话
  67. token: $.cookie("token")
  68. };
  69. return param;
  70. },
  71. onLoadSuccess: function() { //加载成功时执行
  72. //layer.msg("加载成功");
  73. //管理员 || 超级管理员
  74. if($.cookie("userRoleId") == '17' || $.cookie("userRoleId") == '57' ){
  75. $('.hide_btn').show();$('.hide_btnd').show();
  76. }
  77. //监管
  78. if($.cookie("userRoleId") == '54'){
  79. $('.hide_btn').show();$('.hide_btnd').hide();
  80. }
  81. },
  82. onLoadError: function() { //加载失败时执行
  83. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  84. }
  85. });
  86. }
  87. //格式化操作
  88. function formatterOprate(val, row) {
  89. return '<ul class="tool_downs">' +
  90. '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_details_' + row.F_CustomerId + '" onclick="btn_details(\'' + row.F_CustomerId + '\')" title="详情">详情</a></li>' +
  91. '<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>' +
  92. // '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_addCus_' + row.F_CustomerId + '" onclick="btn_addCus(\'' + row.F_CustomerId + '\')" title="添加联系人信息">添加</a></li>' +
  93. '<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>' +
  94. '</ul>';
  95. }
  96. /**
  97. * 添加
  98. * */
  99. function btn_add() {
  100. layer.open({
  101. type: 2,
  102. title: '添加客户信息',
  103. maxmin: true, //开启最大化最小化按钮
  104. area: ['80%', '90%'],
  105. content: '../commonTpl/addOrEditCusInfo.html'
  106. });
  107. }
  108. /**
  109. * 修改
  110. * editId 客户id
  111. * */
  112. function btn_edit(editId) {
  113. layer.open({
  114. type: 2,
  115. title: '修改客户信息',
  116. maxmin: true, //开启最大化最小化按钮
  117. area: ['80%', '90%'],
  118. content: '../commonTpl/addOrEditCusInfo.html?edit_id=' + editId
  119. });
  120. }
  121. /**
  122. * 详情
  123. * editId 客户id
  124. * */
  125. function btn_details(editId) {
  126. layer.open({
  127. type: 2,
  128. title: '客户信息详情',
  129. maxmin: true, //开启最大化最小化按钮
  130. area: ['80%', '90%'],
  131. content: '../commonTpl/cusDetails.html?edit_id=' + editId
  132. });
  133. }
  134. /**
  135. * 添加联系人信息
  136. * editId 客户id
  137. * */
  138. function btn_addCus(editId) {
  139. layer.open({
  140. type: 2,
  141. title: '添加联系人信息',
  142. maxmin: true, //开启最大化最小化按钮
  143. area: ['60%', '70%'],
  144. content: '../commonTpl/addOrEditContacts.html?edit_id=' + editId
  145. });
  146. }
  147. //导入客户信息
  148. function btn_export() {
  149. layer.open({
  150. maxmin: true, //开启最大化最小化按钮
  151. type: 2,
  152. content: "../commonTpl/importCustomers.html", //iframe的url,no代表不显示滚动条
  153. title: '导入客户信息',
  154. area: ['50%', '55%'], //宽高
  155. });
  156. }
  157. //批量删除
  158. function btn_deletes() {
  159. var ids = $.map($('#cusList').bootstrapTable('getSelections'),
  160. function(row) {
  161. return row.F_CustomerId;
  162. });
  163. /*判断长度*/
  164. if (ids.length <= 0) {
  165. layer.confirm('请选择要删除的选项', {
  166. icon: 7,
  167. btn: ['确定'] //按钮
  168. });
  169. return;
  170. }
  171. btn_delete(ids);
  172. }
  173. //删除
  174. function btn_delete(cid) {
  175. layer.confirm('确定删除当前记录?', {
  176. icon: 7,
  177. btn: ['是', '否'] //按钮
  178. }, function(index) {
  179. /*执行删除*/
  180. $.ajax({
  181. type: "post",
  182. url: huayi.config.callcenter_url + "CustomerNew/DelCustomer",
  183. dataType: 'json',
  184. async: true,
  185. data: {
  186. ids: cid,//客户Id,可多选[1,2,3]
  187. token: $.cookie("token")
  188. },
  189. success: function(data) {
  190. layer.msg("删除成功!");
  191. $('#cusList').bootstrapTable('refresh');
  192. layer.close(index);
  193. }
  194. });
  195. });
  196. }