123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <view class="mb-5">
- <view class="m-3">
- <view class="centerY mt-3">
- <view class="bule_line" style=""></view>
- <text class="font-bold text-dark ml-2 fs-16 line-height1">全年检查计划</text>
- </view>
- <view class="mt-3 bg-white p-3">
- <view class="">
- <view class="mtable-title centerY bg-primary text-white fs-12">
- <view class=" w-20">
- 时间
- </view>
- <view class=" text-center w-80">
- 检查项
- </view>
- </view>
- <view v-if="yearCheck.length>0" class="mtable-body-item centerY fs-12"
- v-for="(item,index) in yearCheck" style="color: #868687;">
- <view class="w-20">
- {{item.date}}
- </view>
- <view class="w-80">
- <span>{{item.value}}</span>
- </view>
- </view>
- <view class="px-3 pb-3 mt-n2" v-if="yearCheck.length==0">
- <Empty title="没有随眼底检查" class="py-5" />
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import Empty from '@/component/empty/empty.vue'
- import Moment from 'moment'
- export default {
- components: {
- Empty
- },
- name: "AnnualInspectionPlan",
- props: {
- propData: {
- type: Object,
- default () {
- return {
- yearCheck: []
- }
- },
- },
- },
- data() {
- return {
- yearCheck: []
- }
- },
- watch: {
- propData: {
- handler(val) {
- this.getyearCheck(val)
- },
- },
- },
- created() {
- },
- methods: {
- async getyearCheck(res) {
- // this.yearCheck = data
- let data = res.yearCheck ? res.yearCheck : []
- let data1 = []
- data.map((item) => {
- let str = ''
- let arr = Object.values(item)
- arr.map((item1, index) => {
- str += index + 1 + '. ' + item1 + ';'
- })
- data1.push(str)
- })
- let yearList = (function() {
- let date = new Date()
- let arr = []
- for (let i = 0; i < 12; i++) {
- arr.push(
- date.getFullYear() +
- '-' +
- Moment(date.getFullYear()).add(i, 'months').format('MM')
- )
- }
- return arr
- })()
- // console.log(data1,yearList,this.yearCheck)
- let yearCheck1 = []
- yearList.map((item, index) => {
- yearCheck1.push({
- date: item,
- value: data1[index]
- })
- })
- this.yearCheck = yearCheck1
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- background: #F5F9FF;
- }
- .mtable {
- &-title {
- border-radius: 50rpx;
- padding: 20rpx;
- box-shadow: 0px 2px 7px 1px rgba(45, 142, 255, 0.5);
- }
- &-body {
- &-item {
- margin-top: 20rpx;
- border-radius: 50rpx;
- padding: 20rpx;
- background-color: #F6F9FE;
- color: #868687;
- }
- }
- }
- </style>
|