index.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. "isExport": false,
  49. "where": {
  50. "condition": "",
  51. "tablefilter": {},
  52. "sa_projectid": this.data.sa_projectid
  53. }
  54. },
  55. "id": 20221018164302,
  56. }) + '&radio=true&idname=sa_competitorid',
  57. });
  58. getApp().globalData.handleSelect = this.handleSelect.bind(this);
  59. },
  60. handleSelect({item}) {
  61. let that = this;
  62. wx.showModal({
  63. title: '提示',
  64. content: `是否添加"${item.enterprisename}"为竞争对手`,
  65. complete: ({
  66. confirm
  67. }) => {
  68. if (confirm) _Http.basic({
  69. "id": 20221019165802,
  70. "content": {
  71. sa_project_competeid: 0,
  72. "sa_projectid": that.data.sa_projectid, //工程项目表ID
  73. "sa_competitorid":item.sa_competitorid, //竞争对手ID
  74. "important": 0, //主要威胁 0/1
  75. }
  76. }).then(res => {
  77. console.log("添加竞争对手", res)
  78. wx.showToast({
  79. title: res.msg == '成功' ? '添加成功' : res.msg,
  80. icon: "none"
  81. })
  82. if (res.msg == '成功') setTimeout(() => {
  83. wx.navigateBack();
  84. that.getList(that.data.sa_projectid, true)
  85. }, 300)
  86. })
  87. }
  88. })
  89. },
  90. /* 修改总数 */
  91. changeTotal() {
  92. this.setData({
  93. "content.total": this.data.content.total - 1
  94. })
  95. }
  96. }
  97. })