annual_inspection_plan.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="mb-5">
  3. <view class="m-3">
  4. <view class="centerY mt-3">
  5. <view class="bule_line" style=""></view>
  6. <text class="font-bold text-dark ml-2 fs-16 line-height1">全年检查计划</text>
  7. </view>
  8. <view class="mt-3 bg-white p-3">
  9. <view class="">
  10. <view class="mtable-title centerY bg-primary text-white fs-12">
  11. <view class=" w-20">
  12. 时间
  13. </view>
  14. <view class=" text-center w-80">
  15. 检查项
  16. </view>
  17. </view>
  18. <view v-if="yearCheck.length>0" class="mtable-body-item centerY fs-12"
  19. v-for="(item,index) in yearCheck" style="color: #868687;">
  20. <view class="w-20">
  21. {{item.date}}
  22. </view>
  23. <view class="w-80">
  24. <span>{{item.value}}</span>
  25. </view>
  26. </view>
  27. <view class="px-3 pb-3 mt-n2" v-if="yearCheck.length==0">
  28. <Empty title="没有随眼底检查" class="py-5" />
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import Empty from '@/component/empty/empty.vue'
  37. import Moment from 'moment'
  38. export default {
  39. components: {
  40. Empty
  41. },
  42. name: "AnnualInspectionPlan",
  43. props: {
  44. propData: {
  45. type: Object,
  46. default () {
  47. return {
  48. yearCheck: []
  49. }
  50. },
  51. },
  52. },
  53. data() {
  54. return {
  55. yearCheck: []
  56. }
  57. },
  58. watch: {
  59. propData: {
  60. handler(val) {
  61. this.getyearCheck(val)
  62. },
  63. },
  64. },
  65. created() {
  66. },
  67. methods: {
  68. async getyearCheck(res) {
  69. // this.yearCheck = data
  70. let data = res.yearCheck ? res.yearCheck : []
  71. let data1 = []
  72. data.map((item) => {
  73. let str = ''
  74. let arr = Object.values(item)
  75. arr.map((item1, index) => {
  76. str += index + 1 + '. ' + item1 + ';'
  77. })
  78. data1.push(str)
  79. })
  80. let yearList = (function() {
  81. let date = new Date()
  82. let arr = []
  83. for (let i = 0; i < 12; i++) {
  84. arr.push(
  85. date.getFullYear() +
  86. '-' +
  87. Moment(date.getFullYear()).add(i, 'months').format('MM')
  88. )
  89. }
  90. return arr
  91. })()
  92. // console.log(data1,yearList,this.yearCheck)
  93. let yearCheck1 = []
  94. yearList.map((item, index) => {
  95. yearCheck1.push({
  96. date: item,
  97. value: data1[index]
  98. })
  99. })
  100. this.yearCheck = yearCheck1
  101. },
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. page {
  107. background: #F5F9FF;
  108. }
  109. .mtable {
  110. &-title {
  111. border-radius: 50rpx;
  112. padding: 20rpx;
  113. box-shadow: 0px 2px 7px 1px rgba(45, 142, 255, 0.5);
  114. }
  115. &-body {
  116. &-item {
  117. margin-top: 20rpx;
  118. border-radius: 50rpx;
  119. padding: 20rpx;
  120. background-color: #F6F9FE;
  121. color: #868687;
  122. }
  123. }
  124. }
  125. </style>