碳排管理 代码规范
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-table
|
||||
:columns="column"
|
||||
:data-source="data"
|
||||
<a-table
|
||||
:columns="column"
|
||||
:data-source="data"
|
||||
bordered
|
||||
:pagination="false"
|
||||
:scroll="{ x: 2000,y:480 }">
|
||||
:scroll="{ x: 2000, y: 480 }">
|
||||
<template #title>
|
||||
<a-date-picker v-model:value="selectYear" picker="year" @change="changeYearData" valueFormat="YYYY" />
|
||||
<a-date-picker
|
||||
v-model:value="selectYear"
|
||||
picker="year"
|
||||
@change="changeYearData"
|
||||
valueFormat="YYYY" />
|
||||
</template>
|
||||
</a-table>
|
||||
<a-pagination
|
||||
<a-pagination
|
||||
:current="queryParams.pageNum"
|
||||
:total="total"
|
||||
:page-size="queryParams.pageSize"
|
||||
style="display: flex;justify-content: center;margin-top: 16px;"
|
||||
style="display: flex; justify-content: center; margin-top: 16px"
|
||||
:show-size-changer="true"
|
||||
:show-quick-jumper="true"
|
||||
@change="onChange" />
|
||||
@@ -35,26 +39,26 @@
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
const fetch = (api, params = { orgId } ) => {
|
||||
const fetch = (api, params = { orgId }) => {
|
||||
return http.post(api, params);
|
||||
};
|
||||
const data = ref([]);
|
||||
const selectYear = ref<Dayjs>(dayjs( new Date().getFullYear().toString()));
|
||||
const total = ref<number>()
|
||||
const selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
|
||||
const total = ref<number>();
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
year: selectYear.value.format('YYYY'),
|
||||
orgId: orgId.value
|
||||
})
|
||||
|
||||
orgId: orgId.value,
|
||||
});
|
||||
|
||||
// 年份选择改变触发
|
||||
const changeYearData = () => {
|
||||
queryParams.value.year = selectYear.value
|
||||
getTableList()
|
||||
}
|
||||
queryParams.value.year = selectYear.value;
|
||||
getTableList();
|
||||
};
|
||||
// 表头
|
||||
const column: TableColumnsType [] = [
|
||||
const column: TableColumnsType[] = [
|
||||
{
|
||||
title: '排放类型',
|
||||
dataIndex: 'cnValue',
|
||||
@@ -163,24 +167,24 @@
|
||||
};
|
||||
// 获取表格数据
|
||||
const getTableList = () => {
|
||||
fetch(carbonEmission.carbonEmissionStatistics , queryParams.value).then((res) => {
|
||||
data.value = res.data
|
||||
total.value = res.data.length
|
||||
fetch(carbonEmission.carbonEmissionStatistics, queryParams.value).then((res) => {
|
||||
data.value = res.data;
|
||||
total.value = res.data.length;
|
||||
});
|
||||
};
|
||||
getTableList()
|
||||
getTableList();
|
||||
// 分页器
|
||||
const onChange = (pageNumber: number,size: number) => {
|
||||
const onChange = (pageNumber: number, size: number) => {
|
||||
queryParams.value.pageNum = pageNumber;
|
||||
queryParams.value.pageSize = size;
|
||||
getTableList()
|
||||
getTableList();
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
:deep(.ant-table-title){
|
||||
:deep(.ant-table-title) {
|
||||
display: flex;
|
||||
}
|
||||
:deep(.ant-table-container){
|
||||
:deep(.ant-table-container) {
|
||||
padding: 0px 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -189,4 +193,4 @@
|
||||
td.column-money {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user