删除a-table自带分页
This commit is contained in:
parent
9632a7bcce
commit
4c60ba4ca7
|
@ -34,116 +34,112 @@
|
|||
</a-row>
|
||||
</div>
|
||||
<div class="tableContent" v-if="isShow">
|
||||
<a-table :dataSource="tableData" :columns="tableLabel" bordered :loading="loading" size="middle" />
|
||||
<a-table :dataSource="tableData" :columns="tableLabel" bordered :pagination="false" :loading="loading" size="middle" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { reactive, ref } from 'vue';
|
||||
import type { UnwrapRef } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
interface FormState {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { reactive, ref } from 'vue';
|
||||
import type { UnwrapRef } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
interface FormState {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
const search: UnwrapRef<FormState> = reactive({
|
||||
name: '',
|
||||
id: '',
|
||||
});
|
||||
const isShow = ref(false);
|
||||
const loading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const tableLabel = ref([
|
||||
{
|
||||
title: '考试批次',
|
||||
dataIndex: 'batch',
|
||||
align: 'center',
|
||||
key: 'batch',
|
||||
},
|
||||
{
|
||||
title: '总分',
|
||||
dataIndex: 'result',
|
||||
align: 'center',
|
||||
key: 'result',
|
||||
},
|
||||
{
|
||||
title: '听力',
|
||||
align: 'center',
|
||||
dataIndex: 'listen',
|
||||
key: 'listen',
|
||||
},
|
||||
{
|
||||
title: '阅读',
|
||||
dataIndex: 'reading',
|
||||
align: 'center',
|
||||
key: 'reading',
|
||||
},
|
||||
{
|
||||
title: '写作',
|
||||
dataIndex: 'writing',
|
||||
align: 'center',
|
||||
key: 'writing',
|
||||
},
|
||||
]);
|
||||
const rules: Record<string, Rule[]> = {
|
||||
name: [
|
||||
{ required: true, message: '请输入学生姓名', trigger: 'change' }
|
||||
],
|
||||
id: [
|
||||
{ required: true, message: '请输入学生学号', trigger: 'change' }
|
||||
],
|
||||
};
|
||||
const url = ref({
|
||||
getData: '/cet_4/getDataByStudent',
|
||||
});
|
||||
const formRef = ref();
|
||||
const handleSearch = () => {
|
||||
formRef.value.validate().then(async () => {
|
||||
loading.value = true;
|
||||
tableData.value = await defHttp.post({
|
||||
url: url.value.getData,
|
||||
params: search,
|
||||
});
|
||||
tableData.value = tableData.value.results;
|
||||
console.log(tableData.value);
|
||||
loading.value = false;
|
||||
if (tableData.value.length > 0) {
|
||||
isShow.value = true;
|
||||
} else {
|
||||
isShow.value = false;
|
||||
message.warn('未查询到相关信息');
|
||||
}
|
||||
const search: UnwrapRef<FormState> = reactive({
|
||||
name: '',
|
||||
id: '',
|
||||
});
|
||||
};
|
||||
const handleClear = () => {
|
||||
search.name = '';
|
||||
search.id = '';
|
||||
isShow.value = false;
|
||||
tableData.value = [];
|
||||
};
|
||||
const isShow = ref(false);
|
||||
const loading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const tableLabel = ref([
|
||||
{
|
||||
title: '考试批次',
|
||||
dataIndex: 'batch',
|
||||
align: 'center',
|
||||
key: 'batch',
|
||||
},
|
||||
{
|
||||
title: '总分',
|
||||
dataIndex: 'result',
|
||||
align: 'center',
|
||||
key: 'result',
|
||||
},
|
||||
{
|
||||
title: '听力',
|
||||
align: 'center',
|
||||
dataIndex: 'listen',
|
||||
key: 'listen',
|
||||
},
|
||||
{
|
||||
title: '阅读',
|
||||
dataIndex: 'reading',
|
||||
align: 'center',
|
||||
key: 'reading',
|
||||
},
|
||||
{
|
||||
title: '写作',
|
||||
dataIndex: 'writing',
|
||||
align: 'center',
|
||||
key: 'writing',
|
||||
},
|
||||
]);
|
||||
const rules: Record<string, Rule[]> = {
|
||||
name: [{ required: true, message: '请输入学生姓名', trigger: 'change' }],
|
||||
id: [{ required: true, message: '请输入学生学号', trigger: 'change' }],
|
||||
};
|
||||
const url = ref({
|
||||
getData: '/cet_4/getDataByStudent',
|
||||
});
|
||||
const formRef = ref();
|
||||
const handleSearch = () => {
|
||||
formRef.value.validate().then(async () => {
|
||||
loading.value = true;
|
||||
tableData.value = await defHttp.post({
|
||||
url: url.value.getData,
|
||||
params: search,
|
||||
});
|
||||
tableData.value = tableData.value.results;
|
||||
console.log(tableData.value);
|
||||
loading.value = false;
|
||||
if (tableData.value.length > 0) {
|
||||
isShow.value = true;
|
||||
} else {
|
||||
isShow.value = false;
|
||||
message.warn('未查询到相关信息');
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleClear = () => {
|
||||
search.name = '';
|
||||
search.id = '';
|
||||
isShow.value = false;
|
||||
tableData.value = [];
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.outside {
|
||||
// 白色
|
||||
background-color: #fff;
|
||||
height: 100%;
|
||||
.title {
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
padding: 20px 20px 0 20px;
|
||||
.outside {
|
||||
// 白色
|
||||
background-color: #fff;
|
||||
height: 100%;
|
||||
.title {
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
padding: 20px 20px 0 20px;
|
||||
}
|
||||
.form {
|
||||
padding-top: 20px;
|
||||
}
|
||||
.tableContent {
|
||||
padding: 20px;
|
||||
}
|
||||
.infoContent {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
}
|
||||
.form {
|
||||
padding-top: 20px;
|
||||
}
|
||||
.tableContent {
|
||||
padding: 20px;
|
||||
}
|
||||
.infoContent {
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue