1
0

mkactivitiesfullgift.js 4.1 KB

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