xungengdetails.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. if (res.data.length == 0) {
  49. wx.showToast({
  50. title: '暂无巡更点',
  51. icon: 'none'
  52. })
  53. setTimeout(() => {
  54. wx.navigateBack()
  55. }, 2000);
  56. } else {
  57. this.setData({
  58. businessName: res.data[0].busEnterpriseName,
  59. orgCode: res.data[0].busPatrolstationCode,
  60. busEnterpriseId: res.data[0].busEnterpriseId,
  61. busPatrolstationId: res.data[0].busPatrolstationId,
  62. busPatrolstationName: res.data[0].busPatrolstationName,
  63. latitude: res.data[0].latitude,
  64. longitude: res.data[0].longitude,
  65. remark:res.data[0].remarks,
  66. markers: [{
  67. id: Number(res.data[0].busPatrolstationId),
  68. name: res.data[0].busPatrolstationName,
  69. latitude: res.data[0].latitude,
  70. longitude: res.data[0].longitude,
  71. width: 35,
  72. height: 50
  73. }]
  74. })
  75. }
  76. },
  77. bindViewEdit() {
  78. wx.navigateTo({
  79. url: '../update_patrol_point/update_patrol_point?enterpriseId=' + this.data.busEnterpriseId + "&code=" + this.data.orgCode,
  80. })
  81. },
  82. bindViewXungeng() {
  83. // this.data.lasttime=util.formatDate(new Date(e.data.zgtzs.lastTime),'yyyy年MM月dd日') ;
  84. wx.showLoading()
  85. let obj = new Object();
  86. obj.busPatrolstationId = this.data.busPatrolstationId
  87. http.post("/system/AppXungengController/doXungeng", obj, this.getXunGengSuccess)
  88. },
  89. getXunGengSuccess(res) {
  90. wx.hideLoading()
  91. wx.showToast({
  92. title: res.msg,
  93. icon: 'none'
  94. })
  95. setTimeout(() => {
  96. if (res.code == 200) {
  97. wx.navigateBack()
  98. }
  99. }, 1000);
  100. },
  101. bindViewXunGengJiLu() {
  102. wx.navigateTo({
  103. url: '../xungengjilu/xungengjilu?busPatrolstationId=' + this.data.busPatrolstationId,
  104. })
  105. },
  106. bindViewQiYeDelete() {
  107. let that = this
  108. wx.showModal({
  109. title: "提示",
  110. content: "确定要弃用编号为" + this.data.orgCode + "的巡更点吗?",
  111. success: function (sm) {
  112. if (sm.confirm) {
  113. let obj = new Object()
  114. obj.busPatrolstationId = that.data.busPatrolstationId
  115. http.post("/system/AppPatrolstationController/deletePatrolstationList", obj, that.deleteSuccess)
  116. }
  117. }
  118. })
  119. },
  120. deleteSuccess(res) {
  121. wx.showToast({
  122. title: res.msg,
  123. icon: 'none'
  124. })
  125. setTimeout(() => {
  126. if (res.code == 200) {
  127. wx.navigateBack()
  128. }
  129. }, 1000);
  130. },
  131. /**
  132. * 生命周期函数--监听页面初次渲染完成
  133. */
  134. onReady() {
  135. },
  136. /**
  137. * 生命周期函数--监听页面隐藏
  138. */
  139. onHide() {
  140. },
  141. /**
  142. * 生命周期函数--监听页面卸载
  143. */
  144. onUnload() {
  145. },
  146. /**
  147. * 页面相关事件处理函数--监听用户下拉动作
  148. */
  149. onPullDownRefresh() {
  150. },
  151. /**
  152. * 页面上拉触底事件的处理函数
  153. */
  154. onReachBottom() {
  155. },
  156. /**
  157. * 用户点击右上角分享
  158. */
  159. onShareAppMessage() {
  160. }
  161. })