This commit is contained in:
huangchenhao 2025-10-30 17:45:10 +08:00
parent 4e36b54bbc
commit 14f00b6613

View File

@ -4,16 +4,16 @@
:columns="columns" :columns="columns"
:toolbar="toolbar" :toolbar="toolbar"
:autoHeight="true" :autoHeight="true"
:pagination="true" :pagination="pagination"
></DynamicTable> ></DynamicTable>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import DynamicTable from "../../component/DynamicTable"; import DynamicTable from "../../component/DynamicTable";
import { h, onMounted } from "vue"; import { h, ref, onMounted, reactive } from "vue";
import { request } from "@/utils/request"; import { request } from "@/utils/request";
const tableData = [ const tableData = ref([
{ {
county: "潼南", county: "潼南",
road_code: "G319线", road_code: "G319线",
@ -114,16 +114,20 @@ const tableData = [
name: "三汇停车区", name: "三汇停车区",
service_station_address: "交通公路部门", service_station_address: "交通公路部门",
}, },
]; ]);
const getTableData = async () => { const getTableData = async () => {
try { try {
const params = {}; const params = {
pageNum: pagination.current,
pageSize: pagination.pageSize,
};
const res = await request({ const res = await request({
url: "/api/asdsad/asdasd", url: "/api/yhz/list",
method: "GET", method: "GET",
params: params, params: params,
}); });
} catch (error) {} } catch (error) {}
}; };
onMounted(() => { onMounted(() => {
@ -167,18 +171,32 @@ const columns = [
label: "操作", label: "操作",
fixed: "right", fixed: "right",
width: 100, width: 100,
render: (row) => () => h( render: (row) => () =>
ElButton, h(
{ ElButton,
type: "text", {
onClick: () => { type: "text",
console.log(row); onClick: () => {
console.log(row);
},
}, },
}, () => "详情"
() => "详情" ),
),
}, },
]; ];
const pagination = reactive({
current: 1,
pageSize: 10,
total: 0,
pageSizes: [10, 20, 50],
layout: "prev, pager, next, jumper",
onChange: (page: number, pageSize: number) => {
pagination.current = page;
pagination.pageSize = pageSize;
getTableData();
},
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>