<template>
  <view class="ComCss">
    <cardMoudule :cardData="data1" :required="false" title="未来发展规划"></cardMoudule>
    <cardMoudule :cardData="data2" :required="true" title="整体开发思路"></cardMoudule>
    <cardMoudule :cardData="data3" :required="false" title="所需要资源配置"></cardMoudule>
  </view>
</template>

<script>
  import cardMoudule from "./cardMoudule.vue"
  export default {
    components: {
      cardMoudule
    },
    props: {
      reportData: {
        type: Object
      },
      fiscalYear:{
        type:String
      }
    },
    data() {
      return {
        data1: [{
            cardType: 3,
            required: true,
            title: '用户签约(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "contractGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "contractGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "contractGoal",
            id: "2"
          },
          {
            cardType: 3,
            required: true,
            title: '新户(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "newUserGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "newUserGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "newUserGoal",
            id: "2"
          },

          {
            cardType: 3,
            required: true,
            title: '老户(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "oldUserGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "oldUserGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "oldUserGoal",
            id: "2"
          },

          {
            cardType: 3,
            required: true,
            title: '乡镇(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "townsUserGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "townsUserGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "townsUserGoal",
            id: "2"
          },

          {
            cardType: 3,
            required: true,
            title: '工商福(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "commerceGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "commerceGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "commerceGoal",
            id: "2"
          },

          {
            cardType: 3,
            required: true,
            title: '工业(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "industryGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "industryGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "industryGoal",
            id: "2"
          },

          {
            cardType: 3,
            required: true,
            title: '用户安装(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "installUserGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "installUserGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "installUserGoal",
            id: "2"
          },

          {
            cardType: 3,
            required: true,
            title: '销气量(户)',
          },
          {
            cardType: 1,
            required: true,
            title: `${this.fiscalYear}财年目标`,
            value: "",
            key: "salesNumberGoal",
            id: "0"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+1}财年目标`,
            value: "",
            key: "salesNumberGoal",
            id: "1"
          },
          {
            cardType: 1,
            required: true,
            title: `${parseInt(this.fiscalYear)+2}财年目标`,
            value: "",
            key: "salesNumberGoal",
            id: "2"
          }
        ],
        data2: [{
          cardType: 2,
          required: true,
          title: '整体开发思路',
          value: "",
          key:"developmentIdea"
        }],
        data3: [{
          cardType: 2,
          required: true,
          title: '所需要资源配置',
          value: "",
          key:"resourceAllocation"
        }],
      }
    },
    computed: {

    },
    mounted() {
      this.initData()
    },
    methods: {
      initData() {
        this.data1.forEach(data => {
          if (data.key in this.reportData) {
            let Arr = this.reportData[data.key].split(",");
            data.value = Arr[data.id];
          }
        });
        this.data2.forEach(data => {
          if (data.key in this.reportData) {
            data.value = this.reportData[data.key];
          }
        });
        this.data3.forEach(data => {
          if (data.key in this.reportData) {
            data.value = this.reportData[data.key];
          }
        });
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
