index.js 3.5 KB

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