123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- const app = getApp()
- const util = require("../../../utils/util");
- const api = require('../../../api/api.js');
- const user = require('../../../utils/user.js');
- import moment from 'moment'
- Page({
- data: {
- showPicker:false,
- teamList:[],
- columns:[],
- teamName:'',
- teamId:''
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getSchTeamList()
- },
- getSchTeamList(){
- util.request(api.getSchTeamList, {
-
- }, 'GET').then(res => {
- wx.hideLoading();
- if (res.errno === 0) {
- this.setData({
- teamList:res.data,
- });
- let columns=this.data.teamList.map(item=>{return item.teamName });
- this.setData({
- columns:columns
- });
-
- }
- }).catch(err => {
- wx.hideLoading();
- });
- },
- applyTeam(){
- if(this.data.teamName==''){
- wx.showToast({
- title: '请选择更换的班组',
- icon: 'none',
- });
- return false;
- }
- wx.showLoading({
- title: '加载中...',
- });
- util.request(api.applyTeam, {
- teamId:this.data.teamId,
- teamName:this.data.teamName
- }, 'POST').then(res => {
- wx.hideLoading();
- if (res.errno === 0) {
- wx.showModal({
- title: '',
- content: '操作成功',
- showCancel: false,
- success:res => {
- if (res.confirm) {
- wx.navigateBack();
- }
- }
- });
- }
- }).catch(err => {
- wx.hideLoading();
- });
- },
- showSelect(){
- this.setData({
- showPicker:true
- });
- },
- pickerCancel(e){
- this.setData({
- showPicker:false
- });
- },
- pickerConfirm(e){
- this.setData({
- showPicker:false,
- teamName:e.detail.value,
- teamId:this.data.teamList[e.detail.index].teamId
- });
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- onHide: function () {
- },
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- })
|