celldetail.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. this.setData({
  21. id:options.id
  22. })
  23. this. gettaskdetail(options.id)
  24. },
  25. /**
  26. * 生命周期函数--监听页面初次渲染完成
  27. */
  28. onReady: function () {
  29. },
  30. show: function () {
  31. this.setData({
  32. show: !this.data.show,
  33. title:'冻结格口',
  34. edit:'冻结',
  35. url:'Frozen'
  36. })
  37. },
  38. show1: function () {
  39. this.setData({
  40. show: !this.data.show,
  41. title:'检修开柜',
  42. edit:'开柜',
  43. url:'Overhaul'
  44. })
  45. },
  46. gettaskdetail(id) {
  47. var that = this
  48. app.api.useApi(app.globalData.baseAppUrl + "api/admin/LatticeDetails", {
  49. id: id,
  50. }, "post").then(function (res) {
  51. console.log(res);
  52. if (res.code != 200) {
  53. wx.showLoading({
  54. title: res.message.msg,
  55. })
  56. setTimeout(function () {
  57. wx.hideLoading();
  58. }, 1000);
  59. } else {
  60. wx.hideLoading();
  61. that.setData({
  62. taskInfo: res.message.data
  63. })
  64. }
  65. }).catch(function (err) {
  66. console.log(222);
  67. })
  68. },
  69. opentask(e) {
  70. var that = this
  71. var url=this.data.url
  72. app.api.useApi(app.globalData.baseAppUrl + "api/admin/"+url, {
  73. id: this.data.id,
  74. remark:this.data.remark
  75. }, "post").then(function (res) {
  76. console.log(res);
  77. if (res.code != 200) {
  78. wx.showLoading({
  79. title: res.message.msg,
  80. })
  81. setTimeout(function () {
  82. wx.hideLoading();
  83. }, 1000);
  84. } else {
  85. wx.hideLoading();
  86. that.setData({
  87. taskInfo: res.message.data
  88. })
  89. }
  90. }).catch(function (err) {
  91. console.log(222);
  92. })
  93. },
  94. onChange(event) {
  95. // event.detail 为当前输入的值
  96. // console.log(event.detail);
  97. this.setData({
  98. remark: event.detail
  99. })
  100. },
  101. })