Browse Source

根据文档进行优化

temp
fks-xuxinyue 3 weeks ago
parent
commit
6ba03df551
  1. BIN
      hx-ai-intelligent/public/asset/file/emissionSource.xlsx
  2. BIN
      hx-ai-intelligent/public/asset/file/energyConsumption.xlsx
  3. 5
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  4. 3
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/carbonEmissions/index.vue
  5. 10
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  6. 4
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  7. 80
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  8. 16
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  9. 37
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  10. 8
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue
  11. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue
  12. 4
      lib/util/xlsx-util.ts

BIN
hx-ai-intelligent/public/asset/file/emissionSource.xlsx

Binary file not shown.

BIN
hx-ai-intelligent/public/asset/file/energyConsumption.xlsx

Binary file not shown.

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

@ -48,7 +48,7 @@
</a-form>
</a-card>
</div>
<div style="display: flex; margin-top: 20px; height: calc(84% - 20px)">
<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 }">
<template #bodyCell="{ column, text, record }">
@ -523,6 +523,7 @@
{
title: '更新时间',
width: 150,
ellipsis: true,
dataIndex: 'updateTime',
},
],
@ -826,7 +827,7 @@
padding: 16px;
}
.search {
height: 16%;
height: 15%;
}
.detailTable {
width: 70%;

3
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/carbonEmissions/index.vue

@ -13,6 +13,9 @@
<a-button type="primary" ghost style="margin-left: 6px" @click="reset">重置</a-button>
</span>
</template>
<template #bodyCell="{ column, text }">
<span>{{ text || '-' }}</span>
</template>
</a-table>
<!-- <a-pagination
:current="queryParams.pageNum"

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

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

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

@ -297,9 +297,7 @@
indexName: '能源种类', //
message: [
{ label: '1、若必填项未填写,则不能进行导入操作' },
{ label: `2、当重复时,则更新数据。` },
{ label: '3、数据将从模版的第五行进行导入。' },
{ label: '4、文件导入勿超过5MB。' },
{ label: '2、文件导入勿超过5MB。' },
],
},
},

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

@ -21,20 +21,22 @@
:auto-expand-parent="autoExpandParent"
:selectedKeys="selectedKeys"
:tree-data="gData"
:show-line="{ showLeafIcon: false }"
show-line
@expand="onExpand"
@select="onSelect"
style="padding: 0 16px !important">
<template #title="data">
<span
<!-- <span
v-if="data.energyType && searchValue && data.energyType.indexOf(searchValue) > -1">
{{ data.energyType.substring(0, data.energyType.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{
data.energyType.substring(data.energyType.indexOf(searchValue) + searchValue.length)
}}
</span>
<span v-else>{{ data.energyType }}</span>
</span> -->
<span v-if="data.code">{{ truncatedName(data.energyType + data.code) }}</span>
<span v-else>{{ truncatedName(data.energyType) }}</span>
</template>
</a-tree>
</div>
@ -130,8 +132,8 @@
</template>
<script lang="ts" setup>
import { ref, watch, toRaw, defineExpose } from 'vue';
import type { TreeProps } from 'ant-design-vue';
import { ref, watch, toRaw, defineExpose, nextTick } from 'vue';
import { message, TreeProps } from 'ant-design-vue';
import { Pagination, Modal } from 'ant-design-vue';
import { columns, drawerColumns } from '../config';
import { http } from '/nerv-lib/util/http';
@ -225,6 +227,12 @@
expandedKeys.value = keys;
autoExpandParent.value = false;
};
const truncatedName = (name) => {
if (name.length > 8) {
return name.substring(0, 8) + '...';
}
return name;
};
//
const energyType = ref();
const onSelect = (selectedKey: string[], info: any) => {
@ -245,16 +253,22 @@
return null;
})
.filter((item, i, self) => item && self.indexOf(item) === i);
expandedKeys.value = expanded;
// expandedKeys.value = expanded;
searchValue.value = value;
autoExpandParent.value = true;
});
//
const onSearchTreeData = () => {};
const getTreeQuery = ref({
orgId: orgId.value,
});
const onSearchTreeData = () => {
getTreeQuery.value.energyType = searchValue.value;
getTreeData();
};
const statsId = ref();
//
const getTreeData = () => {
fetch(quickCalculation.carbonQuickTree, { orgId: orgId.value }).then((res) => {
fetch(quickCalculation.carbonQuickTree, getTreeQuery.value).then((res) => {
gData.value = res.data;
energyType.value = gData.value[0].children[0].id;
statsId.value = gData.value[0].children[0].id;
@ -271,9 +285,12 @@
});
const tableData = ref([]);
const emissionSources = ref();
const treeId = ref([]);
const tableId = ref([]);
const tableConfig = ref({
title: '排放因子库',
api: quickCalculation.queryCarbonEmissionPage,
rowSelection: null,
params: {
orgId,
energyType,
@ -307,12 +324,6 @@
dataIndex: 'carbonEmissionSuffix',
},
{
title: '更新时间',
className: 'updateTime',
dataIndex: 'updateTime',
ellipsis: true,
},
{
title: '启用时间',
className: 'startTime',
dataIndex: 'startTime',
@ -327,6 +338,12 @@
className: 'dataSources',
dataIndex: 'dataSources',
},
{
title: '更新时间',
className: 'updateTime',
dataIndex: 'updateTime',
ellipsis: true,
},
],
columnActions: {
title: '操作',
@ -342,8 +359,10 @@
formState.value.factorId = record.factorId;
text.value = '编辑';
visible.value = true;
emissionSources.value = record.factorId; //todo
queryData.value.factorId = emissionSources.value; //todo
emissionSources.value = record.factorId;
queryData.value.factorId = emissionSources.value;
treeId.value = [record.treeId];
tableId.value = [record.factorId];
getNewTable();
},
},
@ -450,6 +469,7 @@
selectedRowKeys.value = [];
formState.value = {};
formRef.value.resetFields();
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
});
} else {
@ -458,6 +478,7 @@
selectedRowKeys.value = [];
formState.value = {};
formRef.value.resetFields();
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
});
}
@ -487,9 +508,15 @@
};
const openVisible = ref(false);
const setFactorRef = ref();
const config = setFactorConfig(orgId.value);
const config = setFactorConfig(orgId.value, treeId.value, tableId.value);
const selectFactor = () => {
openVisible.value = true;
nextTick(() => {
setFactorRef.value.nsTableRef.params.emissionList = treeId.value;
setFactorRef.value.nsTableRef.treeElRef.selectedKeys = treeId.value;
setFactorRef.value.nsTableRef.rowSelection.selectedRowKeys = tableId.value;
setFactorRef.value.nsTableRef.reload();
});
};
const btnClick = () => {
let selectRowKeys = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys;
@ -624,6 +651,25 @@
:deep(.ant-modal-footer) {
border-top: 10px solid #f0f0f0 !important;
}
: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 scoped>
th.column-money,

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

@ -1193,11 +1193,11 @@
return regex.test(filename);
};
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
const filename = file.name;
if (!isValidFileName(filename)) {
message.error('文件名不符合规则');
return Upload.LIST_IGNORE; //
}
// const filename = file.name;
// if (!isValidFileName(filename)) {
// message.error('');
// return Upload.LIST_IGNORE; //
// }
return false;
};
const handleChange = (info: UploadChangeParam) => {
@ -1284,14 +1284,16 @@
NsMessage.warn('请选择因子');
return;
} else {
if (newTableData.value.emissionFactorUnits === carbonEmission.value) {
if (newTableData.value[0].emissionFactorUnits === carbonEmission.value) {
newTableData.value = setFactorRef.value?.nsTableRef.tableState.selectedRows;
selectedRowKeysEdit.value = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys;
editFormState.value.emissionFactors = newTableData.value[0].emissionFactors;
editFormState.value.factorId = selectedRowKeysEdit.value[0];
openVisible.value = false;
} else {
NsMessage.warn('因子值单位不统一,请重新选择!');
NsMessage.warn(
'因子值单位与当前因子值单位(' + carbonEmission.value + ')不统一,请重新选择!',
);
}
}
};

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

