taskId:099 remark:"commit"
This commit is contained in:
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <a-table
|
||||
:columns="column"
|
||||
:data-source="data"
|
||||
bordered
|
||||
:pagination="false"
|
||||
:scroll="{ x: 2000 }">
|
||||
<template #title>
|
||||
<a-date-picker v-model:value="selectYear" picker="year" @change="changeYearData" valueFormat="YYYY" />
|
||||
</template>
|
||||
</a-table> -->
|
||||
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
|
||||
<!-- <a-pagination
|
||||
:current="queryParams.pageNum"
|
||||
:total="total"
|
||||
:page-size="queryParams.pageSize"
|
||||
style="display: flex;justify-content: center;margin-top: 16px;"
|
||||
:show-size-changer="true"
|
||||
:show-quick-jumper="true"
|
||||
@change="onChange" /> -->
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { Pagination } from 'ant-design-vue';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import { carbonEmission } from '/@/api/carbonEmissionFactorLibrary';
|
||||
defineOptions({
|
||||
energyType: 'CarbonEmissions', // 与页面路由name一致缓存才可生效
|
||||
components: {
|
||||
'a-pagination': Pagination,
|
||||
},
|
||||
});
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
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 queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
year: selectYear.value.format('YYYY'),
|
||||
orgId: orgId.value
|
||||
})
|
||||
|
||||
// 年份选择改变触发
|
||||
// const changeYearData = () => {
|
||||
// queryParams.value.year = selectYear.value
|
||||
// getTableList()
|
||||
// }
|
||||
// 表头
|
||||
const mainRef = ref();
|
||||
const column: TableColumnsType [] = [
|
||||
{
|
||||
title: '排放类型',
|
||||
dataIndex: 'cnValue',
|
||||
customCell: (record, rowIndex) => {
|
||||
if (rowIndex == undefined) {
|
||||
return {
|
||||
rowSpan: 0,
|
||||
colSpan: 0,
|
||||
};
|
||||
}
|
||||
const rowSpan = getRowSpan('cnValue', record, data.value);
|
||||
if (rowIndex != 0 && data.value[rowIndex - 1].name == record.name) {
|
||||
return {
|
||||
rowSpan: 0,
|
||||
colSpan: 0,
|
||||
};
|
||||
}
|
||||
return {
|
||||
rowSpan: rowSpan,
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '能源种类',
|
||||
dataIndex: 'energyType',
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '加权平均',
|
||||
dataIndex: 'averageFactorValue',
|
||||
},
|
||||
{
|
||||
title: '全年',
|
||||
dataIndex: 'carbonYearly',
|
||||
},
|
||||
{
|
||||
title: '1月',
|
||||
dataIndex: 'jan',
|
||||
},
|
||||
{
|
||||
title: '2月',
|
||||
dataIndex: 'feb',
|
||||
},
|
||||
{
|
||||
title: '3月',
|
||||
dataIndex: 'mar',
|
||||
},
|
||||
{
|
||||
title: '4月',
|
||||
dataIndex: 'apr',
|
||||
},
|
||||
{
|
||||
title: '5月',
|
||||
dataIndex: 'may',
|
||||
},
|
||||
{
|
||||
title: '6月',
|
||||
dataIndex: 'jun',
|
||||
},
|
||||
{
|
||||
title: '7月',
|
||||
dataIndex: 'jul',
|
||||
},
|
||||
{
|
||||
title: '8月',
|
||||
dataIndex: 'aug',
|
||||
},
|
||||
{
|
||||
title: '9月',
|
||||
dataIndex: 'sep',
|
||||
},
|
||||
{
|
||||
title: '10月',
|
||||
dataIndex: 'oct',
|
||||
},
|
||||
{
|
||||
title: '11月',
|
||||
dataIndex: 'nov',
|
||||
},
|
||||
{
|
||||
title: '12月',
|
||||
dataIndex: 'dec',
|
||||
},
|
||||
];
|
||||
const year = ref(selectYear.value.format('YYYY'))
|
||||
const tableConfig = ref({
|
||||
title: '碳排统计',
|
||||
api: carbonEmission.carbonEmissionStatistics,
|
||||
params: {
|
||||
orgId,
|
||||
year
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: '排放类型',
|
||||
dataIndex: 'cnValue',
|
||||
customCell: (record, rowIndex) => {
|
||||
if (rowIndex == undefined) {
|
||||
return {
|
||||
rowSpan: 0,
|
||||
colSpan: 0,
|
||||
};
|
||||
}
|
||||
const rowSpan = getRowSpan('cnValue', record, data.value);
|
||||
if (rowIndex != 0 && data.value[rowIndex - 1].name == record.name) {
|
||||
return {
|
||||
rowSpan: 0,
|
||||
colSpan: 0,
|
||||
};
|
||||
}
|
||||
return {
|
||||
rowSpan: rowSpan,
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '能源种类',
|
||||
dataIndex: 'energyType',
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '加权平均',
|
||||
dataIndex: 'averageFactorValue',
|
||||
},
|
||||
{
|
||||
title: '全年',
|
||||
dataIndex: 'carbonYearly',
|
||||
},
|
||||
{
|
||||
title: '1月',
|
||||
dataIndex: 'jan',
|
||||
},
|
||||
{
|
||||
title: '2月',
|
||||
dataIndex: 'feb',
|
||||
},
|
||||
{
|
||||
title: '3月',
|
||||
dataIndex: 'mar',
|
||||
},
|
||||
{
|
||||
title: '4月',
|
||||
dataIndex: 'apr',
|
||||
},
|
||||
{
|
||||
title: '5月',
|
||||
dataIndex: 'may',
|
||||
},
|
||||
{
|
||||
title: '6月',
|
||||
dataIndex: 'jun',
|
||||
},
|
||||
{
|
||||
title: '7月',
|
||||
dataIndex: 'jul',
|
||||
},
|
||||
{
|
||||
title: '8月',
|
||||
dataIndex: 'aug',
|
||||
},
|
||||
{
|
||||
title: '9月',
|
||||
dataIndex: 'sep',
|
||||
},
|
||||
{
|
||||
title: '10月',
|
||||
dataIndex: 'oct',
|
||||
},
|
||||
{
|
||||
title: '11月',
|
||||
dataIndex: 'nov',
|
||||
},
|
||||
{
|
||||
title: '12月',
|
||||
dataIndex: 'dec',
|
||||
},
|
||||
],
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'year',
|
||||
label: '年份',
|
||||
component: 'NsDatePicker',
|
||||
componentProps: {
|
||||
picker: 'year',
|
||||
valueFormat: 'YYYY',
|
||||
defaultValue: selectYear.value.format('YYYY'),
|
||||
},
|
||||
},
|
||||
],
|
||||
params: {},
|
||||
},
|
||||
rowKey: 'id',
|
||||
});
|
||||
// 合并单元格
|
||||
const getRowSpan = (dataIndex: string, record: any, data: any, dependents: string[] = []) => {
|
||||
let rowSpan = 1;
|
||||
for (let i = data.indexOf(record) + 1; i < data.length; i++) {
|
||||
let shouldMerge = true;
|
||||
for (const dependent of dependents) {
|
||||
if (data[i][dependent] !== record[dependent]) {
|
||||
shouldMerge = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldMerge && data[i][dataIndex] === record[dataIndex]) {
|
||||
rowSpan++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rowSpan;
|
||||
};
|
||||
// 获取表格数据
|
||||
// const getTableList = () => {
|
||||
// fetch(carbonEmission.carbonEmissionStatistics , queryParams.value).then((res) => {
|
||||
// data.value = res.data.records
|
||||
// total.value = res.data.total
|
||||
// });
|
||||
// };
|
||||
// 分页器
|
||||
// const onChange = (pageNumber: number,size: number) => {
|
||||
// queryParams.value.pageNum = pageNumber;
|
||||
// queryParams.value.pageSize = size;
|
||||
// getTableList()
|
||||
// };
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
::v-deep .ant-table-title{
|
||||
display: flex;
|
||||
}
|
||||
::v-deep .ant-table-container{
|
||||
padding: 0px 16px;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
th.column-money,
|
||||
td.column-money {
|
||||
text-align: right !important;
|
||||
}
|
||||
</style>
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-table
|
||||
<!-- <a-table
|
||||
:columns="tableColumns"
|
||||
:data-source="data"
|
||||
bordered
|
||||
@@ -26,15 +26,16 @@
|
||||
<a-button type="primary">凭证下载</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
<a-pagination
|
||||
</a-table> -->
|
||||
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1500}" />
|
||||
<!-- <a-pagination
|
||||
:current="queryParams.pageNum"
|
||||
:total="total"
|
||||
:page-size="queryParams.pageSize"
|
||||
style="display: flex;justify-content: center;margin-top: 16px;"
|
||||
:show-size-changer="true"
|
||||
:show-quick-jumper="true"
|
||||
@change="onChange" />
|
||||
@change="onChange" /> -->
|
||||
<!-- 新增数据库数据 -->
|
||||
<a-drawer
|
||||
:width="500"
|
||||
@@ -158,6 +159,7 @@
|
||||
import { Pagination,message,Modal } from 'ant-design-vue';
|
||||
import { InboxOutlined } from '@ant-design/icons-vue';
|
||||
import type { CascaderProps,TreeSelectProps,UploadChangeParam } from 'ant-design-vue';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { tableColumns } from '../config';
|
||||
@@ -229,19 +231,182 @@
|
||||
queryParams.value.year = selectYear.value
|
||||
getTableList()
|
||||
}
|
||||
const mainRef = ref();
|
||||
const year = selectYear.value.format('YYYY')
|
||||
const tableConfig = ref({
|
||||
title: '能耗统计',
|
||||
api: energyConsumption.pageList,
|
||||
params: queryParams.value,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'userAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
getDictList()
|
||||
visible.value = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
type: 'primary',
|
||||
name: 'userImport',
|
||||
handle: () => {},
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
type: 'primary',
|
||||
name: 'userExports',
|
||||
},
|
||||
{
|
||||
label: '模板下载',
|
||||
type: 'primary',
|
||||
name: 'userExports',
|
||||
},
|
||||
{
|
||||
label: '上传凭证',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
openUpload.value = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '凭证下载',
|
||||
type: 'primary',
|
||||
name: 'userExports',
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '能源种类',
|
||||
dataIndex: 'energyType',
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
className: 'unit',
|
||||
dataIndex: 'unit',
|
||||
},
|
||||
{
|
||||
title: '全年',
|
||||
dataIndex: 'yearly',
|
||||
},
|
||||
{
|
||||
title: '1月',
|
||||
dataIndex: 'jan',
|
||||
// customRender: ({ text, record }) => ({
|
||||
// children: text,
|
||||
// attrs: {
|
||||
// style: record.janFlag === 1 ? 'color: red' : 'color: blue'
|
||||
// }
|
||||
// })
|
||||
},
|
||||
{
|
||||
title: '2月',
|
||||
dataIndex: 'feb',
|
||||
},
|
||||
{
|
||||
title: '3月',
|
||||
dataIndex: 'mar',
|
||||
},
|
||||
{
|
||||
title: '4月',
|
||||
dataIndex: 'apr',
|
||||
},
|
||||
{
|
||||
title: '5月',
|
||||
dataIndex: 'may',
|
||||
},
|
||||
{
|
||||
title: '6月',
|
||||
dataIndex: 'jun',
|
||||
},
|
||||
{
|
||||
title: '7月',
|
||||
dataIndex: 'jul',
|
||||
},
|
||||
{
|
||||
title: '8月',
|
||||
dataIndex: 'aug',
|
||||
},
|
||||
{
|
||||
title: '9月',
|
||||
dataIndex: 'sep',
|
||||
},
|
||||
{
|
||||
title: '10月',
|
||||
dataIndex: 'oct',
|
||||
},
|
||||
{
|
||||
title: '11月',
|
||||
dataIndex: 'nov',
|
||||
},
|
||||
{
|
||||
title: '12月',
|
||||
dataIndex: 'dec',
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'userEdit',
|
||||
handle: (record: any) => {
|
||||
getDictList()
|
||||
visible.value = true
|
||||
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
|
||||
if(res.data.unit){
|
||||
res.data.unit = res.data.unit.split(',')
|
||||
}
|
||||
formState.value = res.data
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'userDelete',
|
||||
dynamicParams: { id: 'id' },
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
api: energyConsumption.del,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'year',
|
||||
label: '年份',
|
||||
component: 'NsDatePicker',
|
||||
componentProps: {
|
||||
picker: 'year',
|
||||
valueFormat: 'YYYY',
|
||||
defaultValue: selectYear.value.format('YYYY'),
|
||||
},
|
||||
},
|
||||
],
|
||||
params: {},
|
||||
},
|
||||
rowKey: 'id',
|
||||
});
|
||||
// 获取表格数据
|
||||
const getTableList = () => {
|
||||
fetch(energyConsumption.pageList , queryParams.value).then((res) => {
|
||||
data.value = res.data.records
|
||||
total.value = res.data.total
|
||||
});
|
||||
};
|
||||
getTableList()
|
||||
// 分页器
|
||||
const onChange = (pageNumber: number,size: number) => {
|
||||
queryParams.value.pageNum = pageNumber;
|
||||
queryParams.value.pageSize = size;
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
};
|
||||
// 计算碳排切换
|
||||
const changeRadio = (e) => {
|
||||
@@ -263,23 +428,20 @@
|
||||
if(formState.value.id){
|
||||
fetch(energyConsumption.update , formState.value).then((res) => {
|
||||
visible.value = false
|
||||
formState.value = {}
|
||||
message.success('操作成功!');
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
}else{
|
||||
fetch(energyConsumption.creat , formState.value).then((res) => {
|
||||
if(res.data === '新增数据已存在'){
|
||||
visible.value = false
|
||||
queryParams.value = formState.value
|
||||
queryParams.value.pageNum = 1,
|
||||
queryParams.value.pageSize = 10,
|
||||
queryParams.value.orgId = orgId.value,
|
||||
queryParams.value.year = selectYear.value.format('YYYY')
|
||||
getTableList()
|
||||
NsMessage.warning(res.data);
|
||||
}else{
|
||||
visible.value = false
|
||||
formState.value = {}
|
||||
message.success('操作成功!');
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -298,10 +460,10 @@
|
||||
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT'}).then((res) => {
|
||||
measurementUnit.value = res.data
|
||||
measurementUnit.value = measurementUnit.value.map(item => ({
|
||||
value: item.cnValue,
|
||||
value: item.id,
|
||||
label: item.cnValue,
|
||||
children: item.children ? item.children.map(child => ({
|
||||
value: child.cnValue,
|
||||
value: child.id,
|
||||
label: child.cnValue
|
||||
})) : []
|
||||
}));
|
||||
@@ -310,10 +472,10 @@
|
||||
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => {
|
||||
treeData.value = res.data
|
||||
treeData.value = treeData.value.map(item => ({
|
||||
value: item.pointName,
|
||||
value: item.id,
|
||||
label: item.pointName,
|
||||
children: item.children ? item.children.map(child => ({
|
||||
value: child.pointName,
|
||||
value: child.id,
|
||||
label: child.pointName
|
||||
})) : []
|
||||
}));
|
||||
@@ -346,7 +508,7 @@
|
||||
onOk() {
|
||||
fetch(energyConsumption.del , {id : record.id }).then((res) => {
|
||||
message.success('操作成功!');
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
@@ -357,6 +519,7 @@
|
||||
// 关闭新增抽屉
|
||||
const onClose = () => {
|
||||
visible.value = false;
|
||||
formState.value = {}
|
||||
formRef.value.resetFields();
|
||||
};
|
||||
// 点击上传凭证按钮
|
||||
|
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a-table
|
||||
<!-- <a-table
|
||||
:columns="columns"
|
||||
:data-source="tableData"
|
||||
bordered
|
||||
@@ -59,7 +59,8 @@
|
||||
<a-button type="primary" @click="addNewData">新增</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-table> -->
|
||||
<ns-view-list-table v-bind="tableConfig" :model="tableData" ref="mainRef" />
|
||||
<a-pagination
|
||||
:current="queryParams.pageNum"
|
||||
:total="total"
|
||||
@@ -139,6 +140,7 @@
|
||||
const fetch = (api, params = { orgId } ) => {
|
||||
return http.post(api, params);
|
||||
};
|
||||
const mainRef = ref();
|
||||
// 数结构
|
||||
const x = 3;
|
||||
const y = 2;
|
||||
@@ -209,12 +211,13 @@
|
||||
autoExpandParent.value = false;
|
||||
};
|
||||
// 被选中的树节点
|
||||
const energyType = ref()
|
||||
const onSelect = (selectedKey: string[], info: any) => {
|
||||
selectedKeys.value = selectedKey;
|
||||
if(info.selected){
|
||||
queryParams.value.energyType = info.node.id
|
||||
energyType.value = info.node.id
|
||||
statsId.value = info.node.id
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -239,10 +242,9 @@
|
||||
const getTreeData = () => {
|
||||
fetch(quickCalculation.carbonQuickTree).then((res) => {
|
||||
gData.value = res.data
|
||||
debugger
|
||||
queryParams.value.energyType = gData.value[0].children[0].id
|
||||
energyType.value = gData.value[0].children[0].id
|
||||
statsId.value = gData.value[0].children[0].id
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
};
|
||||
getTreeData()
|
||||
@@ -254,6 +256,90 @@
|
||||
orgId: orgId.value
|
||||
})
|
||||
const tableData = ref([]);
|
||||
|
||||
const tableConfig = ref({
|
||||
title: '排放因子库',
|
||||
api: quickCalculation.queryCarbonEmissionPage,
|
||||
params: {
|
||||
orgId,
|
||||
energyType
|
||||
},
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'userAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
visible.value = true
|
||||
getNewTable()
|
||||
},
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '因子值',
|
||||
dataIndex: 'emissionFactors',
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
className: 'carbonEmissionSuffix',
|
||||
dataIndex: 'carbonEmissionSuffix',
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
className: 'updateTime',
|
||||
dataIndex: 'updateTime',
|
||||
},
|
||||
{
|
||||
title: '启用时间',
|
||||
className: 'startTime',
|
||||
dataIndex: 'startTime',
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
className: 'endTime',
|
||||
dataIndex: 'endTime',
|
||||
},
|
||||
{
|
||||
title: '数据来源',
|
||||
className: 'dataSources',
|
||||
dataIndex: 'dataSources',
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'userEdit',
|
||||
handle: (record: any) => {
|
||||
selectedRowKeys.value = [record.carbonId];
|
||||
formState.value.id = record.id
|
||||
formState.value.emissionFactors = record.emissionFactors
|
||||
formState.value.dateRange = [record.startTime, record.endTime];
|
||||
formState.value.carbonId = record.carbonId
|
||||
visible.value = true
|
||||
getNewTable()
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'userDelete',
|
||||
dynamicParams: { id: 'id' },
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
api: quickCalculation.del,
|
||||
},
|
||||
],
|
||||
},
|
||||
rowKey: 'id',
|
||||
});
|
||||
// 获取列表数据
|
||||
const getTableList = () => {
|
||||
fetch(quickCalculation.queryCarbonEmissionPage,queryParams.value).then((res) => {
|
||||
@@ -265,7 +351,7 @@
|
||||
const onChange = (pageNumber: number,size: number) => {
|
||||
queryParams.value.pageNum = pageNumber;
|
||||
queryParams.value.pageSize = size;
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
};
|
||||
// 新增/编辑
|
||||
const formRef = ref();
|
||||
@@ -321,14 +407,13 @@
|
||||
formState.value.startTime = formState.value.dateRange[0]
|
||||
formState.value.endTime = formState.value.dateRange[1]
|
||||
console.log('values', formState, toRaw(formState));
|
||||
debugger
|
||||
if(formState.value.id){
|
||||
fetch(quickCalculation.update,formState.value).then((res) => {
|
||||
visible.value = false
|
||||
selectedRowKeys.value = [];
|
||||
formState.value = {}
|
||||
formRef.value.resetFields();
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
}else{
|
||||
fetch(quickCalculation.creat,formState.value).then((res) => {
|
||||
@@ -336,7 +421,7 @@
|
||||
selectedRowKeys.value = [];
|
||||
formState.value = {}
|
||||
formRef.value.resetFields();
|
||||
getTableList()
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -408,6 +493,9 @@
|
||||
::v-deep .ant-table-container{
|
||||
padding: 0px 16px;
|
||||
}
|
||||
:deep(.ns-table-main) {
|
||||
margin-top: unset !important;
|
||||
}
|
||||
.top {
|
||||
overflow: auto;
|
||||
}
|
||||
|
Reference in New Issue
Block a user