123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- const app = getApp()
- const util = require("../../../utils/util");
- const mallapi = require('../../../api/mall.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- companyShortName: '',
- scrollTop: 200,
- inputShowed: false,
- //显示结果view的状态
- viewShowed: false,
- // 搜索框值
- inputVal: "",
- leaveList: [],
- pageNo: 1,
- pageSize: 30,
- total: 0,
- goLeaveState:true,
- },
-
- //取消请假
- cancelLeave: function (e) {
- console.log(e.currentTarget.dataset.id);
- let that=this;
- util.request(mallapi.CancelLeave, {
- id:e.currentTarget.dataset.id
- }, "GET").then(function (res) {
- if (res.errno === 0) {
- that.myshowtost('取消成功')
- that.getWorkerLeaveList();
- }else{
- that.myshowtost('取消失败')
- }
- });
- },
- goLeavepost: function () {
- wx.navigateTo({
- url: '/pages/servant/leavepost/leavepost'
- })
- },
- imgYu (event) {
- var src = event.currentTarget.dataset.src;//获取data-src
- var imgList = event.currentTarget.dataset.list;//获取data-list
- //图片预览
- wx.previewImage({
- current: src, // 当前显示图片的http链接
- urls: imgList // 需要预览的图片http链接列表
- })
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
- },
-
- setGoLeave(){
- //北京不允许请假
- let userInfo = wx.getStorageSync('userInfo');
- if(userInfo.stationName&&userInfo.stationName!=''&&userInfo.stationName.indexOf('北京')!=-1){
- this.setData({
- goLeaveState:false
- })
- }
- },
- getWorkerLeaveList() {
- //最近30条请假够了
- let that=this;
- util.request(mallapi.GetLeavePageList, {
- pageNo: this.data.pageNo,
- pageSize: this.data.pageSize
- }, "GET").then(function (res) {
- if (res.errno === 0) {
-
- res.data.list.forEach(t=>{
- t.leaveStartTime=util.formatTime(new Date(t.leaveStartTime));
- t.leaveEndTime=util.formatTime(new Date(t.leaveEndTime));
- if(t.leaveImages!=null&&t.leaveImages!=''){
- t.imgarr=t.leaveImages.split(',');
- }else{
- t.imgarr=[];
- }
- })
- that.setData({
- leaveList:res.data.list,
- total:res.data.total,
- })
- }
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getWorkerLeaveList();
- this.setGoLeave();
- this.getWorkerLeaveList();
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- console.log('监听用户下拉动作')
- wx.showNavigationBarLoading()
- this.data.shareClueList = []
- this.data.pageNo = 1
- this.getSelectClueReceiveFranData()
- wx.stopPullDownRefresh(); //停止下拉刷新效果
- wx.hideNavigationBarLoading()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
-
-
- //退出
- ComLoginOutBtn: function () {
- wx.navigateBack({});
- },
- myshowtost: function (v) {
- wx.showToast({
- title: v,
- icon: 'none',
- duration: 2000
- })
- },
- })
|