celldetail.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // pages/tabber/news/index.js
  2. const app=getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. taskInfo: {},
  9. show: false,
  10. show1: false,
  11. title:"",
  12. edit:"",
  13. id:0,
  14. remark:"",
  15. cold:0, // 1:能冻结,2:能解冻
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: function (options) {
  21. this.setData({
  22. id:options.id
  23. })
  24. this. gettaskdetail()
  25. },
  26. /**
  27. * 生命周期函数--监听页面初次渲染完成
  28. */
  29. onReady: function () {
  30. },
  31. show: function () {
  32. this.setData({
  33. show: !this.data.show,
  34. title:'冻结格口',
  35. edit:'冻结',
  36. url:'Frozen'
  37. })
  38. },
  39. show3: function () {
  40. this.setData({
  41. show: !this.data.show,
  42. title:'解冻格口',
  43. edit:'解冻',
  44. url:'Thaw'
  45. })
  46. },
  47. show1: function () {
  48. this.setData({
  49. show: !this.data.show,
  50. title:'检修开柜',
  51. edit:'开柜',
  52. url:'Overhaul'
  53. })
  54. },
  55. gettaskdetail() {
  56. var that = this
  57. app.api.useApi(app.globalData.baseAppUrl + "api/admin/LatticeDetails", {
  58. id: that.data.id,
  59. }, "post").then(function (res) {
  60. console.log(res);
  61. if (res.code != 200) {
  62. wx.showLoading({
  63. title: res.message.msg,
  64. })
  65. setTimeout(function () {
  66. wx.hideLoading();
  67. }, 1000);
  68. } else {
  69. wx.hideLoading();
  70. // 1:能冻结,2:能解冻
  71. if(res.message.data.status=='空闲'){
  72. that.setData({cold: 1})
  73. }else{
  74. that.setData({cold: 2})
  75. }
  76. that.setData({
  77. taskInfo: res.message.data
  78. })
  79. }
  80. }).catch(function (err) {
  81. console.log(222);
  82. })
  83. },
  84. opentask(e) {
  85. var that = this
  86. var url=this.data.url
  87. app.api.useApi(app.globalData.baseAppUrl + "api/admin/"+url, {
  88. id: this.data.id,
  89. remark:this.data.remark
  90. }, "post").then(function (res) {
  91. console.log(res);
  92. if (res.code != 200) {
  93. wx.showLoading({
  94. title: res.message.msg,
  95. })
  96. setTimeout(function () {
  97. wx.hideLoading();
  98. }, 1000);
  99. } else {
  100. wx.hideLoading();
  101. that.setData({
  102. show: !that.data.show,
  103. // taskInfo: res.message.data
  104. })
  105. that.gettaskdetail()
  106. }
  107. }).catch(function (err) {
  108. console.log(222);
  109. })
  110. },
  111. onChange(event) {
  112. // event.detail 为当前输入的值
  113. // console.log(event.detail);
  114. this.setData({
  115. remark: event.detail
  116. })
  117. },
  118. })