<template>
  <div>
    <a-table
      class="mar-bottom10"
      size="small"
      :columns="columns"
      :locale="{ emptyText: 'No Data' }"
      :data-source="conditionList"
      row-key="id"
      :pagination="false"
    ></a-table>
  </div>
</template>

<script>
export default {
  props: {
    formData: {
      default: {},
    },
  },
  data() {
    const columns = [
      { title: "条件类型", dataIndex: "frequencyDesc" },
      { title: "条件内容", dataIndex: "limitDesc" },
      // { title: "最小值", dataIndex: "minValue" },
      { title: "最大值", dataIndex: "maxValue", customRender: (val, row) => {
        if (row.limitCode.indexOf('07') === 0) {
          return val + '%'
        }
        return val
      }},
      { title: "剩余金额", dataIndex: "leftValue" }
    ];
    return {
      columns,
      conditionList: [],
    };
  },
  mounted() {
    this._getConditionList();
  },
  methods: {
    _getConditionList() {
      const {
        planCode,
        payorCode,
        coverageCode,
        corpCode,
        benefitCode,
        conditionType,
      } = this.formData;
      const data = {
        planCode,
        payorCode,
        coverageCode,
        corpCode,
        benefitCode,
        conditionType,
      };
      this.$apis.GETCONDITIONLIST(data).then((res) => {
        this.conditionList = res.content || [];
      });
    },
  },
};
</script>

<style></style>
