<template>
  <div class="gate-container">
    <div class="header">
      <el-form :inline="true" :model="searchForm">
        <el-form-item>
          <el-input v-model="searchForm.name" placeholder="通道名称" />
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.type" placeholder="通道类型" value="">
            <el-option label="全部通道" value="" />
            <el-option label="短信" value="sms" />
            <el-option label="语音" value="voice" />
            <el-option label="流量" value="flow" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.status" placeholder="通道状态" value="">
            <el-option label="全部模式" value="" />
            <el-option label="启用" value="1" />
            <el-option label="禁用" value="0" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.provider" placeholder="全部状态" value=""> 
            <el-option label="全部状态" value="" selected />
            <el-option label="阿里云" value="aliyun" />
            <el-option label="腾讯云" value="tencent" />
            <el-option label="华为云" value="huawei" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleSearch">查询</el-button>
        </el-form-item>
      </el-form>
    </div>

    <div class="body">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column prop="id" label="编码" width="80" align="center" />
        <el-table-column prop="name" label="名称" align="center" />
        <el-table-column prop="type" label="类型" align="center" />
        <el-table-column prop="accessCode" label="接入码" align="center" />
        <el-table-column prop="signatureProcess" label="网关签名处理" align="center" />
        <el-table-column prop="speed" label="速率" align="center" />
        <el-table-column prop="billingMethod" label="计费方式" align="center" />
        <el-table-column prop="paymentMode" label="付费模式" align="center" />
        <el-table-column prop="price" label="单价" align="center" />
        <el-table-column prop="status" label="通道状态" align="center" />
        <el-table-column prop="createTime" label="创建时间" width="180" align="center" />
        <el-table-column prop="remark" label="备注" align="center" />
        <el-table-column label="操作" width="180" align="center">
          <template slot-scope="scope">
            <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
            <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>

      <div class="pagination">
        <el-pagination
          :current-page="page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'GateGate',
  data() {
    return {
      searchForm: {
        name: '',
        type: '',
        status: ''
      },
      tableData: [],
      page: 1,
      pageSize: 10,
      total: 0
    }
  },
  methods: {
    handleSearch() {
      // 实现查询逻辑
    },
    handleEdit(row) {
      // 实现编辑逻辑
    },
    handleDelete(row) {
      // 实现删除逻辑
    },
    handleSizeChange(val) {
      this.pageSize = val
      // 重新加载数据
    },
    handleCurrentChange(val) {
      this.page = val
      // 重新加载数据
    }
  }
}
</script>

<style lang="scss" scoped>
.gate-container {
  padding: 20px;
  background: #fff;

  .header {
    margin-bottom: 20px;
  }

  .pagination {
    margin-top: 20px;
    text-align: right;
  }
}
</style>
