index.js 3.0 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. nocache: true,
  35. sa_projectid: page.data.detail.sa_projectid,
  36. sa_projtaskmagid: item.sa_projtaskmagid,
  37. where: {
  38. condition: "",
  39. }
  40. },
  41. }) + '&idname=sa_project_partiesid'
  42. });
  43. getApp().globalData.handleSelect = this.handleAdd.bind(this);
  44. } else {
  45. this.handleAdd({
  46. result: []
  47. });
  48. }
  49. },
  50. handleAdd(e) {
  51. let content = this.data.content;
  52. content.sa_project_partiesids = e.result;
  53. if (e.result.length) {
  54. wx.redirectTo({
  55. url: '/packageA/project/modules/task/add?content=' + JSON.stringify(content) + '&taskname=' + this.data.taskname,
  56. })
  57. } else {
  58. wx.navigateTo({
  59. url: '/packageA/project/modules/task/add?content=' + JSON.stringify(content) + '&taskname=' + this.data.taskname,
  60. })
  61. }
  62. },
  63. viewHistory(e) {
  64. const {
  65. sa_projectid,
  66. sa_projtaskmagid,
  67. sa_projstagemagid
  68. } = e.currentTarget.dataset.item,
  69. content = {
  70. nocheca: true,
  71. sa_projectid,
  72. sa_projtaskmagid,
  73. sa_projstagemagid,
  74. pageNumber: 1,
  75. pageTotal: 1,
  76. pageSize: 20
  77. };
  78. if (!content.sa_projectid) {
  79. let page = getCurrentPages().find(v => v.__route__ == 'packageA/project/detail');
  80. content.sa_projectid = page.data.detail.sa_projectid;
  81. }
  82. wx.navigateTo({
  83. url: '/packageA/project/modules/task/history?content=' + JSON.stringify(content),
  84. })
  85. }
  86. }
  87. })