index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. console.log(123)
  46. wx.navigateTo({
  47. url: '/packageA/select/setclient/select?params=' + JSON.stringify({
  48. "content": {
  49. model: "#Opponent",
  50. "isExport": false,
  51. "pageNumber": 1,
  52. "pageSize": 20,
  53. "where": {
  54. "condition": "",
  55. "tablefilter": {},
  56. "sa_projectid": this.data.sa_projectid //不传差全部,传过滤掉对应项目中的数据
  57. }
  58. },
  59. "id": 20221018164302,
  60. }) + '&radio=true',
  61. })
  62. },
  63. handleSelectProject(arr, list) {
  64. console.log(arr, list)
  65. let that = this;
  66. wx.showModal({
  67. title: '提示',
  68. content: `是否将"${list[0].enterprisename}"添加到竞争对手`,
  69. complete: ({
  70. confirm
  71. }) => {
  72. if (confirm) _Http.basic({
  73. "id": 20221019165802,
  74. "content": {
  75. ...list[0],
  76. sa_project_competeid: 0,
  77. "sa_projectid": that.data.sa_projectid, //工程项目表ID
  78. "important": 0, //主要威胁 0/1
  79. }
  80. }).then(res => {
  81. console.log("添加竞争对手", res)
  82. wx.showToast({
  83. title: res.msg == '成功' ? '添加成功' : res.msg,
  84. icon: "none"
  85. })
  86. if (res.msg == '成功') setTimeout(() => {
  87. wx.navigateBack();
  88. that.getList(that.data.sa_projectid, true)
  89. }, 300)
  90. })
  91. }
  92. })
  93. },
  94. /* 修改总数 */
  95. changeTotal() {
  96. this.setData({
  97. "content.total": this.data.content.total - 1
  98. })
  99. }
  100. }
  101. })