Browse Source

修改测试问题

temp
fks-xuxinyue 4 months ago
parent
commit
b396c37426
  1. 15
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts
  2. 28
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  3. 9
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

15
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts

@ -52,27 +52,27 @@ export const formConfig = (disabled) => {
options: [ options: [
{ {
label: 'CO2', label: 'CO2',
value: 'CO2', value: 1,
}, },
{ {
label: 'CO2e', label: 'CO2e',
value: 'CO2e', value: 2,
}, },
{ {
label: 'SF6', label: 'SF6',
value:'SF6', value: 3,
}, },
{ {
label: 'CH4', label: 'CH4',
value: 'CH4', value: 4,
}, },
{ {
label: 'PFCs', label: 'PFCs',
value: 'PFCs', value: 5,
}, },
{ {
label: 'HFCs', label: 'HFCs',
value: 'HFCs', value: 6,
}, },
], ],
}, },
@ -195,7 +195,8 @@ export const formConfig = (disabled) => {
component: 'NsTextarea', component: 'NsTextarea',
componentProps: { componentProps: {
placeholder: '请输入参考文献', placeholder: '请输入参考文献',
maxLength: 20, maxLength: 300,
showCount:true
}, },
}, },
], ],

28
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue

@ -50,7 +50,7 @@
<ns-icon name="actionMore" size="14" class="actionMore" /> <ns-icon name="actionMore" size="14" class="actionMore" />
<template #overlay> <template #overlay>
<a-menu> <a-menu>
<a-menu-item @click="editTreeNodeData">编辑</a-menu-item> <a-menu-item @click="editTreeNodeData(data)">编辑</a-menu-item>
<a-menu-item @click="addTreeNodeData">新增子节点</a-menu-item> <a-menu-item @click="addTreeNodeData">新增子节点</a-menu-item>
<a-menu-item>上移</a-menu-item> <a-menu-item>上移</a-menu-item>
<a-menu-item>下移</a-menu-item> <a-menu-item>下移</a-menu-item>
@ -67,7 +67,13 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 2000}"/> <ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 2000}">
<template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'emissionGas'">
{{ record.emissionGas.label }}
</template>
</template>
</ns-view-list-table>
</div> </div>
<!-- 新增树节点 --> <!-- 新增树节点 -->
<ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel"> <ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel">
@ -406,10 +412,11 @@
editTreeNode.value.type = 'create' editTreeNode.value.type = 'create'
}; };
// //
const editTreeNodeData = () => { const editTreeNodeData = (data) => {
operationTree.value='编辑' operationTree.value='编辑'
treeNodeAdd.value = true; treeNodeAdd.value = true;
editTreeNode.value.type = 'update' editTreeNode.value.type = 'update'
addTreeNode.value = data.emissionName
} }
// //
const deleteTreeNode = () => { const deleteTreeNode = () => {
@ -681,6 +688,9 @@
opMap.value.type = 'edit'; opMap.value.type = 'edit';
opMap.value.fuc = (formData: any) => { opMap.value.fuc = (formData: any) => {
formData.emissionType = formData.emissionType[formData.emissionType.length - 1] formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
if(formData.emissionGas.value){
formData.emissionGas = formData.emissionGas.value
}
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => { return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
visible.value = false; visible.value = false;
@ -738,27 +748,27 @@
options: [ options: [
{ {
label: 'CO2', label: 'CO2',
value: '1', value: 1,
}, },
{ {
label: 'CO2e', label: 'CO2e',
value: '2', value: 2,
}, },
{ {
label: 'SF6', label: 'SF6',
value:'3', value:3,
}, },
{ {
label: 'CH4', label: 'CH4',
value: '4', value: 4,
}, },
{ {
label: 'PFCs', label: 'PFCs',
value: '5', value: 5,
}, },
{ {
label: 'HFCs', label: 'HFCs',
value: '6', value: 6,
}, },
], ],
}, },

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

@ -27,7 +27,7 @@
</div> </div>
</template> </template>
</a-table> --> </a-table> -->
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1500}" /> <ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1500,y:350 }" />
<!-- <a-pagination <!-- <a-pagination
:current="queryParams.pageNum" :current="queryParams.pageNum"
:total="total" :total="total"
@ -220,7 +220,8 @@
// form // form
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }], energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }] isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }],
unit: [{ required: true, message: '请选择计量单位', trigger: 'change' }]
}; };
// //
const emissionTypeDic = ref() const emissionTypeDic = ref()
@ -363,6 +364,9 @@
getDictList() getDictList()
visible.value = true visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => { fetch(energyConsumption.findById , {id : record.id }).then((res) => {
if(res.data.emissionType){
res.data.emissionType = Number(res.data.emissionType)
}
if (res.data.unit) { if (res.data.unit) {
let selectDevice = ref([Number(res.data.unit)]); let selectDevice = ref([Number(res.data.unit)]);
findParentIds(measurementUnit.value, res.data.unit, selectDevice.value); findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
@ -438,6 +442,7 @@
.validate() .validate()
.then(() => { .then(() => {
console.log('values', formState, toRaw(formState)); console.log('values', formState, toRaw(formState));
formState.value.year = selectYear.value.format('YYYY')
if(formState.value.unit){ if(formState.value.unit){
formState.value.unit = formState.value.unit.join(',').split(',')[1] formState.value.unit = formState.value.unit.join(',').split(',')[1]
} }

Loading…
Cancel
Save