<template>
  <div class="route-container">
    <div class="header">
      <el-form :inline="true" :model="searchForm">
        <el-form-item>
          <el-select v-model="searchForm.channel" placeholder="全部通道" value="">
            <el-option label="全部通道" value="" />
            <el-option label="通道1" value="channel1" />
            <el-option label="通道2" value="channel2" />
            <el-option label="通道3" value="channel3" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.access" placeholder="全部接入" value="">
            <el-option label="全部接入" value="" />
            <el-option label="接入1" value="access1" />
            <el-option label="接入2" value="access2" />
            <el-option label="接入3" value="access3" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.unit" placeholder="全部单位" value="">
            <el-option label="全部单位" value="" />
            <el-option label="单位1" value="unit1" />
            <el-option label="单位2" value="unit2" />
            <el-option label="单位3" value="unit3" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.smsAccount" placeholder="全部短信账户" value="">
            <el-option label="全部短信账户" value="" />
            <el-option label="账户1" value="account1" />
            <el-option label="账户2" value="account2" />
            <el-option label="账户3" value="account3" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleSearch">查询</el-button>
        </el-form-item>
      </el-form>
      
      <div class="btn">
        <el-button type="primary" @click="handleAdd">新增</el-button>
        <el-button type="primary" @click="handleEdit">修改</el-button>
        <el-button type="danger" @click="handleDelete">删除</el-button>
      </div>
    </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="routeName" label="路由名称" align="center" />
        <el-table-column prop="unitName" label="单位名称" align="center" />
        <el-table-column prop="accountName" label="账户名称" align="center" />
        <el-table-column prop="operator" label="运营商" align="center" />
        <el-table-column prop="region" label="区域" align="center" />
        <el-table-column prop="channelName" label="通道名称" align="center" />
        <el-table-column prop="price" label="单价" align="center" />
        <el-table-column prop="priority" label="优先" align="center" />
        <el-table-column prop="createTime" label="创建时间" width="180" align="center" />
        <el-table-column prop="status" label="状态" align="center" />
        <el-table-column prop="remark" label="备注" align="center" />
      </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: 'Route',
  data() {
    return {
      searchForm: {
        channel: '',
        access: '',
        unit: '',
        smsAccount: ''
      },
      tableData: [],
      page: 1,
      pageSize: 10,
      total: 0
    }
  },
  methods: {
    handleSearch() {
      // 实现查询逻辑
    },
    handleAdd() {
      // 实现新增逻辑
    },
    handleEdit() {
      // 实现编辑逻辑
    },
    handleDelete() {
      // 实现删除逻辑
    },
    handleSizeChange(val) {
      this.pageSize = val
      // 重新加载数据
    },
    handleCurrentChange(val) {
      this.page = val
      // 重新加载数据
    }
  }
}
</script>

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

  .header {
    margin-bottom: 20px;
  }

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