修改测试问题

This commit is contained in:
fks-xuxinyue
2024-08-22 15:27:55 +08:00
parent 0009360d9f
commit ca74de5b37
15 changed files with 559 additions and 287 deletions

View File

@@ -29,6 +29,7 @@ export const drawerColumns = [
{
title: '因子值',
dataIndex: 'emissionFactors',
key: 'emissionFactors',
},
{
title: '排放环节',

View File

@@ -27,7 +27,7 @@
</div>
</div>
</div>
<div style="display: flex; height: 100%">
<div style="display: flex; height: 90%">
<div class="left">
<div class="top">
<a-form style="width: 100%; margin: 0 auto">
@@ -57,6 +57,7 @@
:selectedKeys="selectedKeysL"
:auto-expand-parent="autoExpandParent"
:tree-data="gData"
:show-line="{ showLeafIcon: false }"
v-if="gData && gData.length > 0"
:height="233"
show-line
@@ -95,6 +96,7 @@
:expandedKeys="expandedKeysR"
:selectedKeys="selectedKeysR"
:checkedKeys="checkedKeys"
:show-line="{ showLeafIcon: false }"
:tree-data="treeData"
@select="onSelectR"
block-node>
@@ -106,16 +108,20 @@
<div class="actionMore">
<EditOutlined @click="editUnit(data)" />
<MinusCircleOutlined style="margin-left: 6px" @click="delUnit(data)" />
<PlusCircleOutlined
v-if="data.emissionSource === '全部'"
style="margin-left: 6px"
@click="addTreeNodeData" />
</div>
</div>
</template>
</a-tree>
<a-empty v-else />
<div class="addTreeNode">
<!-- <div class="addTreeNode">
<a-button type="primary" style="width: 100%" @click="addTreeNodeData">
新增
</a-button>
</div>
</div> -->
</div>
<div class="mainRight">
<a-table
@@ -125,7 +131,7 @@
:pagination="false"
bordered
size="middle"
:scroll="{ y: 500 }">
:scroll="{ y: 380 }">
<template #title>
<a-button type="primary" @click="downLoadVoucher">凭证</a-button>
</template>
@@ -162,7 +168,7 @@
<a-empty v-else />
</a-tab-pane>
<a-tab-pane key="3" tab="碳排流向">
<div v-if="showChart" ref="tplxChart" style="width: 100%; height: 68vh"></div>
<div v-if="showChart" ref="tplxChart" style="width: 100%; height: 100%"></div>
<a-empty v-else />
</a-tab-pane>
</a-tabs>
@@ -193,6 +199,7 @@
:selectedKeys="categorySelectedKeys"
:checkedKeys="categoryCheckedKeys"
:tree-data="categoryTreeData"
:show-line="{ showLeafIcon: false }"
v-if="categoryTreeData && categoryTreeData.length > 0"
class="draggable-tree"
@check="checkTreeNode"
@@ -230,7 +237,11 @@
:label-col="labelCol"
:wrapper-col="wrapperCol">
<a-form-item ref="name" label="排放源" name="emissionSource">
<a-input v-model:value="formState.emissionSource" placeholder="请输入排放源" />
<a-input
v-model:value="formState.emissionSource"
:maxlength="20"
@keydown="handleKeyDown"
placeholder="请输入排放源" />
</a-form-item>
<a-form-item ref="name" label="计量单位" name="unitId">
<a-cascader v-model:value="formState.unitId" :options="measurementUnit" />
@@ -317,7 +328,11 @@
</a-col>
<a-col :span="24">
<a-form-item ref="name" label="消耗量" name="consumption">
<ns-input v-model:value="editFormState.consumption" :disabled="canEdit" />
<ns-input
v-model:value="editFormState.consumption"
:maxlength="20"
@keydown="handleKeyDown"
:disabled="canEdit" />
</a-form-item>
</a-col>
</a-row>
@@ -351,7 +366,10 @@
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="因子值" name="emissionFactors">
<ns-input v-model:value="editFormState.emissionFactors" />
<ns-input
v-model:value="editFormState.emissionFactors"
:maxlength="20"
@keydown="handleKeyDown" />
</a-form-item>
</a-col>
<a-col :span="24">
@@ -381,6 +399,11 @@
type: 'radio',
}"
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'emissionFactors'">
<span>{{ record.emissionFactors + record.emissionFactorUnits }}</span>
</template>
</template>
</a-table>
<a-pagination
:current="queryData.pageNum"
@@ -603,9 +626,10 @@
fetch(carbonInventoryCheck.getInventoryTree, { categoryId: categoryId.value }).then((res) => {
treeData.value = res.data;
if (changeSelectedKeys.value) {
selectedKeysR.value = [`0-${treeData.value.length - 1}`];
selectedKeysR.value = [`0-0-${treeData.value[0].children.length - 1}`];
changeSelectedKeys.value = false;
getTableId.value = res.data[res.data.length - 1].id;
getTableId.value = res.data[0].children[res.data[0].children.length - 1].id;
bizId.value = res.data[0].children[res.data[0].children.length - 1].id;
if (res.data.length != 0) {
getPFYTableList(getTableId.value);
getTableHeardUnit(getTableId.value);
@@ -616,8 +640,9 @@
columns.value[3].title = '排放量';
}
} else {
selectedKeysR.value = ['0-0'];
getTableId.value = res.data[0].id;
selectedKeysR.value = ['0-0-0'];
getTableId.value = res.data[0].children[0].id;
bizId.value = res.data[0].children[0].id;
if (res.data.length != 0) {
getPFYTableList(getTableId.value);
getTableHeardUnit(getTableId.value);
@@ -634,6 +659,7 @@
const onSelectR = (selectedKey: string[], info: any) => {
selectedKeysR.value = selectedKey;
getTableId.value = info.selectedNodes[0].id;
bizId.value = info.selectedNodes[0].id;
getPFYTableList(getTableId.value);
getTableHeardUnit(getTableId.value);
};
@@ -647,8 +673,8 @@
}
});
};
const expandedKeysR = ref<string[]>([]);
const selectedKeysR = ref<string[]>(['0-0']);
const expandedKeysR = ref<string[]>(['0-0']);
const selectedKeysR = ref<string[]>(['0-0-0']);
const checkedKeys = ref<string[]>([]);
watch(expandedKeysR, () => {
console.log('expandedKeysR', expandedKeysR);
@@ -778,6 +804,12 @@
groupData.value = res.data;
});
};
const handleKeyDown = (event: KeyboardEvent) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
const onSubmit = () => {
formRef.value
.validate()
@@ -945,10 +977,13 @@
};
// 点击凭证弹出框
const openVoucher = ref(false);
const bizId = ref();
const downLoadVoucher = () => {
fetch(carbonInventoryCheck.voucherDownloadList, { bizType: 2 }).then((res) => {
voucherData.value = res.data;
});
fetch(carbonInventoryCheck.voucherDownloadList, { bizType: 2, bizId: bizId.value }).then(
(res) => {
voucherData.value = res.data;
},
);
openVoucher.value = true;
};
const selectedRowKeys = ref([]);
@@ -1061,6 +1096,7 @@
canEdit.value = true;
automatic.value = true;
} else {
canEdit.value = false;
automatic.value = false;
}
};
@@ -1220,6 +1256,8 @@
reportId: props.reportId,
year: props.year,
categoryId: categoryId.value,
startTime: props.startTime,
endTime: props.endTime,
});
const linksData = ref([]);
const datalist = ref([]);
@@ -1243,6 +1281,8 @@
reportId: props.reportId,
year: props.year,
categoryId: categoryId.value,
startTime: props.startTime,
endTime: props.endTime,
});
const tableHeader = ref([]);
const getEmissionStatistic = () => {
@@ -1556,7 +1596,7 @@
width: 300px;
margin-right: @ns-gap;
min-width: fit-content;
height: 93%;
height: 100%;
border-radius: 8px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
@@ -1645,7 +1685,7 @@
.right {
flex: 1;
min-width: 0;
height: 93%;
height: 100%;
border-radius: 8px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);

View File

@@ -20,7 +20,9 @@
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<div class="ns-form-title"><div class="title">{{text}}</div></div>
<div class="ns-form-title"
><div class="title">{{ text }}</div></div
>
<a-form
ref="formRef"
:model="formState"
@@ -28,13 +30,21 @@
:label-col="labelCol"
:wrapper-col="wrapperCol">
<a-form-item ref="name" label="报告名称" name="reportName">
<a-input v-model:value="formState.reportName" placeholder="请输入报告名称" />
<a-input
v-model:value="formState.reportName"
:maxlength="15"
@keydown="handleKeyDown"
placeholder="请输入报告名称" />
</a-form-item>
<a-form-item ref="name" label="报告年度" name="reportYear">
<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 v-model:value="formState.genericStandard" placeholder="请输入适用标准" />
<a-input
v-model:value="formState.genericStandard"
:maxlength="20"
@keydown="handleKeyDown"
placeholder="请输入适用标准" />
</a-form-item>
<a-form-item label="报告周期" name="reportPeriod">
<a-select
@@ -81,7 +91,7 @@
const formRef = ref();
const labelCol = { span: 4 };
const wrapperCol = { span: 20 };
const text = ref('新增报告')
const text = ref('新增报告');
const disabledDate = (current: moment.Moment | null) => {
if (formState.value.reportPeriod === '2') {
const year = current.year();
@@ -105,6 +115,12 @@
formState.value = {};
formRef.value.resetFields();
};
const handleKeyDown = (event: KeyboardEvent) => {
// Check if the pressed key is a space
if (event.code === 'Space') {
event.preventDefault();
}
};
// 点击确定提交
const onSubmit = () => {
formRef.value
@@ -142,7 +158,7 @@
name: 'userAdd',
type: 'primary',
handle: () => {
text.value = '新增报告'
text.value = '新增报告';
visible.value = true;
},
},
@@ -186,7 +202,7 @@
label: '编辑',
name: 'userEdit',
handle: (record: any) => {
text.value = '编辑报告'
text.value = '编辑报告';
visible.value = true;
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
formState.value = res.data;
@@ -252,7 +268,7 @@
component: 'NsInput',
componentProps: {
placeholder: '请输入报告名称',
maxLength: 30,
maxLength: 20,
},
},
{