xungengdetails.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. // pages/xungengdetails/xungengdetails.js
  2. import http from '../../base/httputil'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. id: null,
  10. host: app.globalData.host,
  11. //店铺经纬度
  12. latitude: 43.8691319,
  13. longitude: 125.3504459,
  14. businessName: null,
  15. busEnterpriseId: null,
  16. busPatrolstationId: null,
  17. busPatrolstationName: null,
  18. orgCode: null,
  19. remark:null,
  20. //标记点
  21. markers: [{
  22. id: 0,
  23. name: "编程小石头",
  24. address: "长春首佳科技有限公司",
  25. latitude: 43.8691319,
  26. longitude: 125.3504459,
  27. width: 35,
  28. height: 50
  29. }]
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad(options) {
  35. this.data.id=options.id
  36. },
  37. onShow(){
  38. this.getDetails()
  39. },
  40. getDetails() {
  41. wx.showLoading()
  42. let obj = new Object();
  43. obj.busPatrolstationCode = this.data.id
  44. http.post("/system/AppPatrolstationController/getPatrolstationDetail", obj, this.getDetailsSuccess)
  45. },
  46. getDetailsSuccess(res) {
  47. wx.hideLoading()
  48. debugger
  49. if (res.data.length == 0) {
  50. wx.showToast({
  51. title: '暂无巡更点',
  52. icon: 'none'
  53. })
  54. setTimeout(() => {
  55. wx.navigateBack()
  56. }, 2000);
  57. } else {
  58. this.setData({
  59. businessName: res.data[0].busEnterpriseName,
  60. orgCode: res.data[0].busPatrolstationCode,
  61. busEnterpriseId: res.data[0].busEnterpriseId,
  62. busPatrolstationId: res.data[0].busPatrolstationId,
  63. busPatrolstationName: res.data[0].busPatrolstationName,
  64. latitude: res.data[0].latitude,
  65. longitude: res.data[0].longitude,
  66. remark:res.data[0].remarks,
  67. markers: [{
  68. id: Number(res.data[0].busPatrolstationId),
  69. name: res.data[0].busPatrolstationName,
  70. latitude: res.data[0].latitude,
  71. longitude: res.data[0].longitude,
  72. width: 35,
  73. height: 50
  74. }]
  75. })
  76. }
  77. },
  78. bindViewEdit() {
  79. wx.navigateTo({
  80. url: '../update_patrol_point/update_patrol_point?enterpriseId=' + this.data.busEnterpriseId + "&code=" + this.data.orgCode,
  81. })
  82. },
  83. bindViewXungeng() {
  84. // this.data.lasttime=util.formatDate(new Date(e.data.zgtzs.lastTime),'yyyy年MM月dd日') ;
  85. wx.showLoading()
  86. let obj = new Object();
  87. obj.busPatrolstationId = this.data.busPatrolstationId
  88. http.post("/system/AppXungengController/doXungeng", obj, this.getXunGengSuccess)
  89. },
  90. getXunGengSuccess(res) {
  91. wx.hideLoading()
  92. wx.showToast({
  93. title: res.msg,
  94. icon: 'none'
  95. })
  96. setTimeout(() => {
  97. if (res.code == 200) {
  98. wx.navigateBack()
  99. }
  100. }, 1000);
  101. },
  102. bindViewXunGengJiLu() {
  103. wx.navigateTo({
  104. url: '../xungengjilu/xungengjilu?busPatrolstationId=' + this.data.busPatrolstationId,
  105. })
  106. },
  107. bindViewQiYeDelete() {
  108. let that = this
  109. wx.showModal({
  110. title: "提示",
  111. content: "确定要弃用编号为" + this.data.orgCode + "的巡更点吗?",
  112. success: function (sm) {
  113. if (sm.confirm) {
  114. let obj = new Object()
  115. obj.busPatrolstationId = that.data.busPatrolstationId
  116. http.post("/system/AppPatrolstationController/deletePatrolstationList", obj, that.deleteSuccess)
  117. }
  118. }
  119. })
  120. },
  121. deleteSuccess(res) {
  122. wx.showToast({
  123. title: res.msg,
  124. icon: 'none'
  125. })
  126. setTimeout(() => {
  127. if (res.code == 200) {
  128. wx.navigateBack()
  129. }
  130. }, 1000);
  131. },
  132. /**
  133. * 生命周期函数--监听页面初次渲染完成
  134. */
  135. onReady() {
  136. },
  137. /**
  138. * 生命周期函数--监听页面隐藏
  139. */
  140. onHide() {
  141. },
  142. /**
  143. * 生命周期函数--监听页面卸载
  144. */
  145. onUnload() {
  146. },
  147. /**
  148. * 页面相关事件处理函数--监听用户下拉动作
  149. */
  150. onPullDownRefresh() {
  151. },
  152. /**
  153. * 页面上拉触底事件的处理函数
  154. */
  155. onReachBottom() {
  156. },
  157. /**
  158. * 用户点击右上角分享
  159. */
  160. onShareAppMessage() {
  161. }
  162. })