zhenggaijindu.js 4.2 KB

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