index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. disabled: Boolean
  5. },
  6. data: {
  7. list: [],
  8. sa_projectid: "",
  9. "content": {
  10. "nocache": true,
  11. "pageNumber": 1,
  12. "pageTotal": 1,
  13. "total": null,
  14. "type": 1,
  15. "where": {
  16. "condition": ""
  17. }
  18. }
  19. },
  20. methods: {
  21. getList(id, init) {
  22. let content = this.data.content;
  23. content.sa_projectid = id;
  24. if (init) content.pageNumber = 1
  25. _Http.basic({
  26. "id": 20221027165402,
  27. content
  28. }).then(res => {
  29. console.log("项目竞争对手", res)
  30. if (res.msg != '成功') return wx.showToast({
  31. title: res.data,
  32. icon: "none"
  33. })
  34. this.setData({
  35. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  36. "content.pageNumber": res.pageNumber + 1,
  37. "content.pageSize": res.pageSize,
  38. "content.pageTotal": res.pageTotal,
  39. "content.total": res.total,
  40. sa_projectid: id
  41. });
  42. })
  43. },
  44. add() {
  45. wx.navigateTo({
  46. url: '/packageA/select/setclient/select?params=' + JSON.stringify({
  47. "content": {
  48. nocache: true,
  49. "isExport": false,
  50. "where": {
  51. "condition": "",
  52. "tablefilter": {},
  53. "sa_projectid": this.data.sa_projectid
  54. }
  55. },
  56. "id": 20221018164302,
  57. }) + '&radio=true&idname=sa_competitorid',
  58. });
  59. getApp().globalData.handleSelect = this.handleSelect.bind(this);
  60. },
  61. handleSelect({
  62. item
  63. }) {
  64. let that = this;
  65. wx.showModal({
  66. title: '提示',
  67. content: `是否添加"${item.enterprisename}"为竞争对手`,
  68. complete: ({
  69. confirm
  70. }) => {
  71. if (confirm) _Http.basic({
  72. "id": 20221019165802,
  73. "content": {
  74. sa_project_competeid: 0,
  75. "sa_projectid": that.data.sa_projectid, //工程项目表ID
  76. "sa_competitorid": item.sa_competitorid, //竞争对手ID
  77. "important": 0, //主要威胁 0/1
  78. }
  79. }).then(res => {
  80. console.log("添加竞争对手", res)
  81. wx.showToast({
  82. title: res.msg == '成功' ? '添加成功' : res.msg,
  83. icon: "none"
  84. })
  85. if (res.msg == '成功') setTimeout(() => {
  86. wx.navigateBack();
  87. that.getList(that.data.sa_projectid, true)
  88. }, 300)
  89. })
  90. }
  91. })
  92. },
  93. /* 修改总数 */
  94. changeTotal() {
  95. this.setData({
  96. "content.total": this.data.content.total - 1
  97. })
  98. }
  99. }
  100. })