changeSchedue.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. const app = getApp()
  2. const util = require("../../../utils/util");
  3. const api = require('../../../api/api.js');
  4. const user = require('../../../utils/user.js');
  5. import moment from 'moment'
  6. Page({
  7. data: {
  8. showPicker:false,
  9. teamList:[],
  10. columns:[],
  11. teamName:'',
  12. teamId:''
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. this.getSchTeamList()
  19. },
  20. getSchTeamList(){
  21. util.request(api.getSchTeamList, {
  22. }, 'GET').then(res => {
  23. wx.hideLoading();
  24. if (res.errno === 0) {
  25. this.setData({
  26. teamList:res.data,
  27. });
  28. let columns=this.data.teamList.map(item=>{return item.teamName });
  29. this.setData({
  30. columns:columns
  31. });
  32. }
  33. }).catch(err => {
  34. wx.hideLoading();
  35. });
  36. },
  37. applyTeam(){
  38. if(this.data.teamName==''){
  39. wx.showToast({
  40. title: '请选择更换的班组',
  41. icon: 'none',
  42. });
  43. return false;
  44. }
  45. wx.showLoading({
  46. title: '加载中...',
  47. });
  48. util.request(api.applyTeam, {
  49. teamId:this.data.teamId,
  50. teamName:this.data.teamName
  51. }, 'POST').then(res => {
  52. wx.hideLoading();
  53. if (res.errno === 0) {
  54. wx.showModal({
  55. title: '',
  56. content: '操作成功',
  57. showCancel: false,
  58. success:res => {
  59. if (res.confirm) {
  60. wx.navigateBack();
  61. }
  62. }
  63. });
  64. }
  65. }).catch(err => {
  66. wx.hideLoading();
  67. });
  68. },
  69. showSelect(){
  70. this.setData({
  71. showPicker:true
  72. });
  73. },
  74. pickerCancel(e){
  75. this.setData({
  76. showPicker:false
  77. });
  78. },
  79. pickerConfirm(e){
  80. this.setData({
  81. showPicker:false,
  82. teamName:e.detail.value,
  83. teamId:this.data.teamList[e.detail.index].teamId
  84. });
  85. },
  86. /**
  87. * 生命周期函数--监听页面初次渲染完成
  88. */
  89. onReady: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面显示
  93. */
  94. onShow: function () {
  95. },
  96. onHide: function () {
  97. },
  98. onUnload: function () {
  99. },
  100. /**
  101. * 页面相关事件处理函数--监听用户下拉动作
  102. */
  103. onPullDownRefresh: function () {
  104. },
  105. /**
  106. * 页面上拉触底事件的处理函数
  107. */
  108. onReachBottom: function () {
  109. },
  110. /**
  111. * 用户点击右上角分享
  112. */
  113. onShareAppMessage: function () {
  114. },
  115. })