index.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. wx.redirectTo({
  56. url: '/packageA/project/modules/task/add?content=' + JSON.stringify(content) + '&taskname=' + this.data.taskname,
  57. })
  58. },
  59. viewHistory(e) {
  60. const {
  61. sa_projectid,
  62. sa_projtaskmagid,
  63. sa_projstagemagid
  64. } = e.currentTarget.dataset.item,
  65. content = {
  66. nocheca: true,
  67. sa_projectid,
  68. sa_projtaskmagid,
  69. sa_projstagemagid,
  70. pageNumber: 1,
  71. pageTotal: 1,
  72. pageSize: 20
  73. };
  74. if (!content.sa_projectid) {
  75. let page = getCurrentPages().find(v => v.__route__ == 'packageA/project/detail');
  76. content.sa_projectid = page.data.detail.sa_projectid;
  77. }
  78. wx.navigateTo({
  79. url: '/packageA/project/modules/task/history?content=' + JSON.stringify(content),
  80. })
  81. }
  82. }
  83. })