index.js 3.2 KB

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