@ -39,11 +39,7 @@
placeholder="请输入报告名称" />
</a-form-item>
<a-form-item ref="name" label="报告年度" name="reportYear">
<a-date-picker
v-model:value="formState.reportYear"
@openChange="openChange"
picker="year"
valueFormat="YYYY" />
<a-date-picker v-model:value="formState.reportYear" picker="year" valueFormat="YYYY" />
</a-form-item>
<a-form-item ref="name" label="适用标准" name="genericStandard">
<a-input
@ -64,7 +60,6 @@
<a-form-item ref="name" label="报告范围" name="reportScope">
<a-range-picker
v-model:value="formState.reportScope"
:defaultPickerValue="defaultPickerValue"
picker="month"
:disabledDate="disabledDate"
valueFormat="YYYY-MM" />
@ -111,20 +106,22 @@
const selectChange = (value) => {
formState.value.reportScope = '';
};
const defaultPickerValue = ref([
dayjs('2020'), //
dayjs('2020'), //
]);
const openChange = (status) => {
if (status === false) {
if (formState.value.reportYear) {
defaultPickerValue.value = [
dayjs(formState.value.reportYear),
dayjs(formState.value.reportYear),
];
}
}
};
// const defaultPickerValue = ref([]);
// const open = ref(false);
// const openChange = (status) => {
// debugger;
// open.value = status;
// if (formState.value.reportYear) {
// defaultPickerValue.value = [
// dayjs(formState.value.reportYear),
// dayjs(formState.value.reportYear),
// ];
// open.value = false;
// nextTick(() => {
// open.value = status; //
// });
// }
// };
// form
const rules: Record<string, Rule[]> = {
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],

8
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue

@ -417,7 +417,6 @@
const editData = (record) => {
open.value = true;
if (record.isLastYear !== undefined) {
formState.value.ids = [record.id];
if (record.lastYear === '是') {
formState.value.isLastYear = 1;
disabled.value = false;
@ -425,10 +424,12 @@
formState.value.isLastYear = 0;
disabled.value = true;
}
}
formState.value.ids = [record.id];
formState.value.conversionRate = record.conversionRate;
formState.value.lastYearList = [record.lastYearActualUsage];
formState.value.ids = [record.id];
formState.value.budget = record.budget;
}
};
const disabled = ref(true);
const selectChange = (value) => {
@ -995,6 +996,9 @@
:deep(.ant-card-bordered) {
border: unset;
}
:deep(.ant-input-number-handler-wrap){
display: none;
}
</style>
<style scoped>
.editable-row-operations a {

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

@ -674,7 +674,7 @@
}
.contant {
width: 100%;
height: calc(94% - 5vh);
height: calc(94% - 5vh - 24px);
overflow-y: auto;
padding: 12px;
.chartsPart {

4
lib/util/xlsx-util.ts

@ -129,11 +129,13 @@ export const importFile = (
headers: { token: Cookies.get(`${import.meta.env.VITE_PUBLIC_PATH}-nervsid`) },
})
.then((res) => {
if (res) {
if (res.data.data) {
NsMessage.success('导入成功', 1, () => {
reload && reload();
successBack && successBack(res);
});
} else {
NsMessage.error(res.data.msg || '导入失败');
}
})
.catch((err) => {

Loading…
Cancel
Save