Aucune description

recordDetail.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. // packageA/pages/recordDetail/recordDetail.js
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. inputValue1: '',
  9. inputValue2: '',
  10. startTime: '请选择时间', //默认起始时间
  11. endTime: '请选择时间', //默认结束时间
  12. startStamp: null, // 开始时间戳
  13. endStamp: null, // 结束时间戳
  14. startOrenDFlag: true,
  15. // 上拉加载
  16. total: '',
  17. dataUrl: '',
  18. listData: [],
  19. isPage: false,
  20. pageSize: 15,
  21. pageNum: 1,
  22. loading: false,
  23. noMore: false,
  24. loadingFailed: false,
  25. scrollY: '',
  26. fUserid: '', // 用户ID
  27. scaling: false, // 控制筛选框
  28. date3: null, //筛选时间
  29. time3: null, // 开始时间
  30. date4: null, //结束时间筛选
  31. time4: null, //结束时间筛选
  32. directorName: null, // 园长名称
  33. objectName: null, // 公园名称
  34. showBtnFlag: false, // 权限判断
  35. },
  36. //页面跳转
  37. nav(e) {
  38. ////console.log("路径", e.currentTarget.dataset.url)
  39. var url = e.currentTarget.dataset.url;
  40. wx.navigateTo({
  41. url: url,
  42. });
  43. },
  44. //到达底部
  45. scrollToLower(e) {
  46. if (!this.data.loading && !this.data.noMore) {
  47. this.setData({
  48. loading: true,
  49. pageNum: this.data.pageNum + 1,
  50. });
  51. this.getData(true);
  52. }
  53. },
  54. //请求数据
  55. getData(isPage) {
  56. var that = this;
  57. var url = app.globalData.httpsUrlServer +'/tbaseemployeeworkrecords/selectEmployeeworkrecordsByPageList';
  58. var data = {
  59. size: 15,
  60. current: that.data.pageNum,
  61. workStartTime: that.data.time3,
  62. workEndTime: that.data.time4,
  63. fExpand2: that.data.objectName,
  64. fRealname: that.data.directorName,
  65. fExpandint1: that.data.fUserid,
  66. };
  67. if (that.data.noMore) {
  68. that.setData({
  69. noMore: false,
  70. });
  71. }
  72. //请求
  73. wx.showLoading({
  74. title: '加载中',
  75. mark: 'true',
  76. });
  77. app.postReq(url, data, (res) => {
  78. if (res.message == '请求成功') {
  79. wx.hideLoading();
  80. if (isPage) {
  81. //下一页的数据拼接在原有数据后面
  82. ////console.log(res.data.data)
  83. that.setData({
  84. listData: that.data.listData.concat(res.data.data),
  85. total: res.data.total,
  86. loading: false,
  87. });
  88. } else {
  89. //第一页数据直接赋值
  90. that.setData({
  91. listData: res.data.data,
  92. total: res.data.total,
  93. });
  94. }
  95. if (that.data.total == that.data.listData.length) {
  96. that.setData({
  97. noMore: true,
  98. });
  99. }
  100. } else {
  101. that.setData({
  102. loading: false,
  103. });
  104. }
  105. wx.hideLoading();
  106. });
  107. },
  108. // 选择筛选条件
  109. showScaling() {
  110. ////console.log("ss")
  111. this.setData({
  112. scaling: true,
  113. });
  114. },
  115. // 关闭筛选
  116. close() {
  117. this.setData({
  118. scaling: false,
  119. });
  120. },
  121. // 重置
  122. qxScaling() {
  123. this.setData({
  124. pageNum: 1,
  125. listData: [],
  126. date3: null, //筛选时间
  127. time3: null, // 开始时间
  128. date4: null, //结束时间筛选
  129. time4: null, //结束时间筛选
  130. directorName: null, // 园长名称
  131. objectName: null, // 公园名称
  132. showBtnFlag: false, // 权限判断
  133. });
  134. },
  135. // 确定
  136. qdScaling() {
  137. var that = this;
  138. that.setData({
  139. scaling: false,
  140. pageNum: 1,
  141. scrollY: 0,
  142. listData: [],
  143. });
  144. this.getData(true);
  145. },
  146. // 园长名称
  147. parkname2(e) {
  148. this.setData({
  149. directorName: e.detail.value,
  150. });
  151. },
  152. // 计划公园
  153. parkname3(e) {
  154. this.setData({
  155. objectName: e.detail.value,
  156. });
  157. },
  158. // 筛选日期(开始)
  159. bindDateChange3(e) {
  160. let val = e.detail.value;
  161. let timeStr = val + ' 00:00:00';
  162. let times = new Date(timeStr).getTime();
  163. if (this.data.time4) {
  164. if (times >= new Date(this.data.time4).getTime()) {
  165. return app.toast('不能大于结束时间');
  166. }
  167. }
  168. this.setData({
  169. date3: val,
  170. time3: timeStr,
  171. });
  172. },
  173. // 筛选日期(结束)
  174. bindDateChange4(e) {
  175. let val = e.detail.value;
  176. let timeStr = val + ' 23:59:59';
  177. let times = new Date(timeStr).getTime();
  178. if (this.data.time3) {
  179. if (times <= new Date(this.data.time3).getTime()) {
  180. return app.toast('不能小于开始时间');
  181. }
  182. }
  183. this.setData({
  184. date4: val,
  185. time4: timeStr,
  186. });
  187. },
  188. /**
  189. * 生命周期函数--监听页面加载
  190. */
  191. onLoad: function (options) {
  192. if (wx.getStorageSync('position')) {
  193. var flag = '';
  194. if (wx.getStorageSync('position') == '中心') {
  195. flag = false;
  196. } else {
  197. flag = true;
  198. }
  199. this.setData({
  200. showBtnFlag: flag,
  201. });
  202. }
  203. // 获取请求地址
  204. this.setData({
  205. dataUrl: app.globalData.httpsUrlServer,
  206. fUserid: wx.getStorageSync('fUserid'),
  207. });
  208. this.getData(true);
  209. },
  210. /**
  211. * 生命周期函数--监听页面初次渲染完成
  212. */
  213. onReady: function () {},
  214. /**
  215. * 生命周期函数--监听页面显示
  216. */
  217. onShow: function () {},
  218. /**
  219. * 生命周期函数--监听页面隐藏
  220. */
  221. onHide: function () {},
  222. /**
  223. * 生命周期函数--监听页面卸载
  224. */
  225. onUnload: function () {},
  226. /**
  227. * 页面相关事件处理函数--监听用户下拉动作
  228. */
  229. onPullDownRefresh: function () {},
  230. /**
  231. * 页面上拉触底事件的处理函数
  232. */
  233. onReachBottom: function () {},
  234. /**
  235. * 用户点击右上角分享
  236. */
  237. onShareAppMessage: function () {},
  238. });