sendsmsrecord.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. $(function () {
  2. $("#jqGrid").jqGrid({
  3. url: '../sendsmsrecord/list',
  4. datatype: "json",
  5. colModel: [
  6. {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
  7. {label: '订单编号', name: 'orderSn', index: 'order_sn', width: 100},
  8. {label: '清单编号', name: 'clearNo', index: 'clear_no', width: 100},
  9. {label: '手机号码', name: 'phoneNumbers', index: 'phone_numbers', width: 100},
  10. {label: '发送状态', name: 'sendStatus', index: 'send_status', width: 80,
  11. formatter: function (value) {
  12. if (value == 0) {
  13. return "<span class=''>失败</span>";
  14. } else {
  15. return "<span class='success'>成功</span>";
  16. }
  17. }},
  18. {label: '发送失败原因', name: 'sendFailMsg', index: 'send_fail_msg', width: 100},
  19. {label: '请求id', name: 'requestId', index: 'request_id', width: 80},
  20. {label: '回执id', name: 'bizId', index: 'biz_id', width: 80}
  21. ],
  22. viewrecords: true,
  23. height: 550,
  24. rowNum: 10,
  25. rowList: [10, 30, 50],
  26. rownumbers: true,
  27. rownumWidth: 25,
  28. autowidth: true,
  29. multiselect: true,
  30. pager: "#jqGridPager",
  31. jsonReader: {
  32. root: "page.list",
  33. page: "page.currPage",
  34. total: "page.totalPage",
  35. records: "page.totalCount"
  36. },
  37. prmNames: {
  38. page: "page",
  39. rows: "limit",
  40. order: "order"
  41. },
  42. gridComplete: function () {
  43. $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
  44. }
  45. });
  46. });
  47. let vm = new Vue({
  48. el: '#rrapp',
  49. data: {
  50. showList: true,
  51. title: null,
  52. sendSmsRecord: {},
  53. ruleValidate: {
  54. name: [
  55. {required: true, message: '名称不能为空', trigger: 'blur'}
  56. ]
  57. },
  58. q: {
  59. orderSn: '',
  60. clearNo: '',
  61. phoneNumbers: '',
  62. sendStatus: ''
  63. }
  64. },
  65. methods: {
  66. query: function () {
  67. vm.reload();
  68. },
  69. add: function () {
  70. vm.showList = false;
  71. vm.title = "新增";
  72. vm.sendSmsRecord = {};
  73. },
  74. update: function (event) {
  75. let id = getSelectedRow();
  76. if (id == null) {
  77. return;
  78. }
  79. vm.showList = false;
  80. vm.title = "修改";
  81. vm.getInfo(id)
  82. },
  83. saveOrUpdate: function (event) {
  84. let url = vm.sendSmsRecord.id == null ? "../sendsmsrecord/save" : "../sendsmsrecord/update";
  85. $.ajax({
  86. type: "POST",
  87. url: url,
  88. contentType: "application/json",
  89. data: JSON.stringify(vm.sendSmsRecord),
  90. success: function (r) {
  91. if (r.code === 0) {
  92. alert('操作成功', function (index) {
  93. vm.reload();
  94. });
  95. } else {
  96. alert(r.msg);
  97. }
  98. }
  99. });
  100. },
  101. del: function (event) {
  102. let ids = getSelectedRows();
  103. if (ids == null){
  104. return;
  105. }
  106. confirm('确定要删除选中的记录?', function () {
  107. $.ajax({
  108. type: "POST",
  109. url: "../sendsmsrecord/delete",
  110. contentType: "application/json",
  111. data: JSON.stringify(ids),
  112. success: function (r) {
  113. if (r.code == 0) {
  114. alert('操作成功', function (index) {
  115. $("#jqGrid").trigger("reloadGrid");
  116. });
  117. } else {
  118. alert(r.msg);
  119. }
  120. }
  121. });
  122. });
  123. },
  124. getInfo: function(id){
  125. $.get("../sendsmsrecord/info/"+id, function (r) {
  126. vm.sendSmsRecord = r.sendSmsRecord;
  127. });
  128. },
  129. reloadSearch: function() {
  130. vm.q = {
  131. orderSn: '',
  132. clearNo: '',
  133. phoneNumbers: '',
  134. sendStatus: ''
  135. }
  136. vm.reload();
  137. },
  138. reload: function (event) {
  139. vm.showList = true;
  140. let page = $("#jqGrid").jqGrid('getGridParam', 'page');
  141. $("#jqGrid").jqGrid('setGridParam', {
  142. postData: {
  143. 'orderSn': vm.q.orderSn,
  144. 'clearNo': vm.q.clearNo,
  145. 'phoneNumbers': vm.q.phoneNumbers,
  146. 'sendStatus': vm.q.sendStatus
  147. },
  148. page: page
  149. }).trigger("reloadGrid");
  150. vm.handleReset('formValidate');
  151. },
  152. handleSubmit: function (name) {
  153. handleSubmitValidate(this, name, function () {
  154. vm.saveOrUpdate()
  155. });
  156. },
  157. handleReset: function (name) {
  158. handleResetForm(this, name);
  159. },
  160. getSendStatusSelect: function (value) {
  161. vm.q.sendStatus = value;
  162. }
  163. }
  164. });