index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. let _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. list: {
  5. type: Array
  6. },
  7. detele: {
  8. type: Boolean
  9. },
  10. edit: {
  11. type: Boolean
  12. }
  13. },
  14. options: {
  15. addGlobalClass: true
  16. },
  17. lifetimes: {
  18. attached: function () {
  19. getApp().globalData.Language.getLanguagePackage(this)
  20. }
  21. },
  22. methods: {
  23. handleItem(e) {
  24. let {
  25. item
  26. } = e.currentTarget.dataset;
  27. wx.showModal({
  28. title: getApp().globalData.Language.getMapText('提示'),
  29. content: item.important ? getApp().globalData.Language.joint([{
  30. t: 1,
  31. v: '是否设置',
  32. r: " "
  33. }, {
  34. v: item.enterprisename,
  35. r: " "
  36. }, {
  37. t: 1,
  38. v: '为主要威胁',
  39. r: "?"
  40. }]) : getApp().globalData.Language.joint([{
  41. t: 1,
  42. v: '是否取消设置',
  43. r: " "
  44. }, {
  45. v: item.enterprisename,
  46. r: " "
  47. }, {
  48. t: 1,
  49. v: '为主要威胁',
  50. r: "?"
  51. }]),
  52. cancelText: getApp().globalData.Language.getMapText('取消'),
  53. confirmText: getApp().globalData.Language.getMapText('确定'),
  54. complete: (res) => {
  55. if (res.confirm) {
  56. item.important = item.important == 0 ? 1 : 0;
  57. _Http.basic({
  58. id: "20221019165802",
  59. content: item
  60. }).then(res => {
  61. wx.showToast({
  62. title: res.code == '1' ? getApp().globalData.Language.getMapText('设置成功') : res.msg,
  63. icon: "none"
  64. });
  65. let page = getCurrentPages()[getCurrentPages().length - 1].selectComponent("#Opponent");
  66. if (page) {
  67. let i = page.data.list.findIndex(v => v.sa_competitorid == item.sa_competitorid);
  68. if (i != -1) page.setData({
  69. [`list[${i}]`]: item
  70. });
  71. }
  72. })
  73. }
  74. }
  75. })
  76. }
  77. }
  78. })