taskid:067 remark:commit
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
export enum carbonEmissionFactorLibrary {
|
export enum carbonEmissionFactorLibrary {
|
||||||
getTableList = '/carbon-smart/api/carbon/emission/factor/queryCarbonFactorPage',
|
getTableList = '/carbon-smart/api/carbon/emission/factor/queryCarbonFactorPage',
|
||||||
addNewData = '/carbon-smart/api/carbon/emission/factor/creatOrUpdate',
|
creatOrUpdate = '/carbon-smart/api/carbon/emission/factor/creatOrUpdate',
|
||||||
editUser = '/carbon-smart/api/user/edit',
|
del = '/carbon-smart/api/carbon/emission/factor/del',
|
||||||
frozen = '/carbon-smart/api/user/frozen',
|
getEmissionProcess = '/carbon-smart/api/carbon/emission/factor/getEmissionProcess',
|
||||||
resetPwd = '/carbon-smart/api/user/resetPwd',
|
findById = '/carbon-smart/api/carbon/emission/factor/findById',
|
||||||
del = '/carbon-smart/api/user/del',
|
|
||||||
batchDel = '/carbon-smart/api/user/batchDel',
|
|
||||||
getCarbonFactorTree = '/carbon-smart/api/carbon/emission/type/getCarbonFactorTree',
|
getCarbonFactorTree = '/carbon-smart/api/carbon/emission/type/getCarbonFactorTree',
|
||||||
queryDeptTree = '/carbon-smart/api/user/queryDeptTree',
|
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
|
||||||
queryUserPerList = '/carbon-smart/api/user/queryUserPerList',
|
delTreeNode = '/carbon-smart/api/carbon/emission/type/del',
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14.5244140625" height="14.5294189453125" viewBox="0 0 14.5244140625 14.5294189453125" fill="none">
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14.5244140625" height="14.5294189453125" viewBox="0 0 14.5244140625 14.5294189453125" fill="none">
|
||||||
<path d="M6.61912 12.2301C6.6032 12.5346 6.44482 12.8138 6.19166 12.9837L3.73703 14.4259C3.46877 14.5639 3.15036 14.5639 2.8821 14.4259L0.427467 12.9837C0.174295 12.8138 0.0159187 12.5346 0 12.2301L0 9.34584C0.0162582 9.04147 0.174555 8.76241 0.427467 8.59227L2.88209 7.15012C3.15031 7.01189 3.46881 7.01189 3.73703 7.15012L6.19165 8.59337C6.44482 8.76326 6.6032 9.04247 6.61912 9.34694L6.61912 12.2301ZM14.5239 12.2301C14.508 12.5346 14.3497 12.8138 14.0965 12.9837L11.6419 14.4259C11.3736 14.5639 11.0552 14.5639 10.7869 14.4259L8.33231 12.9837C8.079 12.814 7.92058 12.5347 7.90484 12.2301L7.90484 9.34584C7.92075 9.04137 8.07913 8.76217 8.33231 8.59227L10.7869 7.14902C11.0551 7.01079 11.3736 7.01079 11.6419 7.14902L14.0965 8.59117C14.3495 8.76118 14.5079 9.04031 14.524 9.34475L14.5239 12.2301ZM10.5842 5.18465C10.5683 5.48912 10.4099 5.76833 10.1567 5.93822L7.70211 7.38147C7.43394 7.51988 7.11535 7.51988 6.84718 7.38147L4.39256 5.93822C4.13938 5.76833 3.981 5.48912 3.96508 5.18465L3.96508 2.30036C3.98117 1.99594 4.13951 1.7168 4.39256 1.54678L6.84718 0.103527C7.11544 -0.0345116 7.43386 -0.0345116 7.70212 0.103527L10.1567 1.54568C10.41 1.71546 10.5685 1.99473 10.5842 2.29926L10.5842 5.18465Z" fill="#8D96A3" >
|
<path d="M6.61912 12.2301C6.6032 12.5346 6.44482 12.8138 6.19166 12.9837L3.73703 14.4259C3.46877 14.5639 3.15036 14.5639 2.8821 14.4259L0.427467 12.9837C0.174295 12.8138 0.0159187 12.5346 0 12.2301L0 9.34584C0.0162582 9.04147 0.174555 8.76241 0.427467 8.59227L2.88209 7.15012C3.15031 7.01189 3.46881 7.01189 3.73703 7.15012L6.19165 8.59337C6.44482 8.76326 6.6032 9.04247 6.61912 9.34694L6.61912 12.2301ZM14.5239 12.2301C14.508 12.5346 14.3497 12.8138 14.0965 12.9837L11.6419 14.4259C11.3736 14.5639 11.0552 14.5639 10.7869 14.4259L8.33231 12.9837C8.079 12.814 7.92058 12.5347 7.90484 12.2301L7.90484 9.34584C7.92075 9.04137 8.07913 8.76217 8.33231 8.59227L10.7869 7.14902C11.0551 7.01079 11.3736 7.01079 11.6419 7.14902L14.0965 8.59117C14.3495 8.76118 14.5079 9.04031 14.524 9.34475L14.5239 12.2301ZM10.5842 5.18465C10.5683 5.48912 10.4099 5.76833 10.1567 5.93822L7.70211 7.38147C7.43394 7.51988 7.11535 7.51988 6.84718 7.38147L4.39256 5.93822C4.13938 5.76833 3.981 5.48912 3.96508 5.18465L3.96508 2.30036C3.98117 1.99594 4.13951 1.7168 4.39256 1.54678L6.84718 0.103527C7.11544 -0.0345116 7.43386 -0.0345116 7.70212 0.103527L10.1567 1.54568C10.41 1.71546 10.5685 1.99473 10.5842 2.29926L10.5842 5.18465Z" fill="currentColor" >
|
||||||
</path>
|
</path>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -1,21 +1,21 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { http } from '/nerv-lib/util';
|
import { http } from '/nerv-lib/util';
|
||||||
import { origanizemanage } from '/@/api/origanizemanage';
|
import { origanizemanage } from '/@/api/origanizemanage';
|
||||||
|
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
|
||||||
export const formConfig = (disabled) => {
|
export const formConfig = (disabled) => {
|
||||||
return ref([
|
return ref([
|
||||||
{
|
{
|
||||||
field: 'field111',
|
field: 'fields',
|
||||||
component: 'NsChildForm',
|
component: 'NsChildForm',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
label: '排放源',
|
label: '排放源',
|
||||||
field: 'accountNo',
|
field: 'emissionSources',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入排放源',
|
placeholder: '请输入排放源',
|
||||||
maxLength: 20,
|
maxLength: 20,
|
||||||
disabled,
|
|
||||||
},
|
},
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,25 @@ export const formConfig = (disabled) => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userStatus',
|
field: 'emissionType',
|
||||||
|
label: '排放分类',
|
||||||
|
component: 'NsCascader',
|
||||||
|
fieldMap: ['emissionType'],
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择排放分类',
|
||||||
|
api: carbonEmissionFactorLibrary.getCarbonFactorTree,
|
||||||
|
fieldNames: { label: 'emissionName', value: 'id' },
|
||||||
|
showSearch: true,
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择排放分类',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'emissionGas',
|
||||||
label: '排放气体',
|
label: '排放气体',
|
||||||
component: 'NsSelect',
|
component: 'NsSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -33,12 +51,28 @@ export const formConfig = (disabled) => {
|
|||||||
placeholder: '请选择排放气体',
|
placeholder: '请选择排放气体',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: 'CO2',
|
||||||
value: 0,
|
value: 'CO2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '冻结',
|
label: 'CO2e',
|
||||||
value: 1,
|
value: 'CO2e',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'SF6',
|
||||||
|
value:'SF6',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'CH4',
|
||||||
|
value: 'CH4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'PFCs',
|
||||||
|
value: 'PFCs',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'HFCs',
|
||||||
|
value: 'HFCs',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -50,55 +84,61 @@ export const formConfig = (disabled) => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userStatus',
|
field: 'emissionProcess',
|
||||||
label: '排放环节',
|
label: '排放环节',
|
||||||
component: 'NsSelect',
|
component: 'NsSelectApi',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
api: carbonEmissionFactorLibrary.getEmissionProcess,
|
||||||
placeholder: '请选择排放环节',
|
params: {
|
||||||
options: [
|
emissionType: sessionStorage.getItem('checkedTreeNode'),
|
||||||
{
|
},
|
||||||
label: '正常',
|
resultField: 'data',
|
||||||
value: 0,
|
labelField: 'emissionProcess',
|
||||||
},
|
valueField: 'emissionProcess',
|
||||||
{
|
immediate: true,
|
||||||
label: '冻结',
|
autoSelectFirst: false,
|
||||||
value: 1,
|
filterOption:false,
|
||||||
},
|
showSearch:true,
|
||||||
],
|
autoClearSearchValue:false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '排放因子',
|
label: '排放因子',
|
||||||
field: 'accountNo',
|
field: 'emissionFactors',
|
||||||
component: 'NsInput',
|
component: 'NsInputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入排放因子值',
|
placeholder: '请输入排放因子值',
|
||||||
maxLength: 20,
|
maxLength: 20,
|
||||||
disabled,
|
|
||||||
},
|
},
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入排放因子值',
|
message: '请输入排放因子值',
|
||||||
|
trigger: 'change',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userStatus',
|
field: 'carbonEmissionPrefix',
|
||||||
label: '碳排前缀',
|
label: '碳排前缀',
|
||||||
component: 'NsSelect',
|
component: 'NsSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
|
defaultValue: 't',
|
||||||
placeholder: '请选择碳排前缀',
|
placeholder: '请选择碳排前缀',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: 'g',
|
||||||
value: 0,
|
value: 'g',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '冻结',
|
label: 'kg',
|
||||||
value: 1,
|
value: 'kg',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 't',
|
||||||
|
value: 't',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -111,12 +151,11 @@ export const formConfig = (disabled) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '碳排后缀',
|
label: '碳排后缀',
|
||||||
field: 'accountNo',
|
field: 'carbonEmissionSuffix',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入碳排后缀',
|
placeholder: '请输入碳排后缀',
|
||||||
maxLength: 20,
|
maxLength: 20,
|
||||||
disabled,
|
|
||||||
},
|
},
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
@@ -127,21 +166,21 @@ export const formConfig = (disabled) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '已引用数',
|
label: '已引用数',
|
||||||
field: 'accountNo',
|
field: 'numberOfReferences',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
defaultValue: 10,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
maxLength: 20,
|
maxLength: 20,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '参考文献',
|
label: '参考文献',
|
||||||
field: 'accountNo',
|
field: 'reference',
|
||||||
component: 'NsTextarea',
|
component: 'NsTextarea',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入参考文献',
|
placeholder: '请输入参考文献',
|
||||||
maxLength: 20,
|
maxLength: 20,
|
||||||
disabled,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</a-form>
|
</a-form>
|
||||||
<a-tree
|
<a-tree
|
||||||
|
v-if="gData && gData.length > 0"
|
||||||
class="draggable-tree"
|
class="draggable-tree"
|
||||||
style="padding: 0 16px !important;"
|
style="padding: 0 16px !important;"
|
||||||
draggable
|
draggable
|
||||||
@@ -26,12 +27,15 @@
|
|||||||
checkable
|
checkable
|
||||||
block-node
|
block-node
|
||||||
:tree-data="gData"
|
:tree-data="gData"
|
||||||
|
:checkedKeys="checkedTreeNodeKeys"
|
||||||
|
:selectedKeys="selectedKeys"
|
||||||
@dragenter="onDragEnter"
|
@dragenter="onDragEnter"
|
||||||
@drop="onDrop"
|
@drop="onDrop"
|
||||||
|
@check="checkTreeNode"
|
||||||
|
@select="onSelect"
|
||||||
:expanded-keys="expandedKeys"
|
:expanded-keys="expandedKeys"
|
||||||
:auto-expand-parent="autoExpandParent"
|
:auto-expand-parent="autoExpandParent"
|
||||||
@expand="onExpand"
|
@expand="onExpand">
|
||||||
>
|
|
||||||
<template #title="{ emissionName }">
|
<template #title="{ emissionName }">
|
||||||
<span v-if="emissionName && selectTreeDataValue && emissionName.indexOf(selectTreeDataValue) > -1">
|
<span v-if="emissionName && selectTreeDataValue && emissionName.indexOf(selectTreeDataValue) > -1">
|
||||||
{{ emissionName.substring(0, emissionName.indexOf(selectTreeDataValue)) }}
|
{{ emissionName.substring(0, emissionName.indexOf(selectTreeDataValue)) }}
|
||||||
@@ -41,12 +45,14 @@
|
|||||||
<span v-else>{{ emissionName }}</span>
|
<span v-else>{{ emissionName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
<a-popover placement="rightTop" trigger="focus">
|
<a-popover v-if="showOperation" placement="rightTop" trigger="focus">
|
||||||
<template #content>
|
<template #content>
|
||||||
<div style="display: flex;flex-direction: column;">
|
<div style="display: flex;flex-direction: column;">
|
||||||
<a-button type="text">编辑</a-button>
|
<a-button type="text" @click="editTreeNodeData">编辑</a-button>
|
||||||
<a-button type="text">新增子节点</a-button>
|
<a-button type="text" @click="addTreeNodeData">新增子节点</a-button>
|
||||||
<a-button type="text">删除</a-button>
|
<a-button type="text">上移</a-button>
|
||||||
|
<a-button type="text">下移</a-button>
|
||||||
|
<a-button type="text" @click="deleteTreeNode">删除</a-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<MoreOutlined style="position: absolute;right: 0;top: 16%;font-size: 25px;cursor: pointer;" />
|
<MoreOutlined style="position: absolute;right: 0;top: 16%;font-size: 25px;cursor: pointer;" />
|
||||||
@@ -62,10 +68,9 @@
|
|||||||
<!-- 新增树节点 -->
|
<!-- 新增树节点 -->
|
||||||
<ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel">
|
<ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel">
|
||||||
<ns-input
|
<ns-input
|
||||||
v-model:value="latitude1"
|
v-model:value="addTreeNode"
|
||||||
class="input"
|
class="input"
|
||||||
placeholder="请输入排放类型"
|
placeholder="请输入排放类型"/>
|
||||||
/>
|
|
||||||
</ns-modal>
|
</ns-modal>
|
||||||
<!-- 新增数据库数据 -->
|
<!-- 新增数据库数据 -->
|
||||||
<a-drawer
|
<a-drawer
|
||||||
@@ -90,7 +95,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { MoreOutlined } from '@ant-design/icons-vue';
|
import { MoreOutlined,ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch } from 'vue';
|
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch } from 'vue';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||||
@@ -115,6 +121,7 @@ import { log } from 'node:console';
|
|||||||
const disabled = ref(false);
|
const disabled = ref(false);
|
||||||
const treeNodeAdd = ref<boolean>(false);
|
const treeNodeAdd = ref<boolean>(false);
|
||||||
const operationTree = ref<string>('新增');
|
const operationTree = ref<string>('新增');
|
||||||
|
const showOperation = ref(false)
|
||||||
|
|
||||||
const opMap: any = ref({
|
const opMap: any = ref({
|
||||||
type: 'add',
|
type: 'add',
|
||||||
@@ -141,6 +148,7 @@ import { log } from 'node:console';
|
|||||||
const y = 2;
|
const y = 2;
|
||||||
const z = 1;
|
const z = 1;
|
||||||
const genData: TreeProps['treeData'] = [];
|
const genData: TreeProps['treeData'] = [];
|
||||||
|
const checkedTreeNodeKeys = ref<string[]>(['0-0']);
|
||||||
|
|
||||||
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
|
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
|
||||||
const preKey = _preKey || '0';
|
const preKey = _preKey || '0';
|
||||||
@@ -265,7 +273,6 @@ import { log } from 'node:console';
|
|||||||
expandedKeys.value = keys;
|
expandedKeys.value = keys;
|
||||||
autoExpandParent.value = false;
|
autoExpandParent.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(selectTreeDataValue, value => {
|
watch(selectTreeDataValue, value => {
|
||||||
const expanded = dataList
|
const expanded = dataList
|
||||||
.map((item: TreeProps['treeData'][number]) => {
|
.map((item: TreeProps['treeData'][number]) => {
|
||||||
@@ -284,24 +291,107 @@ import { log } from 'node:console';
|
|||||||
console.log('use value', selectTreeDataValue);
|
console.log('use value', selectTreeDataValue);
|
||||||
console.log('or use this.value', value.value);
|
console.log('or use this.value', value.value);
|
||||||
};
|
};
|
||||||
|
// 点击数据点的复选框
|
||||||
|
const checkedIds = ref([])
|
||||||
|
const emissionType = ref()
|
||||||
|
const checkTreeNode = (checkedKeys, info) => {
|
||||||
|
checkedTreeNodeKeys.value = checkedKeys
|
||||||
|
checkedIds.value = []
|
||||||
|
info.checkedNodes.forEach(item=>{
|
||||||
|
checkedIds.value.push(item.id)
|
||||||
|
})
|
||||||
|
sessionStorage.setItem('checkedTreeNode', checkedIds.value);
|
||||||
|
emissionType.value = checkedIds.value.join(',')
|
||||||
|
mainRef.value?.nsTableRef.reload();
|
||||||
|
}
|
||||||
// 点击新增树节点
|
// 点击新增树节点
|
||||||
const addTreeNodeData = () => {
|
const addTreeNodeData = () => {
|
||||||
treeNodeAdd.value = true;
|
treeNodeAdd.value = true;
|
||||||
|
editTreeNode.value.type = 'create'
|
||||||
};
|
};
|
||||||
|
// 编辑树节点
|
||||||
|
const editTreeNodeData = () => {
|
||||||
|
operationTree.value='编辑'
|
||||||
|
treeNodeAdd.value = true;
|
||||||
|
editTreeNode.value.type = 'update'
|
||||||
|
}
|
||||||
|
// 删除树节点
|
||||||
|
const deleteTreeNode = () => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '警告',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '确定要删除么?',
|
||||||
|
okText: '确认',
|
||||||
|
okType: 'primary',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
http.post(carbonEmissionFactorLibrary.delTreeNode,editTreeNode.value).then(() => {
|
||||||
|
getOrgTree()
|
||||||
|
NsMessage.success('操作成功');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
console.log('Cancel');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 新增/编辑树节点点击确定
|
||||||
|
const addTreeNode =ref()
|
||||||
const handleOk = (e: MouseEvent) => {
|
const handleOk = (e: MouseEvent) => {
|
||||||
console.log(e);
|
editTreeNode.value.emissionName = addTreeNode.value
|
||||||
treeNodeAdd.value = false;
|
http.post(carbonEmissionFactorLibrary.creat,editTreeNode.value).then(() => {
|
||||||
};
|
getOrgTree()
|
||||||
const handleCancel = () => {
|
NsMessage.success('操作成功');
|
||||||
treeNodeAdd.value = false;
|
addTreeNode.value = ''
|
||||||
};
|
treeNodeAdd.value = false;
|
||||||
// 企业树
|
|
||||||
const getOrgTree = (params?) => {
|
|
||||||
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
|
|
||||||
gData.value = res
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const handleCancel = () => {
|
||||||
|
addTreeNode.value = ''
|
||||||
|
treeNodeAdd.value = false;
|
||||||
|
};
|
||||||
|
// 获取排放分类树
|
||||||
|
const getOrgTree = (params?) => {
|
||||||
|
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
|
||||||
|
gData.value = res.data
|
||||||
|
// 找到匹配的节点数据
|
||||||
|
const selectedNodes = [];
|
||||||
|
checkedTreeNodeKeys.value.forEach(key => {
|
||||||
|
const [parentId, childId] = key.split('-').map(Number);
|
||||||
|
if (parentId >= 0 && childId >= 0 && gData.value[parentId]?.children?.[childId]) {
|
||||||
|
selectedNodes.push(gData.value[parentId]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 获取默认选中节点的所有id
|
||||||
|
getDefaultIds(selectedNodes)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const defaultIds = ref([])
|
||||||
|
const getDefaultIds = (selectedNodes) => {
|
||||||
|
selectedNodes.forEach(items => {
|
||||||
|
defaultIds.value.push(items.id)
|
||||||
|
if(items.children){
|
||||||
|
getDefaultIds(items.children)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
emissionType.value = defaultIds.value.join(',')
|
||||||
|
checkedIds.value = defaultIds.value
|
||||||
|
sessionStorage.setItem('checkedTreeNode', checkedIds.value);
|
||||||
|
}
|
||||||
getOrgTree();
|
getOrgTree();
|
||||||
|
// 被选中的树节点
|
||||||
|
const editTreeNode = ref({})
|
||||||
|
const onSelect = (selectedKeys: string[], info: any) => {
|
||||||
|
if(info.selected){
|
||||||
|
showOperation.value = true
|
||||||
|
editTreeNode.value = {
|
||||||
|
id:info.selectedNodes[0].id,
|
||||||
|
level:info.selectedNodes[0].level,
|
||||||
|
dataNumber:info.selectedNodes[0].dataNumber,
|
||||||
|
sortNumber:info.selectedNodes[0].sortNumber,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onSearch = () => {
|
const onSearch = () => {
|
||||||
console.log(searchValue.value);
|
console.log(searchValue.value);
|
||||||
@@ -338,21 +428,21 @@ import { log } from 'node:console';
|
|||||||
const onEdit = () => {
|
const onEdit = () => {
|
||||||
formRef.value?.triggerSubmit().then(() => {
|
formRef.value?.triggerSubmit().then(() => {
|
||||||
console.log(formData.value, 'formData.value');
|
console.log(formData.value, 'formData.value');
|
||||||
if (!userAuthList.value.length) {
|
// if (!userAuthList.value.length) {
|
||||||
NsMessage.error('请添加用户权限');
|
// NsMessage.error('请添加用户权限');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
opMap.value.fuc &&
|
opMap.value.fuc &&
|
||||||
opMap.value.fuc({ ...formData.value, userRoleList: userAuthList.value, orgId });
|
opMap.value.fuc({ ...formData.value });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableConfig = ref({
|
const tableConfig = ref({
|
||||||
title: '数据库',
|
title: '数据库',
|
||||||
api: carbonEmissionFactorLibrary.getTableList,
|
api: carbonEmissionFactorLibrary.getTableList,
|
||||||
params: {
|
params: {
|
||||||
orgId,
|
orgId,
|
||||||
|
emissionType
|
||||||
},
|
},
|
||||||
headerActions: [
|
headerActions: [
|
||||||
{
|
{
|
||||||
@@ -363,12 +453,14 @@ import { log } from 'node:console';
|
|||||||
opMap.value.type = 'add';
|
opMap.value.type = 'add';
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
// orgName: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
|
carbonEmissionPrefix:'t',
|
||||||
|
numberOfReferences:'10'
|
||||||
};
|
};
|
||||||
userAuthList.value.splice(0);
|
userAuthList.value.splice(0);
|
||||||
});
|
});
|
||||||
opMap.value.fuc = (formData: any) => {
|
opMap.value.fuc = (formData: any) => {
|
||||||
return http.post(carbonEmissionFactorLibrary.addNewData, formData).then(() => {
|
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
|
||||||
|
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
|
||||||
mainRef.value?.nsTableRef.reload();
|
mainRef.value?.nsTableRef.reload();
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
NsMessage.success('操作成功');
|
NsMessage.success('操作成功');
|
||||||
@@ -398,14 +490,13 @@ import { log } from 'node:console';
|
|||||||
confirm: true,
|
confirm: true,
|
||||||
isReload: true,
|
isReload: true,
|
||||||
isClearCheck: true,
|
isClearCheck: true,
|
||||||
api: carbonEmissionFactorLibrary.batchDel,
|
api: carbonEmissionFactorLibrary.del,
|
||||||
dynamicParams: { userIds: 'userId[]' },
|
dynamicParams: { id: 'id[]' },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: 'id',
|
title: 'id',
|
||||||
dataIndex: 'address',
|
|
||||||
customRender: (text: any) => {
|
customRender: (text: any) => {
|
||||||
return text.index + 1;
|
return text.index + 1;
|
||||||
},
|
},
|
||||||
@@ -416,7 +507,7 @@ import { log } from 'node:console';
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '排放类型',
|
title: '排放类型',
|
||||||
dataIndex: 'emissionType',
|
dataIndex: 'emissionTypeColumn',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '排放气体',
|
title: '排放气体',
|
||||||
@@ -460,12 +551,15 @@ import { log } from 'node:console';
|
|||||||
handle: (record: any) => {
|
handle: (record: any) => {
|
||||||
userAuthList.value.splice(0);
|
userAuthList.value.splice(0);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
formData.value = record;
|
console.log(record.id);
|
||||||
userAuthList.value.push(...record.userRoleInfos);
|
|
||||||
|
http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
|
||||||
|
formData.value = res.data;
|
||||||
|
});
|
||||||
}, 10);
|
}, 10);
|
||||||
opMap.value.type = 'edit';
|
opMap.value.type = 'edit';
|
||||||
opMap.value.fuc = (formData: any) => {
|
opMap.value.fuc = (formData: any) => {
|
||||||
return http.post(carbonEmissionFactorLibrary.editUser, formData).then(() => {
|
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
|
||||||
mainRef.value?.nsTableRef.reload();
|
mainRef.value?.nsTableRef.reload();
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
NsMessage.success('操作成功');
|
NsMessage.success('操作成功');
|
||||||
@@ -477,7 +571,7 @@ import { log } from 'node:console';
|
|||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
name: 'userDelete',
|
name: 'userDelete',
|
||||||
dynamicParams: 'userId',
|
dynamicParams: 'id',
|
||||||
confirm: true,
|
confirm: true,
|
||||||
isReload: true,
|
isReload: true,
|
||||||
api: carbonEmissionFactorLibrary.del,
|
api: carbonEmissionFactorLibrary.del,
|
||||||
@@ -497,7 +591,7 @@ import { log } from 'node:console';
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userStatus',
|
field: 'emissionProcess',
|
||||||
label: '排放环节',
|
label: '排放环节',
|
||||||
component: 'NsSelect',
|
component: 'NsSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -505,18 +599,14 @@ import { log } from 'node:console';
|
|||||||
placeholder: '请选择排放环节',
|
placeholder: '请选择排放环节',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: '消费环节',
|
||||||
value: 0,
|
value: 0,
|
||||||
},
|
}
|
||||||
{
|
|
||||||
label: '冻结',
|
|
||||||
value: 1,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userStatus',
|
field: 'emissionGas',
|
||||||
label: '排放气体',
|
label: '排放气体',
|
||||||
component: 'NsSelect',
|
component: 'NsSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -524,37 +614,38 @@ import { log } from 'node:console';
|
|||||||
placeholder: '请选择排放气体',
|
placeholder: '请选择排放气体',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: 'CO2',
|
||||||
value: 0,
|
value: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '冻结',
|
label: 'CO2e',
|
||||||
value: 1,
|
value: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userStatus',
|
field: 'carbonDatabase',
|
||||||
label: '数据库名称',
|
label: '数据库名称',
|
||||||
component: 'NsSelect',
|
component: 'NsSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: '请选择数据库名称',
|
placeholder: '请选择数据库名称',
|
||||||
|
showSearch: true,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: '正常',
|
||||||
value: 0,
|
value: '正常',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '冻结',
|
label: '冻结',
|
||||||
value: 1,
|
value: '冻结',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'accountNo',
|
field: 'reference',
|
||||||
label: '文献关键字',
|
label: '文献关键字',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -566,7 +657,7 @@ import { log } from 'node:console';
|
|||||||
params: {},
|
params: {},
|
||||||
},
|
},
|
||||||
// pagination: { defaultPageSize: 10 },
|
// pagination: { defaultPageSize: 10 },
|
||||||
rowKey: 'userId',
|
rowKey: 'id',
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
@@ -11,15 +11,21 @@ export const tableConfig = {
|
|||||||
rowSelection: null,
|
rowSelection: null,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: '设备名称',
|
title: '序号',
|
||||||
|
customRender: (text: any) => {
|
||||||
|
return text.index + 1;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '能源种类',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备型号',
|
title: '计量单位',
|
||||||
dataIndex: 'deviceCode',
|
dataIndex: 'deviceCode',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'SN码',
|
title: '全年',
|
||||||
dataIndex: 'deviceName',
|
dataIndex: 'deviceName',
|
||||||
textNumber: 8,
|
textNumber: 8,
|
||||||
textEllipsis: true,
|
textEllipsis: true,
|
||||||
|
Reference in New Issue
Block a user