204 lines
4.4 KiB
Vue
Raw Normal View History

2025-10-30 15:34:23 +08:00
<template>
2025-10-30 16:34:29 +08:00
<DynamicTable
:dataSource="tableData"
:columns="columns"
:toolbar="toolbar"
:autoHeight="true"
2025-10-30 17:45:10 +08:00
:pagination="pagination"
2025-10-30 16:34:29 +08:00
></DynamicTable>
2025-10-30 15:34:23 +08:00
</template>
<script lang="ts" setup>
2025-10-30 16:34:29 +08:00
import DynamicTable from "../../component/DynamicTable";
2025-10-30 17:45:10 +08:00
import { h, ref, onMounted, reactive } from "vue";
2025-10-30 16:34:29 +08:00
import { request } from "@/utils/request";
2025-10-30 17:08:19 +08:00
2025-10-30 17:45:10 +08:00
const tableData = ref([
2025-10-30 15:34:23 +08:00
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
{
county: "潼南",
road_code: "G319线",
mile_code: "2654+000",
level: "国道",
monthly_traffic: "5625",
tec_level: "二级",
name: "三汇停车区",
service_station_address: "交通公路部门",
},
2025-10-30 17:45:10 +08:00
]);
2025-10-30 17:08:19 +08:00
const getTableData = async () => {
try {
2025-10-30 17:45:10 +08:00
const params = {
pageNum: pagination.current,
pageSize: pagination.pageSize,
};
2025-10-30 17:08:19 +08:00
const res = await request({
2025-10-30 17:45:10 +08:00
url: "/api/yhz/list",
2025-10-30 17:08:19 +08:00
method: "GET",
params: params,
});
} catch (error) {}
};
onMounted(() => {
getTableData();
});
2025-10-30 16:34:29 +08:00
const columns = [
{
prop: "county",
label: "区县",
},
{
prop: "road_code",
label: "路线编码",
// minWidth: 160,
},
{
prop: "mile_code",
label: "里程桩号",
},
{
prop: "level",
label: "行政等级(仅划分:国道、省道、农村公路三类)",
},
{
prop: "monthly_traffic",
label: "机动车月交通流量",
},
{
prop: "tec_level",
label: "技术等级",
},
{
prop: "name",
label: "服务保障点具体名称",
},
{
prop: "type",
label: "类型",
},
{
label: "操作",
fixed: "right",
width: 100,
2025-10-30 17:45:10 +08:00
render: (row) => () =>
h(
ElButton,
{
type: "text",
onClick: () => {
console.log(row);
},
2025-10-30 16:34:29 +08:00
},
2025-10-30 17:45:10 +08:00
() => "详情"
),
2025-10-30 16:34:29 +08:00
},
];
2025-10-30 17:45:10 +08:00
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();
},
});
2025-10-30 15:34:23 +08:00
</script>
<style lang="scss" scoped>
</style>