xungengdetails.js 4.1 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. console.log("!!!", res)
  48. wx.hideLoading()
  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. console.log("@@@", this.data.busEnterpriseId)
  80. console.log("@@@", this.data.busPatrolstationId)
  81. wx.navigateTo({
  82. url: '../update_patrol_point/update_patrol_point?enterpriseId=' + this.data.busEnterpriseId + "&code=" + this.data.orgCode,
  83. })
  84. },
  85. bindViewXungeng() {
  86. // this.data.lasttime=util.formatDate(new Date(e.data.zgtzs.lastTime),'yyyy年MM月dd日') ;
  87. wx.showLoading()
  88. let obj = new Object();
  89. obj.busPatrolstationId = this.data.busPatrolstationId
  90. http.post("/system/AppXungengController/doXungeng", obj, this.getXunGengSuccess)
  91. },
  92. getXunGengSuccess(res) {
  93. console.log("@@@", res)
  94. wx.hideLoading()
  95. wx.showToast({
  96. title: res.msg,
  97. icon: 'none'
  98. })
  99. setTimeout(() => {
  100. if (res.code == 200) {
  101. wx.navigateBack()
  102. }
  103. }, 1000);
  104. },
  105. bindViewXunGengJiLu() {
  106. wx.navigateTo({
  107. url: '../xungengjilu/xungengjilu?busPatrolstationId=' + this.data.busPatrolstationId,
  108. })
  109. },
  110. bindViewQiYeDelete() {
  111. let that = this
  112. wx.showModal({
  113. title: "提示",
  114. content: "确定要弃用编号为" + this.data.orgCode + "的巡更点吗?",
  115. success: function (sm) {
  116. if (sm.confirm) {
  117. let obj = new Object()
  118. obj.busPatrolstationId = that.data.busPatrolstationId
  119. http.post("/system/AppPatrolstationController/deletePatrolstationList", obj, that.deleteSuccess)
  120. }
  121. }
  122. })
  123. },
  124. deleteSuccess(res) {
  125. console.log("@@", res)
  126. wx.showToast({
  127. title: res.msg,
  128. icon: 'none'
  129. })
  130. setTimeout(() => {
  131. if (res.code == 200) {
  132. wx.navigateBack()
  133. }
  134. }, 1000);
  135. },
  136. /**
  137. * 生命周期函数--监听页面初次渲染完成
  138. */
  139. onReady() {
  140. },
  141. /**
  142. * 生命周期函数--监听页面隐藏
  143. */
  144. onHide() {
  145. },
  146. /**
  147. * 生命周期函数--监听页面卸载
  148. */
  149. onUnload() {
  150. },
  151. /**
  152. * 页面相关事件处理函数--监听用户下拉动作
  153. */
  154. onPullDownRefresh() {
  155. },
  156. /**
  157. * 页面上拉触底事件的处理函数
  158. */
  159. onReachBottom() {
  160. },
  161. /**
  162. * 用户点击右上角分享
  163. */
  164. onShareAppMessage() {
  165. }
  166. })