operationList.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // pages/role/addOperation.js
  2. const util = require('../../utils/util.js');
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. searchParams:{
  10. pageNo:1,
  11. pageSize:10,
  12. realname:'',
  13. mgvmRole:1,
  14. },
  15. operationList:[],
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: function (options) {
  21. this.bindOperationList()
  22. },
  23. /**
  24. * 生命周期函数--监听页面初次渲染完成
  25. */
  26. onReady: function () {
  27. },
  28. /**
  29. * 生命周期函数--监听页面显示
  30. */
  31. onShow: function () {
  32. },
  33. /**
  34. * 生命周期函数--监听页面隐藏
  35. */
  36. onHide: function () {
  37. },
  38. /**
  39. * 生命周期函数--监听页面卸载
  40. */
  41. onUnload: function () {
  42. },
  43. /**
  44. * 页面相关事件处理函数--监听用户下拉动作
  45. */
  46. onPullDownRefresh: function () {
  47. },
  48. /**
  49. * 页面上拉触底事件的处理函数
  50. */
  51. onReachBottom: function () {
  52. },
  53. /**
  54. * 用户点击右上角分享
  55. */
  56. onShareAppMessage: function () {
  57. },
  58. toAddOperation(){
  59. wx.navigateTo({
  60. url: '/pages/role/addOperation',
  61. })
  62. },
  63. toEdit(e){
  64. wx.navigateTo({
  65. url: '/pages/role/editOperation?userId='+e.currentTarget.dataset.id,
  66. })
  67. },
  68. bindOperationList(){
  69. var that = this
  70. util.request(util.api.roleListPage, that.data.searchParams, "GET", false, true,app.globalData.token).then((res)=>{
  71. if (res.code == 200) {
  72. that.setData({
  73. operationList: res.result.records,
  74. ["searchParams.pageNo"]: res.result.current,
  75. ["searchParams.pageSize"]: res.result.size,
  76. })
  77. }
  78. }).catch((res) => {})
  79. },
  80. searchOperation(){
  81. this.bindOperationList()
  82. },
  83. inputedit: function (e) {
  84. let _this = this;
  85. let dataset = e.currentTarget.dataset;
  86. let value = e.detail.value;
  87. let name = dataset.name;
  88. _this.data[name] = value;
  89. _this.setData({
  90. [name]: _this.data[name]
  91. });
  92. },
  93. })