<template>
  <div>
    <!-- 头部导航栏 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>数据工厂</el-breadcrumb-item>
      <el-breadcrumb-item>生成新数据</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card>
      <!-- namespace下拉框 -->
      <div class="filter">
        <p>
          Namespace:
          <el-select
            v-model="selectNamespace"
            placeholder="请选择namespace"
            @change="handleNamespaceChange"
          >
            <el-option
              v-for="item in namespaceOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </p>
        <!-- 借款状态下拉框 -->
        <p>
          借款状态：
          <el-select v-model="selectStatus" placeholder="请选择借款状态">
            <el-option
              v-for="item in statusOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </p>
        <!-- 数据个数 -->
        <p>
          数据个数：
          <el-input-number
            v-model="expectNum"
            @change="handleExpectNumChange"
            :min="1"
            :max="100"
            label="数据个数"
          ></el-input-number>
        </p>
        <!-- 查询数据按钮 -->
        <p>
          <el-button type="primary" style="margin-left:20px" @click="queryData">制造数据</el-button>
        </p>
      </div>
      <!-- 数据表格 -->
      <div class="dataTable">
        <el-table :data="dataTable" border style="width: 100%">
          <el-table-column type="phoneNo" label="phone_no" width="200px"></el-table-column>
          <el-table-column prop="userId" label="user_id" width="150px"></el-table-column>
          <el-table-column prop="uuid" label="uuid" width="300px"></el-table-column>
          <el-table-column prop="status" label="status" width="100px"></el-table-column>
          <el-table-column prop="status" label="注册渠道" width="100px"></el-table-column>
          <el-table-column prop="status" label="创建时间" width="200px"></el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      namespaceOptions: [],
      statusOptions: [],
      selectNamespace: '',
      selectStatus: '',
      expectNum: 1
    }
  },
  created() {},
  methods: {
    getNamespaceOptions() {
      this.$axios
        .get('/allEnvInfo')
        .then(response => {
          this.namespaceOptions = response['data']['data']
        })
        .catch(error => console.log(error))
    },
    getStatusOptions() {
      this.$axios
        .get('/allUserLoanStatus')
        .then(response => {
          this.statusOptions = response['data']['data']
        })
        .catch(error => console.log(error))
    },
    handleExpectNumChange(newNum) {}
  },
  mounted() {
    this.getNamespaceOptions()
    this.getStatusOptions()
  }
}
</script>

<style lang="less" scoped>
.dataTable {
  margin-top: 20px;
}

.filter {
  display: flex;
  p {
    margin-right: 20px;
  }
}
</style>
