删除a-table自带分页

This commit is contained in:
linlihong 2024-09-10 10:57:30 +08:00
parent 9632a7bcce
commit 4c60ba4ca7
1 changed files with 99 additions and 103 deletions

View File

@ -34,29 +34,29 @@
</a-row> </a-row>
</div> </div>
<div class="tableContent" v-if="isShow"> <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>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import type { UnwrapRef } from 'vue'; import type { UnwrapRef } from 'vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form';
interface FormState { interface FormState {
name: string; name: string;
id: string; id: string;
} }
const search: UnwrapRef<FormState> = reactive({ const search: UnwrapRef<FormState> = reactive({
name: '', name: '',
id: '', id: '',
}); });
const isShow = ref(false); const isShow = ref(false);
const loading = ref(false); const loading = ref(false);
const tableData = ref([]); const tableData = ref([]);
const tableLabel = ref([ const tableLabel = ref([
{ {
title: '考试批次', title: '考试批次',
dataIndex: 'batch', dataIndex: 'batch',
@ -87,20 +87,16 @@ const tableLabel = ref([
align: 'center', align: 'center',
key: 'writing', key: 'writing',
}, },
]); ]);
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
name: [ name: [{ required: true, message: '请输入学生姓名', trigger: 'change' }],
{ required: true, message: '请输入学生姓名', trigger: 'change' } id: [{ required: true, message: '请输入学生学号', trigger: 'change' }],
], };
id: [ const url = ref({
{ required: true, message: '请输入学生学号', trigger: 'change' }
],
};
const url = ref({
getData: '/cet_4/getDataByStudent', getData: '/cet_4/getDataByStudent',
}); });
const formRef = ref(); const formRef = ref();
const handleSearch = () => { const handleSearch = () => {
formRef.value.validate().then(async () => { formRef.value.validate().then(async () => {
loading.value = true; loading.value = true;
tableData.value = await defHttp.post({ tableData.value = await defHttp.post({
@ -117,16 +113,16 @@ const handleSearch = () => {
message.warn('未查询到相关信息'); message.warn('未查询到相关信息');
} }
}); });
}; };
const handleClear = () => { const handleClear = () => {
search.name = ''; search.name = '';
search.id = ''; search.id = '';
isShow.value = false; isShow.value = false;
tableData.value = []; tableData.value = [];
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.outside { .outside {
// //
background-color: #fff; background-color: #fff;
height: 100%; height: 100%;
@ -145,5 +141,5 @@ const handleClear = () => {
padding: 20px; padding: 20px;
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
} }
} }
</style> </style>