No Description

comprehensiveQuery.js 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /**
  2. * 综合查询
  3. * */
  4. $(function() {
  5. $('.tool_bars').authorizeButton();
  6. //省市二级联动
  7. helper.getDropList.getProLocation($('#sc_province'), $('#sc_city'));
  8. //工单来源
  9. helper.getDropList.getlistDropByDic($('#sc_source'), 'GDLY');
  10. //工单类型
  11. helper.getDropList.getlistDropByDic($('#sc_type'), 'GDLX');
  12. laydate.render({
  13. elem: '#sc_times',
  14. range: '~',
  15. theme: '#249fea',
  16. });
  17. initTable();
  18. //搜索
  19. $("#sc_btns").click(function() {
  20. initTable();
  21. });
  22. });
  23. function initTable() {
  24. //先销毁表格
  25. $('#table_all').bootstrapTable('destroy');
  26. //初始化表格,动态从服务器加载数据
  27. $('#table_all').bootstrapTable({
  28. method: "get", //使用get请求到服务器获取数据
  29. url: huayi.config.callcenter_url + "callcenterapi/api/BusOrder/getlistbypage", //获取数据的Servlet地址
  30. contentType: "application/x-www-form-urlencoded",
  31. striped: true, //表格显示条纹
  32. pagination: true, //启动分页
  33. pageSize: 10, //每页显示的记录数
  34. pageNumber: 1, //当前第几页
  35. pageList: [10, 20, 50, 100], //记录数可选列表
  36. search: false, //是否启用查询
  37. showColumns: false, //显示下拉框勾选要显示的列
  38. showRefresh: false, //显示刷新按钮
  39. sidePagination: "server", //表示服务端请求
  40. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  41. //设置为limit可以获取limit, offset, search, sort, order
  42. queryParamsType: "undefined",
  43. queryParams: function queryParams(params) { //设置查询参数
  44. var param = {
  45. pageindex: params.pageNumber, //int 页码
  46. pagesize: params.pageSize, //int 条数
  47. ordercode: $('#sc_ordercode').val(), // 否 string 模糊查询(工单编号)
  48. phone: $('#sc_tel').val(), // 否 string 模糊查询(号码)
  49. province: $('#sc_province').val(), // 否 string 省code
  50. citycode: $('#sc_city').val(), // 否 string 市code
  51. sourceid: $('#sc_source').val(), // 否 string 来源id
  52. typeid: $('#sc_type').val(), // 否 string 类型id
  53. stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], //开始时间
  54. etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1], //结束时间
  55. //key 否 string 模糊查询(工单标题内容)
  56. };
  57. return param;
  58. },
  59. responseHandler: function(res) {
  60. return {
  61. "total": res.data && res.data.total, //总页数
  62. "rows": res.data && res.data.rows //数据
  63. };
  64. },
  65. onLoadSuccess: function(res) { //加载成功时执行
  66. //layer.msg("加载成功");
  67. $('.tool_downs').authorizeOperateButton();
  68. },
  69. onLoadError: function() { //加载失败时执行
  70. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  71. }
  72. });
  73. }
  74. //格式化操作
  75. function formatterOperate(val, row) {
  76. return '<ul class="tool_downs">' +
  77. '<li><a class="aBtn" authorize="yes" id="HY_detail_' + row.ordercode + '" onclick="btn_details(\'' + row.ordercode + '\')">详情</a></li>' +
  78. '<li><a class="aBtn" authorize="yes" id="HY_edit_' + row.ordercode + '" onclick="btn_edit(\'' + row.ordercode + '\')">编辑</a></li>' +
  79. '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id + '\')">删除</a></li>' +
  80. '</ul>';
  81. }
  82. //格式化地址
  83. function formatterAddress(val, row) {
  84. var locations = '';
  85. var address = '';
  86. if(val){
  87. locations = val + row.cityname;
  88. }
  89. if(row.address){
  90. address = row.address;
  91. }
  92. return locations + address;
  93. }
  94. //格式化内容
  95. function formatterContent(val, row) {
  96. if(val) {
  97. var codeContent = decodeURIComponent(val);
  98. codeContent = helper.filter.delHtmlTag(codeContent);
  99. codeContent = $.trim(codeContent);
  100. var cc = codeContent.length > 20 ? codeContent.substr(0, 20) + '...' : codeContent;
  101. return '<div title="' + codeContent + '">' + cc + '</div>';
  102. } else {
  103. return '-';
  104. }
  105. }
  106. //格式化创建人
  107. function formatterCreateuser(val, row){
  108. return val + '-' + row.createusername;
  109. }
  110. //查看工单详情
  111. function btn_details(rcode) {
  112. layer.open({
  113. type: 2,
  114. content: "template/seeOrderDetails.html?edit_id=" + rcode, //iframe的url,no代表不显示滚动条
  115. title: '查看工单详情',
  116. resize: false,
  117. area: ['80%', '90%'], //宽高
  118. });
  119. }
  120. //编辑
  121. function btn_edit(edit_id) {
  122. layer.open({
  123. type: 2,
  124. content: "template/addOrEditOrder.html?edit_id=" + edit_id, //iframe的url,no代表不显示滚动条
  125. title: '编辑工单',
  126. resize: false,
  127. area: ['80%', '90%'], //宽高
  128. });
  129. }
  130. //批量删除
  131. function btn_deletes() {
  132. var ids = $.map($('#table_all').bootstrapTable('getSelections'),
  133. function(row) {
  134. return row.id;
  135. });
  136. /*判断长度*/
  137. if(ids.length <= 0) {
  138. layer.confirm('请选择要删除的选项', {
  139. icon: 7,
  140. btn: ['确定'] //按钮
  141. });
  142. return;
  143. }
  144. btn_delete(ids);
  145. }
  146. //删除
  147. function btn_delete(del_id) {
  148. /*发送请求*/
  149. layer.confirm('您确定要删除当前工单吗?', {
  150. icon: 7,
  151. btn: ['确定', '取消'],
  152. yes: function(index, layero) {
  153. $.post(huayi.config.callcenter_url + "callcenterapi/api/BusOrder/delete", {
  154. ids: del_id,
  155. }, function(result) {
  156. result = JSON.parse(result);
  157. if(result.state.toLowerCase() == "success") {
  158. layer.msg("删除成功");
  159. $('#table_all').bootstrapTable('refresh');
  160. }
  161. })
  162. },
  163. });
  164. }