<template>
  <div class="new-app-container layout-vertical">
<!--    <YMTableSearch :loading="loading" :search-form="searchForm" @onValueChange="onValueChange" @submit="onSubmit" />-->
    <YMTable
      ref="table"
      :table-key="1"
      :index="true"
      :selection="false"
      :table-options="tableOptions"
      :edit-form="editForm"
      :edit-config="editConfig"
      :columns="columns"
      :rows-actions="rowsActions"
      :show-summary="false"
      :apis="apis"
      :custom-style="{ height: 'calc(100vh - 80px)' }"
    />
    <!-- 自定义弹窗 -->
    <Dialog ref="dialog">
      <template slot="content" />
    </Dialog>
  </div>
</template>
<script>
import Dialog from '@/components/Dialog/index.vue'

export default {
  components: {
    Dialog
  },
  data() {
    return {
      loading: false,
      visibleBasicDrawer: false,
      renderContent: '',
      searchForm: [],
      columns: [
        {
          label: '总和',
          prop: 'groups'
        },
        {
          label: '玩法',
          prop: 'keywords'
        },
        {
          label: '最高投注',
          prop: 'maxinum'
        },
        {
          label: '最低投注',
          prop: 'mininum'
        },
        {
          label: '倍率',
          prop: 'odds'
        }
      ],
      rowsActions: [
        {
          key: 'edit',
          label: '编辑'
        },
        {
          key: 'delete',
          label: '删除'
        }
      ],
      apis: {
        list: {
          url: 'gameplayRule',
          dataParam: 'data.data',
          resultParam: 'data',
          init: false
        },
        add: {
          url: 'gameplayRule/submit'
        },
        edit: {
          url: 'gameplayRule/submit'
        },
        delete: {
          url: 'gameplayRule/delete',
          method: 'post'
        }
      },
      tableOptions: {
        add: {
          show: true,
        }
      },
      editForm: [
        {
          body: [
            {
              label: '总和',
              type: 'input',
              prop: 'groups',
              clearable: false,
              rules: [
                {
                  required: true,
                  message: '请输入总和',
                  trigger: 'blur'
                }
              ]
            },
            {
              label: '玩法',
              type: 'input',
              prop: 'keywords',
              clearable: false,
              rules: [
                {
                  required: true,
                  message: '请输入玩法',
                  trigger: 'blur'
                }
              ]
            },
            {
              label: '最高投注',
              type: 'input',
              prop: 'maxinum',
              clearable: false,
              rules: [
                {
                  required: true,
                  message: '请输入最高投注',
                  trigger: 'blur'
                }
              ]
            },
            {
              label: '最低投注',
              type: 'input',
              prop: 'mininum',
              clearable: false,
              rules: [
                {
                  required: true,
                  message: '请输入最低投注',
                  trigger: 'blur'
                }
              ]
            },
            {
              label: '倍率',
              type: 'input',
              prop: 'odds',
              clearable: false,
              rules: [
                {
                  required: true,
                  message: '请输入倍率',
                  trigger: 'blur'
                }
              ]
            }
          ]
        }
      ],
      editConfig: {}
    }
  },
  created() {
  },
  mounted() {
    this.onSubmit()
  },
  methods: {
    handleSubmit(formData) {
      console.log('提交数据:', formData)
      // 调用API提交数据
    },
    handleClickDrawer(row) {

    },
    onValueChange(val) {

    },
    onSubmit(params) {
      this.$refs.table.getList(params)
    }
  }
}
</script>
