需求一:SQL语句执行正常,页面拿不到数据
解决:写的resultMap中的column字段和查询语句中的字段不对应
注意下面三者保持一致,才能正常的放到实体中去
需求二:需要执行getListNext方法进行查询,可两个查询参数年份(year)和部门id(organID)来自上级查询的结果
解决:下钻的时候拿到部门id和年份,并赋给查询参数
<el-table :data="tableData" style="width: 100%">
<el-table-column
label="地区"
prop="organName"
width="auto"
align="center"
show-overflow-tooltip
>
<template slot-scope="{ row }">
<div
v-if="row.organType.substring(0, 2) != '16'"
class="information-title"
@click="runInHole(row)"
>
{{ row.organName }}
</div>
<div v-if="row.organType.substring(0, 2) == '16'">
{{ row.organName }}
</div>
</template>
</el-table-column>
<el-table-column
label="年份"
prop="year"
width="auto"
align="center"
show-overflow-tooltip
></el-table-column>
</el-table>
// 查询数据 queryData() { this.loading = true; entrepreneurshipService .getListNext({ page: this.pagination.currentPage, pageSize: this.pagination.pageSize, organId: this.queryParams.organId, year: this.queryParams.year, // 添加查询参数 organName: this.queryParams.organName, }) .then((result) => { this.tableData = result.data.rows; this.pagination.total = result.data.totalCount; this.loading = false; }) .catch((e) => { this.$message.error(webutils.parseErrorMsg(e, "服务器错误")); }) .finally(() => { this.loading = false; }); }, // 下钻函数 runInHole(row) { this.pagination.currentPage = 0; this.pagination.pageSize = 10; this.loading = true; //在下钻的上一级拿到部门id和年份 this.queryParams.year = row.year; this.queryParams.organId = row.organId entrepreneurshipService .getListNext({ page: this.pagination.currentPage, pageSize: this.pagination.pageSize, //将拿到了部门id和年份赋值给查询参数 organId: this.queryParams.organId, year: this.queryParams.year, }) .then((result) => { this.tableData = result.data.rows; this.pagination.total = result.data.totalCount; this.loading = false; }) .catch((e) => { console.log(e); }); }, //输入机构名称进行查询 handleQuery() { //查询执行这个方法 this.queryData(); }, // 重置查询 resetQuery() { // for (var prop in this.queryParams) { // this.queryParams[prop] = ""; // } this.queryParams.organName = ""; this.pagination.currentPage = 0; this.currentPage = 1; this.handleQuery(); },