zhenggaijindu.js 4.1 KB

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