projectAssessment.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency"),
  3. CNY = (value, symbol = "¥", precision = 2) => currency(value, {
  4. symbol,
  5. precision
  6. }).format();
  7. Component({
  8. options: {
  9. addGlobalClass: true
  10. },
  11. lifetimes: {
  12. attached: function () {
  13. getApp().globalData.Language.getLanguagePackage(this)
  14. }
  15. },
  16. data: {
  17. dateTypes: ["全部", "本年"],
  18. dateType: "本年",
  19. showList: false,
  20. list: [],
  21. "isAll": 0, //1全部 0本年
  22. allsumscore: 0,
  23. "content": {
  24. "nocache": true,
  25. "pageNumber": 1,
  26. "pageTotal": 1,
  27. "total": null,
  28. "where": {
  29. begdate: "",
  30. enddate: "",
  31. }
  32. }
  33. },
  34. methods: {
  35. getList(id, init) {
  36. let content = this.data.content;
  37. content.sa_projectid = id;
  38. content.isAll = this.data.isAll;
  39. if (init) {
  40. content.pageNumber = 1;
  41. content.total = null;
  42. }
  43. if (!this.data.showList && content.total != null) return;
  44. if (content.pageNumber > content.pageTotal) return;
  45. _Http.basic({
  46. "id": 20230715112504,
  47. content
  48. }).then(res => {
  49. console.log("项目评估", res)
  50. if (res.code != '1') return wx.showToast({
  51. title: res.data,
  52. icon: "none"
  53. })
  54. content.pageNumber = res.pageNumber + 1;
  55. content.pageSize = res.pageSize;
  56. content.pageTotal = res.pageTotal;
  57. content.total = res.total;
  58. this.setData({
  59. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  60. content,
  61. id: id,
  62. });
  63. try {
  64. this.selectComponent("#TimeRange").onCancel()
  65. } catch (error) {
  66. }
  67. })
  68. _Http.basic({
  69. "id": 20230715111704,
  70. content
  71. }).then(res => {
  72. this.setData({
  73. allsumscore: res.data[0].allsumscore || 0,
  74. })
  75. })
  76. },
  77. changeDate({
  78. detail
  79. }) {
  80. this.setData({
  81. dateType: detail.dateType,
  82. isAll: detail.isAll === "" ? 99 : detail.isAll,
  83. "content.where.begdate": detail.begdate || "",
  84. "content.where.enddate": detail.enddate || ""
  85. })
  86. this.getList(this.data.id, true)
  87. },
  88. shrinkChange({
  89. detail
  90. }) {
  91. this.setData({
  92. showList: detail
  93. })
  94. }
  95. }
  96. })