Keine Beschreibung

maintainProjectBF.js 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /**
  2. * 维系项目时效维护
  3. * */
  4. $(function() {
  5. getbz()
  6. $('.tool_bars').authorizeButton();
  7. laydate.render({
  8. elem: '#sc_times',
  9. range: '~',
  10. theme: '#249fea',
  11. });
  12. initTable();
  13. //搜索
  14. $("#sc_btns").click(function() {
  15. initTable();
  16. });
  17. });
  18. // 获取班组
  19. function getbz() {
  20. $("#bzid").html('');
  21. $("#bzid").append('<option selected="selected" value="">请选择班组</option>');
  22. $.getJSON(huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/getallbzcount", function(data) {
  23. if (data.state.toLowerCase() == "success") {
  24. var province = data.data;
  25. for (var i = 0; i < province.length; i++) {
  26. $("<option value='" + province[i].id + "'>" + province[i].role_name + "</option>").appendTo("#bzid");
  27. $('#bzid').selectpicker('refresh');
  28. }
  29. }else{
  30. $("#bzid").empty();
  31. $("#bzid").selectpicker('refresh');
  32. }
  33. })
  34. }
  35. // 列表
  36. function initTable() {
  37. //先销毁表格
  38. $('#table_all').bootstrapTable('destroy');
  39. //初始化表格,动态从服务器加载数据
  40. $('#table_all').bootstrapTable({
  41. method: "get", //使用get请求到服务器获取数据 equipmentapi/api/WoRepairBase/getwxwpstimetree
  42. // url: huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/getwxwptimestabs", //获取数据的Servlet地址
  43. url: huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/getwxwpstimetree", //获取数据的Servlet地
  44. contentType: "application/x-www-form-urlencoded",
  45. striped: true, //表格显示条纹
  46. pagination: true, //启动分页
  47. pageSize: 10, //每页显示的记录数
  48. pageNumber: 1, //当前第几页
  49. pageList: [10, 20, 50, 100], //记录数可选列表
  50. search: false, //是否启用查询
  51. showColumns: false, //显示下拉框勾选要显示的列
  52. showRefresh: false, //显示刷新按钮
  53. sidePagination: "server", //表示服务端请求
  54. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  55. //设置为limit可以获取limit, offset, search, sort, order
  56. queryParamsType: "undefined",
  57. queryParams: function queryParams(params) { //设置查询参数
  58. var param = {
  59. pageindex: params.pageNumber, //否 string 当前页
  60. pagesize: params.pageSize, //否 string 每页记录数
  61. bzid:$("#bzid").val()
  62. // key: $('#sc_key').val(), //否 string 模糊查询(姓名,手机号码,固话)
  63. // //typeid 否 string 类型id
  64. // stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], //开始时间
  65. // etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1], //结束时间
  66. };
  67. return param;
  68. },
  69. responseHandler: function(res) {
  70. return {
  71. "total": res.data && res.data.total, //总页数
  72. "rows": res.data && res.data.rows //数据
  73. };
  74. },
  75. onLoadSuccess: function(res) { //加载成功时执行
  76. //layer.msg("加载成功");
  77. $('.tool_downs').authorizeOperateButton();
  78. },
  79. onLoadError: function() { //加载失败时执行
  80. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  81. }
  82. });
  83. }
  84. //格式化操作
  85. function formatterOperate(val, row) {
  86. return '<ul class="tool_downs">' +
  87. '<li><a class="aBtn" authorize="yes" id="HY_edit_' + row.id + '" onclick="btn_edit(\'' + row.id + '\')">编辑</a></li>' +
  88. '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id + '\')">删除</a></li>' +
  89. '</ul>';
  90. }
  91. //查看客户详情
  92. // function btn_details(rcode) {
  93. // layer.open({
  94. // type: 2,
  95. // content: "template/seeCustomerDetails.html?edit_id=" + rcode, //iframe的url,no代表不显示滚动条
  96. // title: '查看客户信息详情',
  97. // resize: false,
  98. // area: ['80%', '90%'], //宽高
  99. // });
  100. // }
  101. //添加
  102. function btn_add() {
  103. layer.open({
  104. type: 2,
  105. content: "template/addmaintainProject.html?", //iframe的url,no代表不显示滚动条
  106. title: '添加维系项目时效维护',
  107. resize: false,
  108. area: ['80%', '90%'], //宽高
  109. });
  110. }
  111. //编辑
  112. function btn_edit(edit_id) {
  113. layer.open({
  114. type: 2,
  115. content: "template/addmaintainProject.html?edit_id=" + edit_id, //iframe的url,no代表不显示滚动条
  116. title: '编辑维系项目时效维护',
  117. resize: false,
  118. area: ['80%', '90%'], //宽高
  119. });
  120. }
  121. //批量删除
  122. // function btn_deletes() {
  123. // var ids = $.map($('#table_all').bootstrapTable('getSelections'),
  124. // function(row) {
  125. // return row.id;
  126. // });
  127. // /*判断长度*/
  128. // if(ids.length <= 0) {
  129. // layer.confirm('请选择要删除的选项', {
  130. // icon: 7,
  131. // btn: ['确定'] //按钮
  132. // });
  133. // return;
  134. // }
  135. // btn_delete(ids);
  136. // }
  137. //删除
  138. function btn_delete(del_id) {
  139. /*发送请求*/
  140. layer.confirm('您确定要删除当前维系项目时效维护信息吗?', {
  141. icon: 7,
  142. btn: ['确定', '取消'],
  143. yes: function(index, layero) {
  144. $.get(huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/delewxwptimestabs", {
  145. id: del_id,
  146. }, function(result) {
  147. result = JSON.parse(result);
  148. if(result.state.toLowerCase() == "success") {
  149. layer.msg("删除成功");
  150. $('#table_all').bootstrapTable('refresh');
  151. }
  152. })
  153. },
  154. });
  155. }