xungengdetails.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. //标记点
  20. markers: [{
  21. id: 0,
  22. name: "编程小石头",
  23. address: "长春首佳科技有限公司",
  24. latitude: 43.8691319,
  25. longitude: 125.3504459,
  26. width: 35,
  27. height: 50
  28. }]
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad(options) {
  34. this.setData({
  35. id: options.id
  36. })
  37. this.getDetails(options.id)
  38. },
  39. getDetails(id) {
  40. wx.showLoading()
  41. let obj = new Object();
  42. obj.busPatrolstationCode = this.data.id
  43. http.post("/system/AppPatrolstationController/getPatrolstationDetail", obj, this.getDetailsSuccess)
  44. },
  45. getDetailsSuccess(res) {
  46. console.log("!!!", 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. }, 1000);
  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. markers: [{
  66. id: Number(res.data[0].busPatrolstationId),
  67. name: res.data[0].busPatrolstationName,
  68. latitude: res.data[0].latitude,
  69. longitude: res.data[0].longitude,
  70. width: 35,
  71. height: 50
  72. }]
  73. })
  74. }
  75. },
  76. bindViewEdit() {
  77. console.log("@@@", this.data.busEnterpriseId)
  78. console.log("@@@", this.data.busPatrolstationId)
  79. wx.navigateTo({
  80. url: '../new_patrol_point/new_patrol_point?enterpriseId=' + this.data.busEnterpriseId + "&busPatrolstationId=" + this.data.busPatrolstationId + "&isEdit=y",
  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. console.log("@@@", res)
  92. wx.hideLoading()
  93. wx.showToast({
  94. title: res.msg,
  95. icon: 'none'
  96. })
  97. setTimeout(() => {
  98. if (res.code == 200) {
  99. wx.navigateBack()
  100. }
  101. }, 1000);
  102. },
  103. bindViewXunGengJiLu() {
  104. wx.navigateTo({
  105. url: '../xungengjilu/xungengjilu?busPatrolstationId=' + this.data.busPatrolstationId,
  106. })
  107. },
  108. bindViewQiYeDelete() {
  109. let that = this
  110. wx.showModal({
  111. title: "提示",
  112. content: "确定要删除编号为" + this.data.orgCode + "的巡更点吗?",
  113. success: function (sm) {
  114. if (sm.confirm) {
  115. let obj = new Object()
  116. obj.busPatrolstationId = that.data.busPatrolstationId
  117. http.post("/system/AppPatrolstationController/deletePatrolstationList", obj, that.deleteSuccess)
  118. }
  119. }
  120. })
  121. },
  122. deleteSuccess(res) {
  123. console.log("@@", res)
  124. wx.showToast({
  125. title: res.msg,
  126. icon: 'none'
  127. })
  128. setTimeout(() => {
  129. if (res.code == 200) {
  130. wx.navigateBack()
  131. }
  132. }, 1000);
  133. },
  134. /**
  135. * 生命周期函数--监听页面初次渲染完成
  136. */
  137. onReady() {
  138. },
  139. /**
  140. * 生命周期函数--监听页面显示
  141. */
  142. onShow() {
  143. },
  144. /**
  145. * 生命周期函数--监听页面隐藏
  146. */
  147. onHide() {
  148. },
  149. /**
  150. * 生命周期函数--监听页面卸载
  151. */
  152. onUnload() {
  153. },
  154. /**
  155. * 页面相关事件处理函数--监听用户下拉动作
  156. */
  157. onPullDownRefresh() {
  158. },
  159. /**
  160. * 页面上拉触底事件的处理函数
  161. */
  162. onReachBottom() {
  163. },
  164. /**
  165. * 用户点击右上角分享
  166. */
  167. onShareAppMessage() {
  168. }
  169. })