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

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

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

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

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

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

@ -512,7 +512,7 @@
};
const openVisible = ref(false);
const setFactorRef = ref();
const config = setFactorConfig(orgId.value, treeId.value, tableId.value);
const config = setFactorConfig(orgId.value);
const selectFactor = () => {
openVisible.value = true;
if (treeId.value.length > 0) {
@ -521,6 +521,16 @@
setFactorRef.value.nsTableRef.treeElRef.selectedKeys = treeId.value;
setFactorRef.value.nsTableRef.rowSelection.selectedRowKeys = tableId.value;
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('请选择因子');
return;
} else {
if (newTableData.value[0].emissionFactorUnits === carbonEmission.value) {
if (
setFactorRef.value?.nsTableRef.tableState.selectedRows.emissionFactorUnits ===
carbonEmission.value
) {
newTableData.value = setFactorRef.value?.nsTableRef.tableState.selectedRows;
selectedRowKeysEdit.value = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys;
editFormState.value.emissionFactors = newTableData.value[0].emissionFactors;
@ -1906,4 +1909,23 @@
justify-content: center;
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>

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

@ -74,11 +74,12 @@
</template>
<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 { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
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';
defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref('');
@ -145,7 +146,6 @@
const spinning = ref(false);
//
const onSubmit = () => {
spinning.value = true;
formRef.value
.validate()
.then(() => {
@ -153,11 +153,38 @@
formState.value.orgId = orgId.value;
formState.value.startTime = formState.value.reportScope[0];
formState.value.endTime = formState.value.reportScope[1];
fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => {
visible.value = false;
mainRef.value?.nsTableRef.reload();
spinning.value = false;
});
if (
oldStartTime.value === formState.value.startTime &&
oldEndTime.value === formState.value.endTime
) {
spinning.value = true;
fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => {
visible.value = false;
mainRef.value?.nsTableRef.reload();
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) => {
console.log('error', error);
@ -171,6 +198,8 @@
const endTime = ref();
const standard = ref();
const year = ref();
const oldStartTime = ref();
const oldEndTime = ref();
const tableConfig = ref({
title: '数据库',
api: carbonInventoryCheck.carbonInventoryList,
@ -240,6 +269,10 @@
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
formState.value = res.data;
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',
width: 2,
},
// data: referenceValue.value,
data: [600],
data: referenceValue.value,
},
],
};

Loading…
Cancel
Save