<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--用户数据-->
      <el-col style="display:flex" :span="20" :xs="24">
        <el-form :model="queryParams" ref="queryRef" :inline="true">
          <el-form-item label="企业信用代码" prop="unifiedSocialCreditCode">
            <el-input v-model="queryParams.unifiedSocialCreditCode" placeholder="请输入企业信用代码" clearable
                      style="width: 240px" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-table stripe :data="tableData" style="width: 100%" height="710">
      <el-table-column prop="unifiedSocialCreditCode" label="企业信用代码">
      </el-table-column>
      <el-table-column prop="enterpriseName" label="企业名称">
      </el-table-column>
      <el-table-column prop="total" label="总数">
      </el-table-column>
    </el-table>
    <div style="position: fixed;bottom: 20px;right: 10px;">
      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
                  v-model:limit="queryParams.pageSize" @pagination="getList" />
    </div>
  </div>
</template>

<script setup name="getCerating">
// import { getToken } from '@/utils/auth'
import {getCreditScoreList} from '@/api/ceenterprise/cerating'

const store = useStore()
const tableData = ref([])

const total = ref(0)

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 20,
    unifiedSocialCreditCode: '',
    userName: undefined,
    phonenumber: undefined,
    status: undefined,
    // deptId: store.state.user.userInfo.deptId
  },
})
const {queryParams} = toRefs(data)


/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList()
}

/** 重置按钮操作 */
function resetQuery() {
  queryParams.value.unifiedSocialCreditCode = "";
  handleQuery()
}

/** 查询用户列表 */
function getList() {
  getCreditScoreList(queryParams.value).then((res) => {
    tableData.value = res.data.result
    total.value = res.data.totalSize

    console.log(11, tableData.value)
  })
}

getList()
</script>
