zhenggaijindu.js 4.1 KB

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