| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- // packageA/pages/recordDetail/recordDetail.js
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- inputValue1: '',
- inputValue2: '',
- startTime: '请选择时间', //默认起始时间
- endTime: '请选择时间', //默认结束时间
- startStamp: null, // 开始时间戳
- endStamp: null, // 结束时间戳
- startOrenDFlag: true,
- // 上拉加载
- total: '',
- dataUrl: '',
- listData: [],
- isPage: false,
- pageSize: 15,
- pageNum: 1,
- loading: false,
- noMore: false,
- loadingFailed: false,
- scrollY: '',
- fUserid: '', // 用户ID
- scaling: false, // 控制筛选框
- date3: null, //筛选时间
- time3: null, // 开始时间
- date4: null, //结束时间筛选
- time4: null, //结束时间筛选
- directorName: null, // 园长名称
- objectName: null, // 公园名称
- showBtnFlag: false, // 权限判断
- },
- //页面跳转
- nav(e) {
- ////console.log("路径", e.currentTarget.dataset.url)
- var url = e.currentTarget.dataset.url;
- wx.navigateTo({
- url: url,
- });
- },
- //到达底部
- scrollToLower(e) {
- if (!this.data.loading && !this.data.noMore) {
- this.setData({
- loading: true,
- pageNum: this.data.pageNum + 1,
- });
- this.getData(true);
- }
- },
- //请求数据
- getData(isPage) {
- var that = this;
- var url = app.globalData.httpsUrlServer +'/tbaseemployeeworkrecords/selectEmployeeworkrecordsByPageList';
- var data = {
- size: 15,
- current: that.data.pageNum,
- workStartTime: that.data.time3,
- workEndTime: that.data.time4,
- fExpand2: that.data.objectName,
- fRealname: that.data.directorName,
- fExpandint1: that.data.fUserid,
- };
- if (that.data.noMore) {
- that.setData({
- noMore: false,
- });
- }
- //请求
- wx.showLoading({
- title: '加载中',
- mark: 'true',
- });
- app.postReq(url, data, (res) => {
- if (res.message == '请求成功') {
- wx.hideLoading();
- if (isPage) {
- //下一页的数据拼接在原有数据后面
- ////console.log(res.data.data)
- that.setData({
- listData: that.data.listData.concat(res.data.data),
- total: res.data.total,
- loading: false,
- });
- } else {
- //第一页数据直接赋值
- that.setData({
- listData: res.data.data,
- total: res.data.total,
- });
- }
- if (that.data.total == that.data.listData.length) {
- that.setData({
- noMore: true,
- });
- }
- } else {
- that.setData({
- loading: false,
- });
- }
- wx.hideLoading();
- });
- },
- // 选择筛选条件
- showScaling() {
- ////console.log("ss")
- this.setData({
- scaling: true,
- });
- },
- // 关闭筛选
- close() {
- this.setData({
- scaling: false,
- });
- },
- // 重置
- qxScaling() {
- this.setData({
- pageNum: 1,
- listData: [],
- date3: null, //筛选时间
- time3: null, // 开始时间
- date4: null, //结束时间筛选
- time4: null, //结束时间筛选
- directorName: null, // 园长名称
- objectName: null, // 公园名称
- showBtnFlag: false, // 权限判断
- });
- },
- // 确定
- qdScaling() {
- var that = this;
- that.setData({
- scaling: false,
- pageNum: 1,
- scrollY: 0,
- listData: [],
- });
- this.getData(true);
- },
- // 园长名称
- parkname2(e) {
- this.setData({
- directorName: e.detail.value,
- });
- },
- // 计划公园
- parkname3(e) {
- this.setData({
- objectName: e.detail.value,
- });
- },
- // 筛选日期(开始)
- bindDateChange3(e) {
- let val = e.detail.value;
- let timeStr = val + ' 00:00:00';
- let times = new Date(timeStr).getTime();
- if (this.data.time4) {
- if (times >= new Date(this.data.time4).getTime()) {
- return app.toast('不能大于结束时间');
- }
- }
- this.setData({
- date3: val,
- time3: timeStr,
- });
- },
- // 筛选日期(结束)
- bindDateChange4(e) {
- let val = e.detail.value;
- let timeStr = val + ' 23:59:59';
- let times = new Date(timeStr).getTime();
- if (this.data.time3) {
- if (times <= new Date(this.data.time3).getTime()) {
- return app.toast('不能小于开始时间');
- }
- }
- this.setData({
- date4: val,
- time4: timeStr,
- });
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (wx.getStorageSync('position')) {
- var flag = '';
- if (wx.getStorageSync('position') == '中心') {
- flag = false;
- } else {
- flag = true;
- }
- this.setData({
- showBtnFlag: flag,
- });
- }
- // 获取请求地址
- this.setData({
- dataUrl: app.globalData.httpsUrlServer,
- fUserid: wx.getStorageSync('fUserid'),
- });
- this.getData(true);
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {},
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {},
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {},
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {},
- });
|