index.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. list: Array,
  5. disabled: Boolean
  6. },
  7. data: {
  8. viewIndex: null
  9. },
  10. options: {
  11. addGlobalClass: true
  12. },
  13. methods: {
  14. selectClient(e) {
  15. if (!this.data.disabled) return;
  16. const {
  17. item
  18. } = e.currentTarget.dataset,
  19. pages = getCurrentPages(),
  20. page = pages[pages.length - 1];
  21. this.setData({
  22. taskname: item.taskname,
  23. content: {
  24. sa_projectid: page.data.detail.sa_projectid,
  25. "sa_projtaskmagid": item.sa_projtaskmagid,
  26. "sa_projstagemagid": item.sa_projstagemagid,
  27. }
  28. })
  29. if (item.partiestype.length != 0) {
  30. wx.navigateTo({
  31. url: '/packageA/select/setclient/select?params=' + JSON.stringify({
  32. "id": 20221129152204,
  33. content: {
  34. model: "#Task",
  35. nocache: true,
  36. sa_projectid: page.data.detail.sa_projectid,
  37. "sa_projtaskmagid": item.sa_projtaskmagid,
  38. pageNumber: 1,
  39. pageTotal: 1,
  40. pageSize: 20,
  41. total: null,
  42. where: {
  43. condition: "",
  44. }
  45. },
  46. }),
  47. });
  48. } else {
  49. this.handleAdd([]);
  50. }
  51. },
  52. handleAdd(ids) {
  53. let content = this.data.content;
  54. content.sa_project_partiesids = ids
  55. if (ids.length) {
  56. wx.redirectTo({
  57. url: '/packageA/project/modules/task/add?content=' + JSON.stringify(content) + '&taskname=' + this.data.taskname,
  58. })
  59. } else {
  60. wx.navigateTo({
  61. url: '/packageA/project/modules/task/add?content=' + JSON.stringify(content) + '&taskname=' + this.data.taskname,
  62. })
  63. }
  64. },
  65. viewHistory(e) {
  66. const {
  67. sa_projectid,
  68. sa_projtaskmagid,
  69. sa_projstagemagid
  70. } = e.currentTarget.dataset.item,
  71. content = {
  72. nocheca: true,
  73. sa_projectid,
  74. sa_projtaskmagid,
  75. sa_projstagemagid,
  76. pageNumber: 1,
  77. pageTotal: 1,
  78. pageSize: 20
  79. };
  80. if (!content.sa_projectid) {
  81. let page = getCurrentPages().find(v => v.__route__ == 'packageA/project/detail');
  82. content.sa_projectid = page.data.detail.sa_projectid;
  83. }
  84. wx.navigateTo({
  85. url: '/packageA/project/modules/task/history?content=' + JSON.stringify(content),
  86. })
  87. }
  88. }
  89. })