<template>
  <div class="upstream-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="1" />
            <el-option label="通道2" value="2" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="searchForm.unitName" placeholder="全部单位名称" value="">
            <el-option label="全部单位名称" value="" />
            <el-option label="单位1" value="1" />
            <el-option label="单位2" value="2" />
          </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="1" />
            <el-option label="账户2" value="2" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input v-model="searchForm.spCode" placeholder="请输入SP号码" />
        </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="handleEdit">修改</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="channelName" label="通道名称" align="center" />
        <el-table-column prop="spCode" label="SP接入号码" align="center" />
        <el-table-column prop="smsAccount" label="短信账户" align="center" />
        <el-table-column prop="unitName" label="单位名称" align="center" />
        <el-table-column prop="extensionCode" label="扩展码" align="center" />
        <el-table-column prop="commandWord" label="命令字" align="center" />
        <el-table-column prop="isDefault" label="是否默认路由" align="center" />
        <el-table-column prop="createTime" label="创建时间" width="180" 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: 'Upstream',
  data() {
    return {
      searchForm: {
        channel: '',
        unitName: '',
        smsAccount: '',
        spCode: ''
      },
      tableData: [],
      page: 1,
      pageSize: 10,
      total: 0
    }
  },
  methods: {
    handleSearch() {
      // 实现查询逻辑
    },
    handleEdit() {
      // 实现编辑逻辑
    },
    handleSizeChange(val) {
      this.pageSize = val
      // 重新加载数据
    },
    handleCurrentChange(val) {
      this.page = val
      // 重新加载数据
    }
  }
}
</script>

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

  .header {
    margin-bottom: 20px;
  }

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