<template>
  <div>
    <c-page>
      <div class="eContainer">
        <el-form
          :model="model"
          :rules="rules"
          ref="lcdmstForm"
          label-position="left"
          label-width="150px"
          size="small"
        >
          <el-tabs v-model="activeName" type="card" @tab-click="onTabClick">
            <el-tab-pane label="普通计算器" name="norCalc">
              <m-norCalc v-bind:model="model" v-bind:codes="codes" />
            </el-tab-pane>
            <el-tab-pane label="收益计算器" name="proCalc">
              <m-proCalc v-bind:model="model" v-bind:codes="codes" />
            </el-tab-pane>

            <el-tab-pane label="插值计算器" name="interCalc">
              <m-interCalc v-bind:model="model" v-bind:codes="codes" />
            </el-tab-pane>
            <el-tab-pane label="天数计算器" name="dayCalc">
              <m-dayCalc v-bind:model="model" v-bind:codes="codes" />
            </el-tab-pane>
            <el-tab-pane label="收益点计算器" name="proPoiCalc">
              <m-proPoiCalc v-bind:model="model" v-bind:codes="codes" />
            </el-tab-pane>
          </el-tabs>
        </el-form>
        <el-col class="eContainer-func"></el-col>
      </div>
    </c-page>
  </div>
</template>

<script>
import norCalc from "./norCalc";
import proCalc from "./proCalc";
import dayCalc from "./dayCalc";
import interCalc from "./interCalc";
import proPoiCalc from "./proPoiCalc";

import Calculator from "./Calculator";

import Api from "~/service/Api";

const success = "SUCCESS";

export default {
  
  components: {
    "m-norCalc": norCalc,
    "m-proCalc": proCalc,
    "m-dayCalc": dayCalc,
    "m-interCalc": interCalc,
    "m-proPoiCalc": proPoiCalc
  },
  data() {
    let num = /^[0-9]*$/;
    let isNumber = (rules, value, callback) => {
      if (!num.test(value)) {
        return callback(new Error("请输入数字"));
      } else {
        callback();
      }
    };
    let date = new Date();
    let s1 =
      date.getFullYear() +
      "-" +
      (date.getMonth() + 1) +
      "-" +
      (date.getDate() - 1);
    let pickerOptions = (rules, value, callback) => {
      if (value < new Date(s1)) {
        return callback(new Error("所选日期不能小于当前日期，请重新选择"));
      } else {
        callback();
      }
    };
    return {
      activeName: "norCalc",
      exitDialogVisible: false,
      model: new Calculator().data,
      codes:[],
      rules: {}
    };
  },
  methods: {
    onTabClick() {}
  }
};
</script>