import React, { Component } from "react";
import { View } from "@tarojs/components";

const formatStatus = status => {
  const STATUS_ENUM = {
    0: '驳回',
    1: '发起',
    2: '同意',
    3: '打卡',
    4: '撤销',
    5: '修改'
  }
  return STATUS_ENUM[status] || '-'
}

const renderApproveItem = data => {
  return data.map(item => {
    return <View className='approve-list-item' style={{ marginBottom: '8rpx' }}>{`${item.aname}，${formatStatus(item.status)}，${item.remarks}`}</View>
  })
}

const ApproveList = props => {
  return (
    <View className='approve-wrap' style={{ color: '#1E90FF', fontSize: '26rpx', fontWeight: 500 }}>
      <View className='label' style={{ margin: '16rpx 0 8rpx', fontWeight: 600 }}>公出审核：</View>
      <View className='approve-list'>
        {renderApproveItem(props.data || [])}
      </View>
    </View>
  )
}

export default ApproveList