阜外心血管项目前端

customerInfo.js 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. if ($.cookie("userRoleId") == '17' || $.cookie("userRoleId") == '57') {
  17. $('.hide_btn').show();
  18. }
  19. initTable();
  20. $("#sc_btns").on('click', initTable);
  21. $('#btn_add').on('click', btn_add);
  22. });
  23. //客户信息的列表
  24. function initTable() {
  25. //先销毁表格
  26. $('#cusList').bootstrapTable('destroy');
  27. //初始化表格,动态从服务器加载数据
  28. $("#cusList").bootstrapTable({
  29. method: "get", //使用get请求到服务器获取数据
  30. url: huayi.config.callcenter_url + "CustomerNew/GetList", //获取数据的Servlet地址
  31. contentType: 'application/x-www-form-urlencoded',
  32. striped: true, //表格显示条纹
  33. pagination: true, //启动分页
  34. pageSize: 10, //每页显示的记录数
  35. pageNumber: 1, //当前第几页
  36. pageList: [10, 20, 50, 100], //记录数可选列表
  37. search: false, //是否启用查询
  38. showColumns: false, //显示下拉框勾选要显示的列
  39. showRefresh: false, //显示刷新按钮
  40. sidePagination: "server", //表示服务端请求
  41. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  42. //设置为limit可以获取limit, offset, search, sort, order
  43. queryParamsType: "undefined",
  44. queryParams: function queryParams(params) { //设置查询参数
  45. var param = {
  46. pageindex: params.pageNumber, //int 页码,默认为1
  47. pagesize: params.pageSize, //int 条数,默认为10
  48. keywords: $('#sc_key').val(),//string 关键词
  49. code: $('#sc_code').val(),//string 客户编号
  50. cmpaddress: $('#sc_compaddress').val(),//string 公司地址
  51. legname: $('#sc_legname').val(),//string 法人姓名
  52. legtel: $('#sc_legtel').val(),//string 法人电话
  53. subtrade: $('#sc_subtrade').val(),//string 所属行业
  54. layer: $('#sc_layer').val(),//string 客户信誉等级
  55. bedept: $('#sc_bedept').val(),//string 客户归属部门
  56. berelacc: $('#sc_berelacc').val(),//string 归属涉税会计
  57. beaudacc: $('#sc_beaudacc').val(),//string 归属审核会计
  58. bemakeacc: $('#sc_bemakeacc').val(),//string 归属做账会计
  59. conname: $('#sc_conname').val(),//string 联系人姓名
  60. contel: $('#sc_contel').val(),//string 联系人电话
  61. token: $.cookie("token")
  62. };
  63. return param;
  64. },
  65. onLoadSuccess: function () { //加载成功时执行
  66. //layer.msg("加载成功");
  67. if ($.cookie("userRoleId") == '17' || $.cookie("userRoleId") == '57') {
  68. $('.hide_btn').show();
  69. }
  70. },
  71. onLoadError: function () { //加载失败时执行
  72. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  73. }
  74. });
  75. }
  76. //格式化操作
  77. function formatterOprate(val, row) {
  78. return '<ul class="tool_downs">' +
  79. '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_details_' + row.F_CustomerId + '" onclick="btn_details(\'' + row.F_CustomerId + '\')" title="详情">详情</a></li>' +
  80. '<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>' +
  81. // '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_addCus_' + row.F_CustomerId + '" onclick="btn_addCus(\'' + row.F_CustomerId + '\')" title="添加联系人信息">添加</a></li>' +
  82. '<li><a href="javascript:;" class="aBtn hide_btn" authorize="yes" id="HY_delete_' + row.F_CustomerId + '" onclick="btn_delete(' + row.F_CustomerId + ')" title="删除">删除</a></li>' +
  83. '</ul>';
  84. }
  85. //格式化 内容
  86. function formatterContent(val) {
  87. var strD = '-';
  88. if (val) {
  89. strD = helper.filter.filterHTMLTag(val);
  90. if (strD.length > 30) {
  91. strD = strD.substring(0, 30) + '...';
  92. }
  93. }
  94. return strD;
  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_import() {
  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_export(obj) {
  159. var url = huayi.config.callcenter_url + "CustomerNew/ExportList?token=" + $.cookie("token");
  160. url += "&keywords=" + $('#sc_key').val();//string 关键词
  161. url += "&code=" + $("#sc_code").val();//string 客户姓名
  162. url += "&legtel=" + $("#sc_legtel").val();//string 客户电话
  163. obj.href = url;
  164. }
  165. //批量删除
  166. function btn_deletes() {
  167. var ids = $.map($('#cusList').bootstrapTable('getSelections'),
  168. function (row) {
  169. return row.F_CustomerId;
  170. });
  171. /*判断长度*/
  172. if (ids.length <= 0) {
  173. layer.confirm('请选择要删除的选项', {
  174. icon: 7,
  175. btn: ['确定'] //按钮
  176. });
  177. return;
  178. }
  179. btn_delete(ids);
  180. }
  181. //删除
  182. function btn_delete(cid) {
  183. layer.confirm('确定删除当前记录?', {
  184. icon: 7,
  185. btn: ['是', '否'] //按钮
  186. }, function (index) {
  187. /*执行删除*/
  188. $.ajax({
  189. type: "post",
  190. url: huayi.config.callcenter_url + "CustomerNew/DelCustomer",
  191. dataType: 'json',
  192. async: true,
  193. data: {
  194. ids: cid,//客户Id,可多选[1,2,3]
  195. token: $.cookie("token")
  196. },
  197. success: function (data) {
  198. layer.msg("删除成功!");
  199. $('#cusList').bootstrapTable('refresh');
  200. layer.close(index);
  201. }
  202. });
  203. });
  204. }