worm-table.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <!-- 害虫分析表格数据-->
  3. <view class="ui-card px-13">
  4. </view>
  5. </template>
  6. <script>
  7. /**
  8. * 虫害始见期数据卡片
  9. */
  10. import {
  11. getPestRaiseInfo
  12. } from '@/api/worm.js'
  13. export default {
  14. name: 'w-raise-card',
  15. data() {
  16. return {
  17. pestList: [], //始见期选项
  18. pestInfo: {},
  19. pestDate: (new Date()).getUTCFullYear(),
  20. pestItem: '',
  21. }
  22. },
  23. props: {
  24. // 设备id
  25. deviceId: [String, Number]
  26. },
  27. mounted() {
  28. this.getPestRaiseInfo();
  29. },
  30. methods: {
  31. // 获取始见期数据
  32. async getPestRaiseInfo() {
  33. const res = await getPestRaiseInfo({
  34. year: this.pestDate,
  35. d_ids: this.deviceId,
  36. });
  37. this.pestList = res.pest_list; //始见期选项
  38. this.pestInfo = res.pest_info;
  39. this.pestItem = this.pestList[0];
  40. },
  41. // 选择年份
  42. changePestDate(e) {
  43. this.pestDate=e.detail.value;
  44. this.getPestRaiseInfo();
  45. },
  46. // 选择始见期类型
  47. changePestList(e) {
  48. this.pestItem = this.pestList[e.detail.value];
  49. },
  50. }
  51. };
  52. </script>
  53. <style lang="scss">
  54. // 时期样式
  55. .period-navs {
  56. display: flex;
  57. justify-content: space-between;
  58. }
  59. .period-item {
  60. width: 200rpx;
  61. height: 264rpx;
  62. padding: 122rpx 24rpx 24rpx;
  63. background: url('/static/img/startTime.png') center center no-repeat;
  64. background-size: 200rpx 264rpx;
  65. &.high-time {
  66. background-image: url('/static/img/highTime.png');
  67. }
  68. &.end-time {
  69. background-image: url('/static/img/endTime.png');
  70. }
  71. .title {
  72. font-size: 32rpx;
  73. font-weight: normal;
  74. color: #333333;
  75. line-height: 44rpx;
  76. }
  77. .text {
  78. margin-top: 10rpx;
  79. font-size: 24rpx;
  80. font-weight: normal;
  81. color: #999999;
  82. line-height: 34rpx;
  83. }
  84. }
  85. </style>