annual_inspection_plan.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. if(data.length==0){
  72. this.yearCheck = [];
  73. return
  74. }
  75. let data1 = []
  76. data.map((item) => {
  77. let str = ''
  78. let arr = Object.values(item)
  79. arr.map((item1, index) => {
  80. str += index + 1 + '. ' + item1 + ';'
  81. })
  82. data1.push(str)
  83. })
  84. let yearList = (function() {
  85. let date = new Date()
  86. let arr = []
  87. for (let i = 0; i < 12; i++) {
  88. arr.push(
  89. date.getFullYear() +
  90. '-' +
  91. Moment(date.getFullYear()).add(i, 'months').format('MM')
  92. )
  93. }
  94. return arr
  95. })()
  96. // console.log(data1,yearList,this.yearCheck)
  97. let yearCheck1 = []
  98. yearList.map((item, index) => {
  99. yearCheck1.push({
  100. date: item,
  101. value: data1[index]
  102. })
  103. })
  104. this.yearCheck = yearCheck1
  105. },
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. page {
  111. background: #F5F9FF;
  112. }
  113. .mtable {
  114. &-title {
  115. border-radius: 50rpx;
  116. padding: 20rpx;
  117. box-shadow: 0px 2px 7px 1px rgba(45, 142, 255, 0.5);
  118. }
  119. &-body {
  120. &-item {
  121. margin-top: 20rpx;
  122. border-radius: 50rpx;
  123. padding: 20rpx;
  124. background-color: #F6F9FE;
  125. color: #868687;
  126. }
  127. }
  128. }
  129. </style>