Browse Source

根据文档优化

temp
fks-xuxinyue 3 months ago
parent
commit
b36081126f
  1. 38
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  2. 7
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  3. 15
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  4. 12
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  5. 24
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  6. 39
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  7. 3
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue

38
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue

@ -50,7 +50,12 @@
</div> </div>
<div style="display: flex; margin-top: 20px; height: calc(85% - 20px)"> <div style="display: flex; margin-top: 20px; height: calc(85% - 20px)">
<div class="detailTable"> <div class="detailTable">
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1280 }"> <ns-view-list-table
class="content-table"
v-bind="tableConfig"
:model="data"
ref="mainRef"
:scroll="{ x: 1280 }">
<template #bodyCell="{ column, text, record }"> <template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'accountType'"> <template v-if="column.dataIndex === 'accountType'">
<span v-if="record.accountType">{{ record.accountType.label }}</span> <span v-if="record.accountType">{{ record.accountType.label }}</span>
@ -76,9 +81,6 @@
<a-table :columns="totalColumns" :data-source="totalData" bordered :pagination="false"> <a-table :columns="totalColumns" :data-source="totalData" bordered :pagination="false">
<template #bodyCell="{ column, text }"> <template #bodyCell="{ column, text }">
<span>{{ text || '-' }}</span> <span>{{ text || '-' }}</span>
<!-- <template v-if="column.dataIndex === 'name'">
<a>{{ text }}</a>
</template> -->
</template> </template>
</a-table> </a-table>
</div> </div>
@ -209,6 +211,7 @@
transactionTypeValue.value = selectedOptions.flatMap((group) => transactionTypeValue.value = selectedOptions.flatMap((group) =>
group.flatMap((node) => [node.value, ...(node.children?.map((child) => child.value) || [])]), group.flatMap((node) => [node.value, ...(node.children?.map((child) => child.value) || [])]),
); );
// transactionTypeValue.value = value.flat()
}; };
const searchTableList = () => { const searchTableList = () => {
year.value = queryParams.value.year; year.value = queryParams.value.year;
@ -481,50 +484,77 @@
title: '资产类别', title: '资产类别',
dataIndex: 'accountType', dataIndex: 'accountType',
width: 100, width: 100,
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '交易方式', title: '交易方式',
dataIndex: 'transactionTypeName', dataIndex: 'transactionTypeName',
width: 100, width: 100,
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '交易日期', title: '交易日期',
dataIndex: 'transactionDate', dataIndex: 'transactionDate',
width: 100, width: 100,
sorter: (a, b) => a.transactionDate - b.transactionDate, sorter: (a, b) => a.transactionDate - b.transactionDate,
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '本期收入(tCO2)', title: '本期收入(tCO2)',
dataIndex: 'income', dataIndex: 'income',
width: 150, width: 150,
sorter: (a, b) => a.income - b.income, sorter: (a, b) => a.income - b.income,
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '本期支出(tCO2)', title: '本期支出(tCO2)',
dataIndex: 'expenditure', dataIndex: 'expenditure',
width: 150, width: 150,
sorter: (a, b) => a.expenditure - b.expenditure, sorter: (a, b) => a.expenditure - b.expenditure,
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '发生金额(¥)', title: '发生金额(¥)',
width: 150, width: 150,
dataIndex: 'amountIncurredValue', dataIndex: 'amountIncurredValue',
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '交易对象', title: '交易对象',
width: 100, width: 100,
dataIndex: 'tradingPartner', dataIndex: 'tradingPartner',
customRender: (text: any) => {
return text.text !== '' ? text : '-';
},
}, },
{ {
title: '更新人', title: '更新人',
width: 100, width: 100,
dataIndex: 'updateUser', dataIndex: 'updateUser',
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
{ {
title: '更新时间', title: '更新时间',
width: 150, width: 150,
ellipsis: true, ellipsis: true,
dataIndex: 'updateTime', dataIndex: 'updateTime',
customRender: (text: any) => {
return text.text !== undefined ? text : '-';
},
}, },
], ],
columnActions: { columnActions: {

7
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts

@ -146,7 +146,7 @@ export const drawerColumns = [
dataIndex: 'dataSources', dataIndex: 'dataSources',
}, },
]; ];
export const setFactorConfig = (orgId, treeId, tableId) => { export const setFactorConfig = (orgId) => {
return ref({ return ref({
api: carbonEmissionFactorLibrary.getTableList, api: carbonEmissionFactorLibrary.getTableList,
params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [0] }, params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [0] },
@ -155,11 +155,10 @@ export const setFactorConfig = (orgId, treeId, tableId) => {
icon: 'deviceType', icon: 'deviceType',
title: '排放分类', title: '排放分类',
}, },
selectedKeys: treeId, selectedKeys: [],
params: { orgId }, params: { orgId },
dynamicParams: { emissionList: 'id[]' }, dynamicParams: { emissionList: 'id[]' },
defaultExpandAll: true, defaultExpandAll: true,
// checkable:true,
api: carbonEmissionFactorLibrary.getCarbonFactorTree, api: carbonEmissionFactorLibrary.getCarbonFactorTree,
fieldNames: { title: 'emissionName', key: 'id' }, fieldNames: { title: 'emissionName', key: 'id' },
formConfig: { formConfig: {
@ -178,7 +177,7 @@ export const setFactorConfig = (orgId, treeId, tableId) => {
}, },
rowSelection: { rowSelection: {
type: 'radio', type: 'radio',
selectedRowKeys: tableId ? tableId : [''], // selectedRowKeys: [],
}, },
columns: [ columns: [
{ {

15
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

@ -804,14 +804,15 @@
.validate() .validate()
.then(() => { .then(() => {
console.log('values', formState, toRaw(formState)); console.log('values', formState, toRaw(formState));
formState.value.year = mainRef.value.nsTableRef.formParamsRef.year const addformState = JSON.parse(JSON.stringify(formState.value));
addformState.year = mainRef.value.nsTableRef.formParamsRef.year
? mainRef.value.nsTableRef.formParamsRef.year ? mainRef.value.nsTableRef.formParamsRef.year
: selectYear.value.format('YYYY'); : selectYear.value.format('YYYY');
if (formState.value.unit) { if (addformState.unit) {
formState.value.unit = formState.value.unit.join(',').split(',')[1]; addformState.unit = addformState.unit.join(',').split(',')[1];
} }
if (formState.value.id) { if (addformState.id) {
fetch(energyConsumption.update, formState.value).then((res) => { fetch(energyConsumption.update, addformState).then((res) => {
if (fileList.value.length !== 0) { if (fileList.value.length !== 0) {
const formData = ref(new FormData()); const formData = ref(new FormData());
fileList.value.forEach((file) => { fileList.value.forEach((file) => {
@ -820,7 +821,7 @@
} }
}); });
formData.value.append('bizType', 3); formData.value.append('bizType', 3);
formData.value.append('bizId', formState.value.id); formData.value.append('bizId', addformState.id);
delIds.value.forEach((item) => { delIds.value.forEach((item) => {
formData.value.append('deleteList', item); formData.value.append('deleteList', item);
}); });
@ -848,7 +849,7 @@
} }
}); });
} else { } else {
fetch(energyConsumption.creat, formState.value).then((res) => { fetch(energyConsumption.creat, addformState).then((res) => {
if (res.data === '新增数据已存在') { if (res.data === '新增数据已存在') {
visible.value = false; visible.value = false;
delIds.value = []; delIds.value = [];

12
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue

@ -512,7 +512,7 @@
}; };
const openVisible = ref(false); const openVisible = ref(false);
const setFactorRef = ref(); const setFactorRef = ref();
const config = setFactorConfig(orgId.value, treeId.value, tableId.value); const config = setFactorConfig(orgId.value);
const selectFactor = () => { const selectFactor = () => {
openVisible.value = true; openVisible.value = true;
if (treeId.value.length > 0) { if (treeId.value.length > 0) {
@ -521,6 +521,16 @@
setFactorRef.value.nsTableRef.treeElRef.selectedKeys = treeId.value; setFactorRef.value.nsTableRef.treeElRef.selectedKeys = treeId.value;
setFactorRef.value.nsTableRef.rowSelection.selectedRowKeys = tableId.value; setFactorRef.value.nsTableRef.rowSelection.selectedRowKeys = tableId.value;
setFactorRef.value.nsTableRef.reload(); setFactorRef.value.nsTableRef.reload();
treeId.value = [];
tableId.value = [];
});
} else {
nextTick(() => {
console.log(setFactorRef.value.nsTableRef.rowSelection);
setFactorRef.value.nsTableRef.params.emissionList = [0];
setFactorRef.value.nsTableRef.treeElRef.selectedKeys = [];
// setFactorRef.value.nsTableRef.rowSelection.selectedRowKeys = [];
setFactorRef.value.nsTableRef.reload();
}); });
} }
}; };

24
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue

@ -1294,7 +1294,10 @@
NsMessage.warn('请选择因子'); NsMessage.warn('请选择因子');
return; return;
} else { } else {
if (newTableData.value[0].emissionFactorUnits === carbonEmission.value) { if (
setFactorRef.value?.nsTableRef.tableState.selectedRows.emissionFactorUnits ===
carbonEmission.value
) {
newTableData.value = setFactorRef.value?.nsTableRef.tableState.selectedRows; newTableData.value = setFactorRef.value?.nsTableRef.tableState.selectedRows;
selectedRowKeysEdit.value = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys; selectedRowKeysEdit.value = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys;
editFormState.value.emissionFactors = newTableData.value[0].emissionFactors; editFormState.value.emissionFactors = newTableData.value[0].emissionFactors;
@ -1906,4 +1909,23 @@
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
} }
:deep(.ns-table-container) {
background: white;
}
:deep(.ns-part-tree) {
border-radius: 8px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
}
:deep(.ns-table-search) {
border-radius: 8px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
}
:deep(.ns-table-main) {
margin-top: 20px !important;
border-radius: 8px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
}
</style> </style>

39
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue

@ -74,11 +74,12 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, toRaw, watch, nextTick } from 'vue'; import { ref, toRaw, watch, nextTick, createVNode, defineComponent } from 'vue';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary'; import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
import fillIn from './fillInPage/index.vue'; import fillIn from './fillInPage/index.vue';
import { message } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import dayjs, { Dayjs } from 'dayjs'; import dayjs, { Dayjs } from 'dayjs';
defineOptions({ name: 'CarbonInventoryCheck' }); defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref(''); const orgId = ref('');
@ -145,7 +146,6 @@
const spinning = ref(false); const spinning = ref(false);
// //
const onSubmit = () => { const onSubmit = () => {
spinning.value = true;
formRef.value formRef.value
.validate() .validate()
.then(() => { .then(() => {
@ -153,11 +153,38 @@
formState.value.orgId = orgId.value; formState.value.orgId = orgId.value;
formState.value.startTime = formState.value.reportScope[0]; formState.value.startTime = formState.value.reportScope[0];
formState.value.endTime = formState.value.reportScope[1]; formState.value.endTime = formState.value.reportScope[1];
if (
oldStartTime.value === formState.value.startTime &&
oldEndTime.value === formState.value.endTime
) {
spinning.value = true;
fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => { fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => {
visible.value = false; visible.value = false;
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
spinning.value = false; spinning.value = false;
}); });
} else {
Modal.confirm({
title: '修改日期后会导致数据丢失是否保留数据?',
icon: createVNode(ExclamationCircleOutlined),
onOk() {
spinning.value = true;
fetch(carbonInventoryCheck.createOrUpdate, formState.value)
.then((res) => {
visible.value = false;
mainRef.value?.nsTableRef.reload();
spinning.value = false;
})
.catch((error) => {
message.error(error ? error : '保存失败!');
});
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
}
}) })
.catch((error) => { .catch((error) => {
console.log('error', error); console.log('error', error);
@ -171,6 +198,8 @@
const endTime = ref(); const endTime = ref();
const standard = ref(); const standard = ref();
const year = ref(); const year = ref();
const oldStartTime = ref();
const oldEndTime = ref();
const tableConfig = ref({ const tableConfig = ref({
title: '数据库', title: '数据库',
api: carbonInventoryCheck.carbonInventoryList, api: carbonInventoryCheck.carbonInventoryList,
@ -240,6 +269,10 @@
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => { fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
formState.value = res.data; formState.value = res.data;
formState.value.reportScope = [res.data.startTime, res.data.endTime]; formState.value.reportScope = [res.data.startTime, res.data.endTime];
formState.value.oldStartTime = res.data.startTime;
formState.value.oldEndTime = res.data.endTime;
oldStartTime.value = res.data.startTime;
oldEndTime.value = res.data.endTime;
}); });
}, },
}, },

3
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue

@ -351,8 +351,7 @@
color: '#f4664a', color: '#f4664a',
width: 2, width: 2,
}, },
// data: referenceValue.value, data: referenceValue.value,
data: [600],
}, },
], ],
}; };

Loading…
Cancel
Save