index.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. disabled: {
  5. type: Boolean,
  6. value: false
  7. },
  8. billData: {
  9. type: Object
  10. },
  11. class1: {
  12. type: String,
  13. value: ""
  14. }
  15. },
  16. options: {
  17. addGlobalClass: true
  18. },
  19. lifetimes: {
  20. attached: function () {
  21. getApp().globalData.Language.getLanguagePackage(this)
  22. }
  23. },
  24. data: {
  25. sa_workorderid: 0,
  26. content: {
  27. nocache: true,
  28. pageNumber: 1,
  29. pageSize: 10,
  30. pageTotal: 1,
  31. total: null,
  32. where: {
  33. condition: ""
  34. }
  35. },
  36. list: [],
  37. showSearch: false,
  38. focus: false,
  39. condition: ""
  40. },
  41. methods: {
  42. getList(id, init = false) {
  43. console.log("getList", id)
  44. let content = {
  45. ...this.data.content,
  46. sa_workorderid: id || this.data.sa_workorderid
  47. };
  48. content.where.sa_workorderid = content.sa_workorderid
  49. if (init) {
  50. content.pageNumber = 1
  51. content.pageTotal = 1
  52. }
  53. _Http.basic({
  54. "id": 20230211105903,
  55. content
  56. }).then(res => {
  57. console.log("服务确认单", res)
  58. if (res.code != '1') return wx.showToast({
  59. title: res.data,
  60. icon: "none"
  61. });
  62. this.setData({
  63. "content.pageNumber": res.pageNumber + 1,
  64. "content.pageTotal": res.pageTotal,
  65. "content.total": res.total,
  66. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  67. sa_workorderid: content.sa_workorderid
  68. })
  69. })
  70. },
  71. async addConfirmBill() {
  72. const res = await _Http.basic({
  73. "id": "20230211105703",
  74. "version": 1,
  75. "content": {
  76. "sa_workorder_confirmationid": 0,
  77. "sa_workorderid": this.data.sa_workorderid,
  78. "attitudescore": 0,
  79. "responsescore": 0,
  80. }
  81. })
  82. if (this.data.billData.actiontype === "非工序模板") {
  83. wx.navigateTo({
  84. url: '/Eservice/materielConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  85. })
  86. } else if (this.data.billData.type === '安装培训') {
  87. wx.navigateTo({
  88. url: '/Eservice/trainConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  89. })
  90. } else if (this.data.billData.type === '安装调试') {
  91. wx.navigateTo({
  92. url: '/Eservice/installConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  93. })
  94. } else {
  95. wx.navigateTo({
  96. url: '/Eservice/serviceConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  97. })
  98. }
  99. _Http.updateList = this.getList.bind(this)
  100. },
  101. toConfirmBill(data) {
  102. let class1 = this.data.class1;
  103. if (!class1) this.data.billData.status != '进行中' ? '&class=stopClick' : ''
  104. console.log("class1", class1)
  105. if (this.data.billData.actiontype === "非工序模板") {
  106. wx.navigateTo({
  107. url: '/Eservice/materielConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + class1,
  108. })
  109. } else if (this.data.billData.type === '安装培训') {
  110. wx.navigateTo({
  111. url: '/Eservice/trainConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + class1,
  112. })
  113. } else if (this.data.billData.type === '安装调试') {
  114. wx.navigateTo({
  115. url: '/Eservice/installConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + class1,
  116. })
  117. } else {
  118. wx.navigateTo({
  119. url: '/Eservice/serviceConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + class1,
  120. })
  121. }
  122. _Http.updateList = this.getList.bind(this)
  123. },
  124. toSearch() {
  125. if (this.data.showSearch && this.data.content.where.condition) {
  126. this.data.content.where.condition = '';
  127. this.getList("", true);
  128. } else if (this.data.condition) {
  129. this.data.content.where.condition = this.data.condition;
  130. this.setData({
  131. condition: this.data.condition
  132. })
  133. this.getList("", true);
  134. }
  135. this.setData({
  136. showSearch: !this.data.showSearch
  137. })
  138. setTimeout(() => {
  139. this.setData({
  140. focus: this.data.showSearch
  141. })
  142. }, 300)
  143. },
  144. onChange({
  145. detail
  146. }) {
  147. this.data.condition = detail;
  148. },
  149. onSearch({
  150. detail
  151. }) {
  152. this.data.content.where.condition = detail;
  153. this.getList("", true)
  154. },
  155. }
  156. })