zhenggaijindu.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. import http from '../../base/httputil'
  2. const app = getApp()
  3. Page({
  4. onLoad(e) {
  5. this.setData({
  6. buslogId: e.buslogId,
  7. busInspectionId: e.busInspectionId
  8. })
  9. this.getZhenggaijindu(e.busInspectionId)
  10. },
  11. getZhenggaijindu(busInspectionId) {
  12. let obj = new Object();
  13. obj.busInspectionId = busInspectionId
  14. http.post("/system/AppZhenggaijinduController/getZhenggaijindu", obj, this.getZhenggaijinduSuccess);
  15. },
  16. getZhenggaijinduSuccess(res) {
  17. console.log("******jindu", res)
  18. this.data.pictureBasePath = res.pictureBasePath
  19. this.setData({
  20. pictureBasePath: res.pictureBasePath,
  21. zgjdList: res.zgjdList
  22. })
  23. if(res.zgjdList!=null&&res.zgjdList.length>0){
  24. if ( res.zgjdList[0].riskStatus == "risk_status_2") {
  25. this.setData({
  26. flag: false
  27. })
  28. }else{
  29. this.setData({
  30. flag: true
  31. })
  32. }
  33. }else{
  34. this.setData({
  35. flag: false
  36. })
  37. }
  38. },
  39. bindPickerChange: function (e) {
  40. let nume = e.detail.value
  41. console.log('picker发送选择改变,携带值为', parseInt(nume) + 1)
  42. let obj = new Object();
  43. obj.busInspectionId = this.data.busInspectionId
  44. obj.logId = this.data.buslogId
  45. obj.lat_day = parseInt(nume) + 1
  46. http.send_post("/system/AppXunjianController/changeInspection", obj, this.getChangeSuccess);
  47. },
  48. getChangeSuccess(res) {
  49. console.log("&&&&", res)
  50. if (res.code == 200) {
  51. this.setData({
  52. //index: e.detail.value,
  53. isRefreshUP: true
  54. })
  55. this.getZhenggaijindu(this.data.busInspectionId)
  56. }
  57. },
  58. /**
  59. * 页面的初始数据
  60. */
  61. data: {
  62. host: app.globalData.host,
  63. flag: false,
  64. pictureBasePath: null,
  65. zgjdList: null,
  66. isRefreshUP: false,
  67. buslogId: '',
  68. busInspectionId: '',
  69. processData: [{
  70. name: '提交工单',
  71. start: '#fff',
  72. end: '#EFF3F6',
  73. icon: '../../img/process_1.png'
  74. },
  75. {
  76. name: '已接单',
  77. start: '#EFF3F6',
  78. end: '#EFF3F6',
  79. icon: '../../img/process_1.png'
  80. },
  81. {
  82. name: '开始维修',
  83. start: '#EFF3F6',
  84. end: '#EFF3F6',
  85. icon: '../../img/process_1.png'
  86. },
  87. {
  88. name: '维修结束',
  89. start: '#EFF3F6',
  90. end: '#EFF3F6',
  91. icon: '../../img/process_1.png'
  92. },
  93. {
  94. name: '已确认',
  95. start: '#EFF3F6',
  96. end: '#fff',
  97. icon: '../../img/process_1.png'
  98. }
  99. ],
  100. array: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'],
  101. index: 0,
  102. },
  103. //进度条的状态
  104. setPeocessIcon: function () {
  105. var index = 0 //记录状态为1的最后的位置
  106. var processArr = this.data.processData
  107. // console.log("progress", this.data.detailData.progress)
  108. for (var i = 0; i < this.data.detailData.progress.length; i++) {
  109. var item = this.data.detailData.progress[i]
  110. processArr[i].name = item.word
  111. if (item.state == 1) {
  112. index = i
  113. processArr[i].icon = "../../img/process_3.png"
  114. processArr[i].start = "#45B2FE"
  115. processArr[i].end = "#45B2FE"
  116. } else {
  117. processArr[i].icon = "../../img/process_1.png"
  118. processArr[i].start = "#EFF3F6"
  119. processArr[i].end = "#EFF3F6"
  120. }
  121. }
  122. processArr[index].icon = "../../img/process_2.png"
  123. processArr[index].end = "#EFF3F6"
  124. processArr[0].start = "#fff"
  125. processArr[this.data.detailData.progress.length - 1].end = "#fff"
  126. this.setData({
  127. processData: processArr
  128. })
  129. },
  130. onUnload() {
  131. let page = getCurrentPages();
  132. let prevPage = page[page.length - 2];
  133. prevPage.setData({
  134. isRefresh: this.data.isRefreshUP,
  135. });
  136. },
  137. bindFinish() {
  138. wx.showModal({
  139. title: '提示',
  140. content: '确认整改完成吗?',
  141. complete: (res) => {
  142. if (res.cancel) {
  143. }
  144. if (res.confirm) {
  145. let obj = new Object();
  146. obj.busInspectionId = this.data.busInspectionId
  147. obj.logId = this.data.buslogId
  148. obj.riskStatus = "risk_status_2"
  149. http.send_post("/system/AppXunjianController/changeInspection", obj, this.getChangeSuccess);
  150. }
  151. }
  152. })
  153. },
  154. })