优化页面,修改测试问题

This commit is contained in:
fks-xuxinyue
2024-08-16 15:25:26 +08:00
parent 73b6246203
commit 08acefd9f5
9 changed files with 173 additions and 148 deletions

View File

@@ -279,6 +279,21 @@
</a-col>
</a-row>
<a-row v-if="automatic">
<a-col :span="24">
<a-form-item label="能耗类型">
<a-select
v-model:value="editFormState.energyConsumptionType"
@change="changeEnergyType"
placeholder="请选择能耗类型">
<a-select-option
v-for="(item, index) in energyTypeOptions"
:key="index"
:value="item.dicKey">
{{ item.cnValue }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="采集节点" name="collectionNode">
<a-tree-select
@@ -374,6 +389,7 @@
} from '/@/api/carbonEmissionFactorLibrary';
import { group } from '/@/api/deviceManage';
import { debug, log } from 'node:console';
import { dict } from '/@/api';
defineOptions({
energyType: 'fillInPage', // 与页面路由name一致缓存才可生效
components: {
@@ -927,9 +943,13 @@
pageNum: 1,
pageSize: 5,
});
const edit = (record) => {
getDictList();
// queryData.value.emissionSources = record.emissionFactors;
const energyTypeOptions = ref([]);
const acquisitionDate = ref();
const edit = async (record) => {
acquisitionDate.value = record.acquisitionDate;
// 获取能耗类型
const options = await dict({ params: { dicKey: 'ENERGY_TYPE' } });
energyTypeOptions.value = options.data.data;
getNewTable();
editFormState.value.id = record.id;
editFormState.value.dataSources = record.dataSources;
@@ -971,23 +991,34 @@
};
// 定义采集节点数的变量
const collectingNodes = ref<TreeSelectProps['treeData']>([]);
const getDictList = () => {
const getTypeConsume = ref();
const changeEnergyType = (value) => {
getTypeConsume.value = value;
// 获取自动采集节点的数据
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE', orgId: orgId.value }).then(
(res) => {
collectingNodes.value = res.data;
collectingNodes.value = collectingNodes.value.map((item) => ({
value: item.id,
label: item.pointName,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.pointName,
}))
: [],
}));
},
);
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
collectingNodes.value = res.data;
collectingNodes.value = collectingNodes.value.map((item) => ({
value: item.id,
label: item.pointName,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.pointName,
}))
: [],
}));
});
};
const selectNode = (value) => {
const getConsumeData = ref({
acquisitionDate: acquisitionDate.value,
collectionNode: value,
orgId: orgId.value,
energyConsumptionType: getTypeConsume.value,
});
fetch(carbonInventoryCheck.nodeCancellationConsumption, getConsumeData.value).then((res) => {
editFormState.value.consumption = res.data;
});
};
// 上传附件
const fileList = ref<UploadProps['fileList']>([]);
@@ -1006,9 +1037,9 @@
const handleChange = (info: UploadChangeParam) => {
// fileList.value = [...info.fileList];
const { fileList: newFileList } = info;
delIds.value.push(info.fileList[0].uid);
// 删除fileList中的第一条数据
if (newFileList.length > 1) {
delIds.value.push(info.fileList[0].uid);
newFileList.shift(); // 删除第一条数据
}

View File

@@ -109,7 +109,7 @@
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
formState.value.enterpriseOrgId = orgId.value;
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) => {