index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. const api = require("../api/api")
  2. import Dialog from 'tdesign-miniprogram/dialog/index';
  3. Page({
  4. data: {
  5. },
  6. /* 修改团队 */
  7. checkTeam(e) {
  8. const {
  9. status,
  10. sa_workorderid
  11. } = this.data.billData;
  12. console.log("工单状态", status)
  13. wx.navigateTo({
  14. url: `/Universal/dataTeam/index?ownertable=sa_workorder&ownerid=${sa_workorderid}`,
  15. })
  16. },
  17. /* 是否阻止跳转 */
  18. isStopToPage() {
  19. if (this.data.billData.status != '进行中') {
  20. wx.showToast({
  21. title: '当前工单状态不支持操作!',
  22. icon: "none"
  23. })
  24. }
  25. },
  26. async mainData() {
  27. const res = await api._post({
  28. "id": "20230208140103",
  29. "content": {
  30. nocache: true,
  31. "sa_workorderid": this.data.id
  32. }
  33. })
  34. console.log("详情", res)
  35. this.setData({
  36. billData: res.data
  37. })
  38. },
  39. changeBillStatus(data) {
  40. let id = data.currentTarget.dataset.id
  41. const dialogConfig = {
  42. context: this,
  43. title: '提示',
  44. content: '确认执行当前操作吗?',
  45. confirmBtn: '确定',
  46. cancelBtn: '取消',
  47. };
  48. Dialog.confirm(dialogConfig)
  49. .then(async () => {
  50. if (id == '20230209144503') {
  51. getApp().globalData.handelSelect = this
  52. wx.navigateTo({
  53. url: '/Eservice/workBillConfirmInfo/index',
  54. })
  55. } else {
  56. const res = await api._post({
  57. "id": id,
  58. "content": {
  59. "sa_workorderid": this.data.id
  60. }
  61. })
  62. this.mainData()
  63. }
  64. })
  65. .catch(() => console.log('点击了取消'))
  66. .finally(() => Dialog.close());
  67. },
  68. async addConfirmBill() {
  69. const res = await api._post({
  70. "id": "20230211105703",
  71. "version": 1,
  72. "content": {
  73. "sa_workorder_confirmationid": 0,
  74. "sa_workorderid": this.data.id,
  75. "attitudescore": 0,
  76. "responsescore": 0,
  77. }
  78. })
  79. if (this.data.billData.type === '安装培训') {
  80. wx.navigateTo({
  81. url: '/Eservice/trainConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  82. })
  83. } else if (this.data.billData.type === '安装调试') {
  84. wx.navigateTo({
  85. url: '/Eservice/installConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  86. })
  87. } else {
  88. wx.navigateTo({
  89. url: '/Eservice/serviceConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
  90. })
  91. }
  92. },
  93. toConfirmBill(data) {
  94. if (this.data.billData.type === '安装培训') {
  95. wx.navigateTo({
  96. url: '/Eservice/trainConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
  97. })
  98. } else if (this.data.billData.type === '安装调试') {
  99. wx.navigateTo({
  100. url: '/Eservice/installConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
  101. })
  102. } else {
  103. wx.navigateTo({
  104. url: '/Eservice/serviceConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
  105. })
  106. }
  107. },
  108. async confirmBillList() {
  109. const res = await api._post({
  110. "id": "20230211105903",
  111. "content": {
  112. "where": {
  113. "condition": "",
  114. "sa_workorderid": this.data.id
  115. }
  116. }
  117. })
  118. this.setData({
  119. confirmBills: res.data
  120. })
  121. },
  122. toWorkConfirmInfo() {
  123. getApp().globalData.handelSelect = this
  124. wx.navigateTo({
  125. url: '/Eservice/workBillConfirmInfo/index?class=' + this.data.stopClick,
  126. })
  127. },
  128. onLoad(options) {
  129. this.setData({
  130. id: options.id,
  131. stopClick: options.class
  132. })
  133. },
  134. onShow() {
  135. this.mainData()
  136. this.confirmBillList()
  137. },
  138. })