index.js 3.9 KB

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