xungengdetails.js 4.2 KB

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