remoteService.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. var util = require('../../../utils/util.js')
  2. const app = getApp();
  3. Page({
  4. data: {
  5. calcDate: util.getToday(),
  6. isShow: true,
  7. noData:'../../../images/noData.png',
  8. dataListTips: "暂无数据",
  9. g_createrId:"",
  10. inputvalue:"",
  11. //表格请求参数~~
  12. table: {
  13. getdataListParm: {
  14. name: 'getRemoteApp',
  15. page: 1,
  16. offset: 1,
  17. pagecount: 20,
  18. returntype: 'Map',
  19. parammaps: {
  20. inputvalue: "",
  21. beginDate: util.get7daysAgo(),
  22. endDate: util.getToday(),
  23. userId: "",
  24. roleId: "",
  25. }
  26. },
  27. tableKey: 0,
  28. list: [
  29. // {"content":"想做计步器宣传,目前已让任老师帮忙做。","customerId":378,"customerName":"天津振杰","id":827,"receiverId":1497,"receiverName":"张振强","receiverTel":"","remark":"","vdate":"2020-10-16","visiterId":30,"visiterName":"高占永"},
  30. // {"content":"兴安盟牧场已确定安装我司饲喂系统,目前正在走流程。","customerId":255,"customerName":"原阳富源牧业","id":826,"receiverId":1341,"receiverName":"贾又春","receiverTel":"","remark":"","vdate":"2020-09-27","visiterId":30,"visiterName":"高占永"},
  31. // {"content":"沟通款项,已支付","customerId":643,"customerName":"木易牧场","id":825,"receiverId":1333,"receiverName":"李宝丽","receiverTel":"","remark":"","vdate":"2020-09-24","visiterId":30,"visiterName":"高占永"}
  32. ],
  33. total: 0,
  34. listLoading: true,
  35. },
  36. },
  37. onReachBottom: function () {
  38. console.log('下拉分页')
  39. var offset = this.data.table.getdataListParm.offset + 1
  40. this.setData({['table.getdataListParm.offset']: offset})
  41. this.getList()
  42. },
  43. onLoad: function (options) {
  44. this.setData({
  45. g_createrId:app.globalData.g_createrId,
  46. ['table.getdataListParm.parammaps.userId']:app.globalData.g_userId,
  47. ['table.getdataListParm.parammaps.roleId']:app.globalData.g_roleId
  48. })
  49. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess2)
  50. },
  51. //加载表格
  52. getList() {
  53. console.log("表格请求数据:", this.data.table.getdataListParm)
  54. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess2)
  55. },
  56. getListSuccess1: function (res) {
  57. console.log('table数据======>', res.data.list)
  58. if (res.data.list !== null) {
  59. this.setData({
  60. isShow: true,
  61. ['table.list']: res.data.list,
  62. ['table.getdataListParm.offset']: res.data.pageNum,
  63. ['table.total']: res.data.total
  64. })
  65. } else {
  66. this.setData({
  67. ['table.list']: [],
  68. ['table.getdataListParm.offset']: res.data.pageNum,
  69. isShow: false,
  70. dataListTips: "暂无数据"
  71. })
  72. }
  73. },
  74. getListSuccess2: function (res) {
  75. console.log('table数据======>', res.data)
  76. var tempList = res.data.list;
  77. if (res.data.list !== null) {
  78. this.setData({
  79. isShow: true,
  80. ['table.list']: this.data.table.list.concat(tempList),
  81. ['table.getdataListParm.offset']: res.data.pageNum,
  82. ['table.total']: res.data.total
  83. })
  84. } else {
  85. this.setData({
  86. ['table.getdataListParm.offset']: res.data.pageNum
  87. })
  88. }
  89. },
  90. //搜索内容
  91. change_inputvalue:function(e){
  92. var value = e.detail.value
  93. this.setData({
  94. ['table.getdataListParm.parammaps.inputvalue']: value
  95. })
  96. },
  97. //搜索按钮
  98. on_search_tap(e) {
  99. this.setData({
  100. ['table.getdataListParm.offset']:1,
  101. })
  102. console.log("表格请求数据:", this.data.table.getdataListParm)
  103. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1)
  104. },
  105. //清空按钮
  106. on_error_tap(e) {
  107. console.log("搜索清空")
  108. this.setData({
  109. inputvalue:"",
  110. ['table.getdataListParm.parammaps.inputvalue']:""
  111. })
  112. this.setData({
  113. ['table.getdataListParm.offset']:1,
  114. })
  115. console.log("表格请求数据:", this.data.table.getdataListParm)
  116. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1)
  117. },
  118. //日期1
  119. bindDateChange1: function (e) {
  120. this.setData({
  121. ['table.getdataListParm.offset']:1,
  122. ['table.getdataListParm.parammaps.beginDate']: e.detail.value
  123. })
  124. console.log("表格请求数据:", this.data.table.getdataListParm)
  125. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1)
  126. },
  127. //日期2
  128. bindDateChange2: function (e) {
  129. this.setData({
  130. ['table.getdataListParm.offset']:1,
  131. ['table.getdataListParm.parammaps.endDate']: e.detail.value
  132. })
  133. console.log("表格请求数据:", this.data.table.getdataListParm)
  134. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1)
  135. },
  136. //查看
  137. on_see_tap: function (e) {
  138. var id = e.currentTarget.dataset.id;
  139. wx.navigateTo({ url:"../remoteServiceSee/remoteServiceSee?id=" + id})
  140. },
  141. //编辑
  142. on_edit_tap: function (e) {
  143. var id = e.currentTarget.dataset.id;
  144. wx.navigateTo({ url:"../remoteServiceEdit/remoteServiceEdit?id=" + id})
  145. },
  146. //新增
  147. on_add_tap: function (e) {
  148. wx.navigateTo({ url:"../remoteServiceAdd/remoteServiceAdd"})
  149. },
  150. })