运维小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

index.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. const api = require('../../api/index.js');
  2. Page({
  3. data: {
  4. visible:false,
  5. tabsindex:"1,2",
  6. workorderName:'',
  7. datestart:'',
  8. dateend:'',
  9. array:['日常','故障','其他'],
  10. priority:'',
  11. index:'',
  12. reviewdata:[],
  13. examineType:0
  14. },
  15. onLoad() {
  16. },
  17. // 选项卡
  18. onTabsChange(e){
  19. console.log(e.detail.value);
  20. this.setData({
  21. tabsindex:e.detail.value
  22. })
  23. this.gitreview()
  24. },
  25. // 输入工单名称
  26. onPeakprice(e){
  27. console.log(e.detail.value);
  28. this.setData({
  29. workorderName:e.detail.value
  30. })
  31. },
  32. // 事件
  33. bindeventChange(e){
  34. console.log(e.detail.value);
  35. this.setData({
  36. index:e.detail.value
  37. })
  38. },
  39. // 开始事件
  40. bindstartChange: function(e) {
  41. console.log('picker发送选择改变,携带值为', e.detail.value)
  42. this.setData({
  43. datestart: e.detail.value
  44. })
  45. },
  46. // 结束时间
  47. bindendChange: function(e) {
  48. console.log('picker发送选择改变,携带值为', e.detail.value)
  49. this.setData({
  50. dateend: e.detail.value
  51. })
  52. },
  53. // 工单优先级
  54. onradio(e){
  55. console.log(e.detail.value);
  56. this.setData({
  57. priority:e.detail.value
  58. })
  59. },
  60. // 工单审核状态
  61. onexamineType(e){
  62. console.log(e.detail.value);
  63. this.setData({
  64. examineType:e.detail.value
  65. })
  66. },
  67. onworkorder(){
  68. this.setData({
  69. visible:false
  70. })
  71. this.gitreview()
  72. },
  73. onreset(){
  74. this.setData({
  75. workorderName:'',
  76. tabsindex:"1,2",
  77. datestart:'',
  78. dateend:'',
  79. index:'',
  80. priority:'',
  81. examineType:0
  82. })
  83. this.gitreview()
  84. },
  85. gitreview(){
  86. let data = {
  87. workorderName:this.data.workorderName,
  88. workorderType:this.data.tabsindex==0?'':this.data.tabsindex,
  89. workorderAddress:'',
  90. starttime:this.data.datestart,
  91. endtime:this.data.dateend,
  92. type:this.data.index==''?'':this.data.index*1+1,
  93. examineType:this.data.examineType==0?'':this.data.examineType
  94. }
  95. api.request(`/workoder/selectworkoder`, 'POST',data)
  96. .then((res) => {
  97. if (res.data) {
  98. this.setData({
  99. reviewdata:res.data
  100. })
  101. }else{
  102. this.setData({
  103. reviewdata:[]
  104. })
  105. }
  106. })
  107. .catch((err) => {
  108. console.error('请求失败:', err);
  109. // 在这里处理请求失败的情况
  110. });
  111. },
  112. onfilter(){
  113. this.setData({
  114. visible:true
  115. })
  116. },
  117. onVisibleChange(){
  118. this.setData({
  119. visible:false
  120. })
  121. },
  122. ondetails(e){
  123. console.log(e.currentTarget.dataset);
  124. wx.navigateTo({
  125. url: `/pages/workorderdetails/index?id=${e.currentTarget.dataset.id}&workorderId=${e.currentTarget.dataset.workorderid}`,
  126. })
  127. },
  128. onShow() {
  129. // this.setData({
  130. // workorderName:'',
  131. // tabsindex:"1,2",
  132. // datestart:'',
  133. // dateend:'',
  134. // index:''
  135. // })
  136. this.gitreview()
  137. },
  138. /**
  139. * 页面相关事件处理函数--监听用户下拉动作
  140. */
  141. async onPullDownRefresh() {
  142. await this.gitreview()
  143. await wx.stopPullDownRefresh();
  144. }
  145. });