1
0

taxcomparederror.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. $(function () {
  2. $("#jqGrid").jqGrid({
  3. url: '../taxcomparederror/list',
  4. datatype: "json",
  5. colModel: [
  6. {label: 'mtceId', name: 'mtceId', index: 'mtce_id', key: true, hidden: true},
  7. {label: '', name: 'merchOrderSn', index: 'merch_order_sn', width: 80},
  8. {label: '', name: 'kmallTax', index: 'kmall_tax', width: 80},
  9. {label: '', name: 'omsTax', index: 'oms_tax', width: 80},
  10. {label: '', name: 'createTime', index: 'create_time', width: 80}],
  11. viewrecords: true,
  12. height: 550,
  13. rowNum: 10,
  14. rowList: [10, 30, 50],
  15. rownumbers: true,
  16. rownumWidth: 25,
  17. autowidth: true,
  18. multiselect: true,
  19. pager: "#jqGridPager",
  20. jsonReader: {
  21. root: "page.list",
  22. page: "page.currPage",
  23. total: "page.totalPage",
  24. records: "page.totalCount"
  25. },
  26. prmNames: {
  27. page: "page",
  28. rows: "limit",
  29. order: "order"
  30. },
  31. gridComplete: function () {
  32. $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
  33. }
  34. });
  35. });
  36. let vm = new Vue({
  37. el: '#rrapp',
  38. data: {
  39. showList: true,
  40. title: null,
  41. taxComparedError: {},
  42. ruleValidate: {
  43. },
  44. q: {
  45. name: '',
  46. createTime:''
  47. }
  48. },
  49. methods: {
  50. query: function () {
  51. vm.reload();
  52. },
  53. add: function () {
  54. vm.showList = false;
  55. vm.title = "新增";
  56. vm.taxComparedError = {};
  57. },
  58. update: function (event) {
  59. let mtceId = getSelectedRow();
  60. if (mtceId == null) {
  61. return;
  62. }
  63. vm.showList = false;
  64. vm.title = "修改";
  65. vm.getInfo(mtceId)
  66. },
  67. saveOrUpdate: function (event) {
  68. let url = vm.taxComparedError.mtceId == null ? "../taxcomparederror/save" : "../taxcomparederror/update";
  69. $.ajax({
  70. type: "POST",
  71. url: url,
  72. contentType: "application/json",
  73. data: JSON.stringify(vm.taxComparedError),
  74. success: function (r) {
  75. if (r.code === 0) {
  76. alert('操作成功', function (index) {
  77. vm.reload();
  78. });
  79. } else {
  80. alert(r.msg);
  81. }
  82. }
  83. });
  84. },
  85. del: function (event) {
  86. let mtceIds = getSelectedRows();
  87. if (mtceIds == null){
  88. return;
  89. }
  90. confirm('确定要删除选中的记录?', function () {
  91. $.ajax({
  92. type: "POST",
  93. url: "../taxcomparederror/delete",
  94. contentType: "application/json",
  95. data: JSON.stringify(mtceIds),
  96. success: function (r) {
  97. if (r.code == 0) {
  98. alert('操作成功', function (index) {
  99. $("#jqGrid").trigger("reloadGrid");
  100. });
  101. } else {
  102. alert(r.msg);
  103. }
  104. }
  105. });
  106. });
  107. },
  108. getInfo: function(mtceId){
  109. $.get("../taxcomparederror/info/"+mtceId, function (r) {
  110. vm.taxComparedError = r.taxComparedError;
  111. });
  112. },
  113. reloadSearch: function() {
  114. vm.q = {
  115. name: '',
  116. createTime:'',
  117. }
  118. vm.reload();
  119. },
  120. reload: function (event) {
  121. vm.showList = true;
  122. let page = $("#jqGrid").jqGrid('getGridParam', 'page');
  123. $("#jqGrid").jqGrid('setGridParam', {
  124. postData: {'name': vm.q.name , 'createTime':vm.q.createTime},
  125. page: page
  126. }).trigger("reloadGrid");
  127. vm.handleReset('formValidate');
  128. },
  129. handleSubmit: function (name) {
  130. handleSubmitValidate(this, name, function () {
  131. vm.saveOrUpdate()
  132. });
  133. },
  134. handleReset: function (name) {
  135. handleResetForm(this, name);
  136. }
  137. }
  138. });