|
@ -4,16 +4,15 @@ |
|
|
<div class="main"> |
|
|
<div class="main"> |
|
|
<div class="left"> |
|
|
<div class="left"> |
|
|
<div class="top"> |
|
|
<div class="top"> |
|
|
<a-form style="width: 100%;margin: 0 auto;"> |
|
|
<a-form style="width: 100%; margin: 0 auto"> |
|
|
<div class="ns-form-title"><div class="title">排放分类</div></div> |
|
|
<div class="ns-form-title"><div class="title">排放分类</div></div> |
|
|
<div style="padding: 0 16px !important;width: 100%;"> |
|
|
<div style="padding: 0 16px !important; width: 100%"> |
|
|
<a-row> |
|
|
<a-row> |
|
|
<a-col :span="24" style="margin-bottom: 16px;"> |
|
|
<a-col :span="24" style="margin-bottom: 16px"> |
|
|
<a-input-search |
|
|
<a-input-search |
|
|
v-model:value="selectTreeDataValue" |
|
|
v-model:value="selectTreeDataValue" |
|
|
placeholder="请输入关键词" |
|
|
placeholder="请输入关键词" |
|
|
@search="onSearchTreeData" |
|
|
@search="onSearchTreeData" /> |
|
|
/> |
|
|
|
|
|
</a-col> |
|
|
</a-col> |
|
|
</a-row> |
|
|
</a-row> |
|
|
</div> |
|
|
</div> |
|
@ -21,7 +20,7 @@ |
|
|
<a-tree |
|
|
<a-tree |
|
|
v-if="gData && gData.length > 0" |
|
|
v-if="gData && gData.length > 0" |
|
|
class="draggable-tree" |
|
|
class="draggable-tree" |
|
|
style="padding: 0 16px !important;" |
|
|
style="padding: 0 16px !important" |
|
|
draggable |
|
|
draggable |
|
|
show-line |
|
|
show-line |
|
|
checkable |
|
|
checkable |
|
@ -39,10 +38,21 @@ |
|
|
<template #title="data"> |
|
|
<template #title="data"> |
|
|
<div class="treeRow"> |
|
|
<div class="treeRow"> |
|
|
<div> |
|
|
<div> |
|
|
<span v-if="data.emissionName && selectTreeDataValue && data.emissionName.indexOf(selectTreeDataValue) > -1"> |
|
|
<span |
|
|
{{ data.emissionName.substring(0, data.emissionName.indexOf(selectTreeDataValue)) }} |
|
|
v-if=" |
|
|
|
|
|
data.emissionName && |
|
|
|
|
|
selectTreeDataValue && |
|
|
|
|
|
data.emissionName.indexOf(selectTreeDataValue) > -1 |
|
|
|
|
|
"> |
|
|
|
|
|
{{ |
|
|
|
|
|
data.emissionName.substring(0, data.emissionName.indexOf(selectTreeDataValue)) |
|
|
|
|
|
}} |
|
|
<span style="color: #f50">{{ selectTreeDataValue }}</span> |
|
|
<span style="color: #f50">{{ selectTreeDataValue }}</span> |
|
|
{{ data.emissionName.substring(data.emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length) }} |
|
|
{{ |
|
|
|
|
|
data.emissionName.substring( |
|
|
|
|
|
data.emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length, |
|
|
|
|
|
) |
|
|
|
|
|
}} |
|
|
</span> |
|
|
</span> |
|
|
<span v-else>{{ data.emissionName }}</span> |
|
|
<span v-else>{{ data.emissionName }}</span> |
|
|
</div> |
|
|
</div> |
|
@ -62,7 +72,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
</a-tree> |
|
|
</a-tree> |
|
|
<div class="addTreeNode"> |
|
|
<div class="addTreeNode"> |
|
|
<a-button type="primary" style="width:100%;" @click="addTreeNodeData">新增</a-button> |
|
|
<a-button type="primary" style="width: 100%" @click="addTreeNodeData">新增</a-button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -77,10 +87,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<!-- 新增树节点 --> |
|
|
<!-- 新增树节点 --> |
|
|
<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="addTreeNode" class="input" placeholder="请输入排放类型" /> |
|
|
v-model:value="addTreeNode" |
|
|
|
|
|
class="input" |
|
|
|
|
|
placeholder="请输入排放类型"/> |
|
|
|
|
|
</ns-modal> |
|
|
</ns-modal> |
|
|
<!-- 新增数据库数据 --> |
|
|
<!-- 新增数据库数据 --> |
|
|
<a-drawer |
|
|
<a-drawer |
|
@ -117,15 +124,21 @@ |
|
|
<a-button type="primary" @click="addUnit">新增单位</a-button> |
|
|
<a-button type="primary" @click="addUnit">新增单位</a-button> |
|
|
</div> |
|
|
</div> |
|
|
<div class="treePart"> |
|
|
<div class="treePart"> |
|
|
<div style="width: 100%;height: 7%;display: flex;justify-content: center;align-items: center;"> |
|
|
<div |
|
|
|
|
|
style=" |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
height: 7%; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
"> |
|
|
<a-select |
|
|
<a-select |
|
|
ref="select" |
|
|
ref="select" |
|
|
:value="unitTreeParams.id" |
|
|
:value="unitTreeParams.id" |
|
|
allowClear |
|
|
allowClear |
|
|
style="width: 96%" |
|
|
style="width: 96%" |
|
|
placeholder="选择分组" |
|
|
placeholder="选择分组" |
|
|
@change="handleChange" |
|
|
@change="handleChange"> |
|
|
> |
|
|
|
|
|
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id"> |
|
|
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id"> |
|
|
{{ item.cnValue }} |
|
|
{{ item.cnValue }} |
|
|
</a-select-option> |
|
|
</a-select-option> |
|
@ -146,8 +159,11 @@ |
|
|
<div class="actionMore"> |
|
|
<div class="actionMore"> |
|
|
<EditOutlined v-if="!data.parentId" @click="editGroup(data)" /> |
|
|
<EditOutlined v-if="!data.parentId" @click="editGroup(data)" /> |
|
|
<EditOutlined v-else @click="editUnit(data)" /> |
|
|
<EditOutlined v-else @click="editUnit(data)" /> |
|
|
<MinusCircleOutlined style="margin-left: 6px;" @click="delUnit(data)" /> |
|
|
<MinusCircleOutlined style="margin-left: 6px" @click="delUnit(data)" /> |
|
|
<PlusCircleOutlined v-if="!data.parentId" style="margin-left: 6px;" @click="addUnit(data)" /> |
|
|
<PlusCircleOutlined |
|
|
|
|
|
v-if="!data.parentId" |
|
|
|
|
|
style="margin-left: 6px" |
|
|
|
|
|
@click="addUnit(data)" /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
@ -158,31 +174,32 @@ |
|
|
</template> |
|
|
</template> |
|
|
</a-drawer> |
|
|
</a-drawer> |
|
|
<!-- 新增分组管理 --> |
|
|
<!-- 新增分组管理 --> |
|
|
<ns-modal :visible="addGroupManage" :title="addGroupTitle" @ok="unitOrGroupOk" @cancel="groupCancel"> |
|
|
<ns-modal |
|
|
<a-form |
|
|
:visible="addGroupManage" |
|
|
ref="unitFormRef" |
|
|
:title="addGroupTitle" |
|
|
:model="formState" |
|
|
@ok="unitOrGroupOk" |
|
|
:label-col="labelCol" |
|
|
@cancel="groupCancel"> |
|
|
:wrapper-col="wrapperCol" |
|
|
<a-form ref="unitFormRef" :model="formState" :label-col="labelCol" :wrapper-col="wrapperCol"> |
|
|
> |
|
|
|
|
|
<a-form-item label="分组名称" name="cnValue" :required="true"> |
|
|
<a-form-item label="分组名称" name="cnValue" :required="true"> |
|
|
<a-input v-model:value="formState.cnValue" placeholder="请输入分组名称" /> |
|
|
<a-input v-model:value="formState.cnValue" placeholder="请输入分组名称" /> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
</a-form> |
|
|
</a-form> |
|
|
</ns-modal> |
|
|
</ns-modal> |
|
|
<!-- 新增单位 --> |
|
|
<!-- 新增单位 --> |
|
|
<ns-modal :visible="addUnitManage" :title="addUnitTitle" @ok="unitOrGroupOk" @cancel="unitCancel"> |
|
|
<ns-modal |
|
|
<a-form |
|
|
:visible="addUnitManage" |
|
|
ref="unitFormRef" |
|
|
:title="addUnitTitle" |
|
|
:model="formState" |
|
|
@ok="unitOrGroupOk" |
|
|
:label-col="labelCol" |
|
|
@cancel="unitCancel"> |
|
|
:wrapper-col="wrapperCol" |
|
|
<a-form ref="unitFormRef" :model="formState" :label-col="labelCol" :wrapper-col="wrapperCol"> |
|
|
> |
|
|
|
|
|
<a-form-item label="单位名称" name="cnValue" :required="true"> |
|
|
<a-form-item label="单位名称" name="cnValue" :required="true"> |
|
|
<a-input v-model:value="formState.cnValue" placeholder="请输入单位名称" /> |
|
|
<a-input v-model:value="formState.cnValue" placeholder="请输入单位名称" /> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
<a-form-item label="选择分组" name="parentId" :required="true"> |
|
|
<a-form-item label="选择分组" name="parentId" :required="true"> |
|
|
<a-select v-model:value="formState.parentId" placeholder="请选择所属分组" :disabled="canSelect"> |
|
|
<a-select |
|
|
|
|
|
v-model:value="formState.parentId" |
|
|
|
|
|
placeholder="请选择所属分组" |
|
|
|
|
|
:disabled="canSelect"> |
|
|
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id"> |
|
|
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id"> |
|
|
{{ item.cnValue }} |
|
|
{{ item.cnValue }} |
|
|
</a-select-option> |
|
|
</a-select-option> |
|
@ -193,12 +210,17 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { MoreOutlined,ExclamationCircleOutlined,EditOutlined,PlusCircleOutlined,MinusCircleOutlined } from '@ant-design/icons-vue'; |
|
|
import { |
|
|
|
|
|
ExclamationCircleOutlined, |
|
|
|
|
|
EditOutlined, |
|
|
|
|
|
PlusCircleOutlined, |
|
|
|
|
|
MinusCircleOutlined, |
|
|
|
|
|
} from '@ant-design/icons-vue'; |
|
|
import { Modal } from 'ant-design-vue'; |
|
|
import { Modal } from 'ant-design-vue'; |
|
|
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch,toRaw } from 'vue'; |
|
|
import { computed, createVNode, reactive, ref, watchEffect, watch, toRaw } 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 } from '/nerv-lib/component'; |
|
|
import { formConfig, formConfig2 } from './config'; |
|
|
import { formConfig } from './config'; |
|
|
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary'; |
|
|
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary'; |
|
|
import type { |
|
|
import type { |
|
|
AntTreeNodeDragEnterEvent, |
|
|
AntTreeNodeDragEnterEvent, |
|
@ -220,7 +242,7 @@ |
|
|
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 showOperation = ref(false); |
|
|
|
|
|
|
|
|
const opMap: any = ref({ |
|
|
const opMap: any = ref({ |
|
|
type: 'add', |
|
|
type: 'add', |
|
@ -358,7 +380,7 @@ |
|
|
for (let i = 0; i < tree.length; i++) { |
|
|
for (let i = 0; i < tree.length; i++) { |
|
|
const node = tree[i]; |
|
|
const node = tree[i]; |
|
|
if (node.children) { |
|
|
if (node.children) { |
|
|
if (node.children.some(item => item.key === key)) { |
|
|
if (node.children.some((item) => item.key === key)) { |
|
|
parentKey = node.key; |
|
|
parentKey = node.key; |
|
|
} else if (getParentKey(key, node.children)) { |
|
|
} else if (getParentKey(key, node.children)) { |
|
|
parentKey = getParentKey(key, node.children); |
|
|
parentKey = getParentKey(key, node.children); |
|
@ -374,7 +396,7 @@ |
|
|
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]) => { |
|
|
if (item.title.indexOf(value) > -1) { |
|
|
if (item.title.indexOf(value) > -1) { |
|
@ -393,31 +415,31 @@ |
|
|
console.log('or use this.value', value.value); |
|
|
console.log('or use this.value', value.value); |
|
|
}; |
|
|
}; |
|
|
// 点击数据点的复选框 |
|
|
// 点击数据点的复选框 |
|
|
const checkedIds = ref([]) |
|
|
const checkedIds = ref([]); |
|
|
const emissionType = ref() |
|
|
const emissionType = ref(); |
|
|
const checkTreeNode = (checkedKeys, info) => { |
|
|
const checkTreeNode = (checkedKeys, info) => { |
|
|
checkedTreeNodeKeys.value = checkedKeys |
|
|
checkedTreeNodeKeys.value = checkedKeys; |
|
|
checkedIds.value = [] |
|
|
checkedIds.value = []; |
|
|
info.checkedNodes.forEach(item=>{ |
|
|
info.checkedNodes.forEach((item) => { |
|
|
checkedIds.value.push(item.id) |
|
|
checkedIds.value.push(item.id); |
|
|
}) |
|
|
}); |
|
|
sessionStorage.setItem('checkedTreeNode', checkedIds.value); |
|
|
sessionStorage.setItem('checkedTreeNode', checkedIds.value); |
|
|
emissionType.value = checkedIds.value.join(',') |
|
|
emissionType.value = checkedIds.value.join(','); |
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
} |
|
|
}; |
|
|
// 点击新增树节点 |
|
|
// 点击新增树节点 |
|
|
const addTreeNodeData = () => { |
|
|
const addTreeNodeData = () => { |
|
|
operationTree.value='新增' |
|
|
operationTree.value = '新增'; |
|
|
treeNodeAdd.value = true; |
|
|
treeNodeAdd.value = true; |
|
|
editTreeNode.value.type = 'create' |
|
|
editTreeNode.value.type = 'create'; |
|
|
}; |
|
|
}; |
|
|
// 编辑树节点 |
|
|
// 编辑树节点 |
|
|
const editTreeNodeData = (data) => { |
|
|
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 |
|
|
addTreeNode.value = data.emissionName; |
|
|
} |
|
|
}; |
|
|
// 删除树节点 |
|
|
// 删除树节点 |
|
|
const deleteTreeNode = () => { |
|
|
const deleteTreeNode = () => { |
|
|
Modal.confirm({ |
|
|
Modal.confirm({ |
|
@ -429,7 +451,7 @@ |
|
|
cancelText: '取消', |
|
|
cancelText: '取消', |
|
|
onOk() { |
|
|
onOk() { |
|
|
http.post(carbonEmissionFactorLibrary.delTreeNode, editTreeNode.value).then(() => { |
|
|
http.post(carbonEmissionFactorLibrary.delTreeNode, editTreeNode.value).then(() => { |
|
|
getOrgTree() |
|
|
getOrgTree(); |
|
|
NsMessage.success('操作成功'); |
|
|
NsMessage.success('操作成功'); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
@ -437,26 +459,26 @@ |
|
|
console.log('Cancel'); |
|
|
console.log('Cancel'); |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
}; |
|
|
// 新增/编辑树节点点击确定 |
|
|
// 新增/编辑树节点点击确定 |
|
|
const addTreeNode =ref() |
|
|
const addTreeNode = ref(); |
|
|
const handleOk = (e: MouseEvent) => { |
|
|
const handleOk = (e: MouseEvent) => { |
|
|
editTreeNode.value.emissionName = addTreeNode.value |
|
|
editTreeNode.value.emissionName = addTreeNode.value; |
|
|
http.post(carbonEmissionFactorLibrary.creat, editTreeNode.value).then(() => { |
|
|
http.post(carbonEmissionFactorLibrary.creat, editTreeNode.value).then(() => { |
|
|
getOrgTree() |
|
|
getOrgTree(); |
|
|
NsMessage.success('操作成功'); |
|
|
NsMessage.success('操作成功'); |
|
|
addTreeNode.value = '' |
|
|
addTreeNode.value = ''; |
|
|
treeNodeAdd.value = false; |
|
|
treeNodeAdd.value = false; |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const handleCancel = () => { |
|
|
const handleCancel = () => { |
|
|
addTreeNode.value = '' |
|
|
addTreeNode.value = ''; |
|
|
treeNodeAdd.value = false; |
|
|
treeNodeAdd.value = false; |
|
|
}; |
|
|
}; |
|
|
// 获取排放分类树 |
|
|
// 获取排放分类树 |
|
|
const getOrgTree = (params?) => { |
|
|
const getOrgTree = (params?) => { |
|
|
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => { |
|
|
gData.value = res.data |
|
|
gData.value = res.data; |
|
|
// 找到匹配的节点数据 |
|
|
// 找到匹配的节点数据 |
|
|
// const selectedNodes = []; |
|
|
// const selectedNodes = []; |
|
|
// checkedTreeNodeKeys.value.forEach(key => { |
|
|
// checkedTreeNodeKeys.value.forEach(key => { |
|
@ -469,31 +491,31 @@ |
|
|
// getDefaultIds(selectedNodes) |
|
|
// getDefaultIds(selectedNodes) |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const defaultIds = ref([]) |
|
|
const defaultIds = ref([]); |
|
|
const getDefaultIds = (selectedNodes) => { |
|
|
const getDefaultIds = (selectedNodes) => { |
|
|
selectedNodes.forEach(items => { |
|
|
selectedNodes.forEach((items) => { |
|
|
defaultIds.value.push(items.id) |
|
|
defaultIds.value.push(items.id); |
|
|
if (items.children) { |
|
|
if (items.children) { |
|
|
getDefaultIds(items.children) |
|
|
getDefaultIds(items.children); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
emissionType.value = defaultIds.value.join(',') |
|
|
emissionType.value = defaultIds.value.join(','); |
|
|
checkedIds.value = defaultIds.value |
|
|
checkedIds.value = defaultIds.value; |
|
|
sessionStorage.setItem('checkedTreeNode', checkedIds.value); |
|
|
sessionStorage.setItem('checkedTreeNode', checkedIds.value); |
|
|
} |
|
|
}; |
|
|
getOrgTree(); |
|
|
getOrgTree(); |
|
|
// 被选中的树节点 |
|
|
// 被选中的树节点 |
|
|
const editTreeNode = ref({}) |
|
|
const editTreeNode = ref({}); |
|
|
const onSelect = (selectedKeys: string[], info: any) => { |
|
|
const onSelect = (selectedKeys: string[], info: any) => { |
|
|
if (info.selected) { |
|
|
if (info.selected) { |
|
|
showOperation.value = true |
|
|
showOperation.value = true; |
|
|
editTreeNode.value = { |
|
|
editTreeNode.value = { |
|
|
id: info.selectedNodes[0].id, |
|
|
id: info.selectedNodes[0].id, |
|
|
level: info.selectedNodes[0].level, |
|
|
level: info.selectedNodes[0].level, |
|
|
dataNumber: info.selectedNodes[0].dataNumber, |
|
|
dataNumber: info.selectedNodes[0].dataNumber, |
|
|
sortNumber: info.selectedNodes[0].sortNumber, |
|
|
sortNumber: info.selectedNodes[0].sortNumber, |
|
|
parentEmissionId: info.selectedNodes[0].parentEmissionId, |
|
|
parentEmissionId: info.selectedNodes[0].parentEmissionId, |
|
|
} |
|
|
}; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -516,13 +538,14 @@ |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleSelect = (selectedKeys: any, info: any) => { |
|
|
const handleSelect = (selectedKeys: any, info: any) => { |
|
|
fetch(carbonEmissionFactorLibrary.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then( |
|
|
|
|
|
(res) => { |
|
|
treeData2.value = res.data; |
|
|
treeData2.value = res.data; |
|
|
}); |
|
|
}, |
|
|
|
|
|
); |
|
|
tableFetch({ orgId: info.node?.orgInfo.orgId }); |
|
|
tableFetch({ orgId: info.node?.orgInfo.orgId }); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onClose = () => { |
|
|
const onClose = () => { |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
formData.value = {}; |
|
|
formData.value = {}; |
|
@ -530,8 +553,8 @@ |
|
|
}; |
|
|
}; |
|
|
const closeUnitManag = () => { |
|
|
const closeUnitManag = () => { |
|
|
unitTreeParams.value = { |
|
|
unitTreeParams.value = { |
|
|
grp: 'MEASUREMENT_UNIT' |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
} |
|
|
}; |
|
|
unitManagement.value = false; |
|
|
unitManagement.value = false; |
|
|
}; |
|
|
}; |
|
|
const onEdit = () => { |
|
|
const onEdit = () => { |
|
@ -542,8 +565,7 @@ |
|
|
// return; |
|
|
// return; |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
opMap.value.fuc && |
|
|
opMap.value.fuc && opMap.value.fuc({ ...formData.value }); |
|
|
opMap.value.fuc({ ...formData.value }); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const tableConfig = ref({ |
|
|
const tableConfig = ref({ |
|
@ -551,7 +573,7 @@ |
|
|
api: carbonEmissionFactorLibrary.getTableList, |
|
|
api: carbonEmissionFactorLibrary.getTableList, |
|
|
params: { |
|
|
params: { |
|
|
orgId, |
|
|
orgId, |
|
|
emissionType |
|
|
emissionType, |
|
|
}, |
|
|
}, |
|
|
headerActions: [ |
|
|
headerActions: [ |
|
|
{ |
|
|
{ |
|
@ -563,12 +585,12 @@ |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
formData.value = { |
|
|
formData.value = { |
|
|
carbonEmissionPrefix: 't', |
|
|
carbonEmissionPrefix: 't', |
|
|
numberOfReferences:'10' |
|
|
numberOfReferences: '10', |
|
|
}; |
|
|
}; |
|
|
userAuthList.value.splice(0); |
|
|
userAuthList.value.splice(0); |
|
|
}); |
|
|
}); |
|
|
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]; |
|
|
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; |
|
@ -607,11 +629,13 @@ |
|
|
type: 'primary', |
|
|
type: 'primary', |
|
|
name: 'userAdd', |
|
|
name: 'userAdd', |
|
|
handle: () => { |
|
|
handle: () => { |
|
|
unitManagement.value = true, |
|
|
(unitManagement.value = true), |
|
|
fetch(carbonEmissionFactorLibrary.findOutermost,{grp:'MEASUREMENT_UNIT'}).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.findOutermost, { grp: 'MEASUREMENT_UNIT' }).then( |
|
|
groupData.value = res.data |
|
|
(res) => { |
|
|
}); |
|
|
groupData.value = res.data; |
|
|
getUnitTree() |
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
getUnitTree(); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
@ -672,14 +696,14 @@ |
|
|
handle: (record: any) => { |
|
|
handle: (record: any) => { |
|
|
userAuthList.value.splice(0); |
|
|
userAuthList.value.splice(0); |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
const measurementUnit = ref([]) |
|
|
const measurementUnit = ref([]); |
|
|
http.post(carbonEmissionFactorLibrary.getCarbonFactorTree, {}).then((res) => { |
|
|
http.post(carbonEmissionFactorLibrary.getCarbonFactorTree, {}).then((res) => { |
|
|
measurementUnit.value = res.data |
|
|
measurementUnit.value = res.data; |
|
|
http.post(carbonEmissionFactorLibrary.findById, { id: record.id }).then((res) => { |
|
|
http.post(carbonEmissionFactorLibrary.findById, { id: record.id }).then((res) => { |
|
|
if (res.data.emissionType) { |
|
|
if (res.data.emissionType) { |
|
|
let selectDevice = ref([Number(res.data.emissionType)]); |
|
|
let selectDevice = ref([Number(res.data.emissionType)]); |
|
|
findParentIds(measurementUnit.value, res.data.emissionType, selectDevice.value); |
|
|
findParentIds(measurementUnit.value, res.data.emissionType, selectDevice.value); |
|
|
res.data.emissionType = selectDevice |
|
|
res.data.emissionType = selectDevice; |
|
|
} |
|
|
} |
|
|
formData.value = res.data; |
|
|
formData.value = res.data; |
|
|
}); |
|
|
}); |
|
@ -687,9 +711,9 @@ |
|
|
}, 10); |
|
|
}, 10); |
|
|
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) { |
|
|
if (formData.emissionGas.value) { |
|
|
formData.emissionGas = 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(); |
|
@ -834,19 +858,21 @@ |
|
|
const unitExpandedKeys = ref<string[]>(); |
|
|
const unitExpandedKeys = ref<string[]>(); |
|
|
const unitSelectedKeys = ref<string[]>([]); |
|
|
const unitSelectedKeys = ref<string[]>([]); |
|
|
const unitTreeParams = ref({ |
|
|
const unitTreeParams = ref({ |
|
|
grp: 'MEASUREMENT_UNIT' |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
}) |
|
|
}); |
|
|
const groupData = ref([]) |
|
|
const groupData = ref([]); |
|
|
const unitTreeData = ref<TreeProps['treeData']>(genData); |
|
|
const unitTreeData = ref<TreeProps['treeData']>(genData); |
|
|
const handleChange = (value: string) => { |
|
|
const handleChange = (value: string) => { |
|
|
unitTreeParams.value.id = value |
|
|
unitTreeParams.value.id = value; |
|
|
getUnitTree() |
|
|
getUnitTree(); |
|
|
}; |
|
|
}; |
|
|
const getUnitTree = () => { |
|
|
const getUnitTree = () => { |
|
|
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then( |
|
|
unitTreeData.value = res.data |
|
|
(res) => { |
|
|
}); |
|
|
unitTreeData.value = res.data; |
|
|
} |
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}; |
|
|
// 新增单位管理 |
|
|
// 新增单位管理 |
|
|
const labelCol = { span: 5 }; |
|
|
const labelCol = { span: 5 }; |
|
|
const wrapperCol = { span: 19 }; |
|
|
const wrapperCol = { span: 19 }; |
|
@ -857,55 +883,55 @@ |
|
|
const formState = ref({ |
|
|
const formState = ref({ |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grpDesc: '计量单位', |
|
|
grpDesc: '计量单位', |
|
|
}) |
|
|
}); |
|
|
const addGroupTitle = ref<string>('新增分组'); |
|
|
const addGroupTitle = ref<string>('新增分组'); |
|
|
const addUnitTitle = ref<string>('新增单位'); |
|
|
const addUnitTitle = ref<string>('新增单位'); |
|
|
const addGroup = () => { |
|
|
const addGroup = () => { |
|
|
addGroupTitle.value = '新增分组' |
|
|
addGroupTitle.value = '新增分组'; |
|
|
addGroupManage.value = true |
|
|
addGroupManage.value = true; |
|
|
}; |
|
|
}; |
|
|
const editGroup = (data) => { |
|
|
const editGroup = (data) => { |
|
|
addGroupTitle.value = '编辑分组' |
|
|
addGroupTitle.value = '编辑分组'; |
|
|
addGroupManage.value = true |
|
|
addGroupManage.value = true; |
|
|
formState.value.id = data.id |
|
|
formState.value.id = data.id; |
|
|
formState.value.cnValue = data.cnValue |
|
|
formState.value.cnValue = data.cnValue; |
|
|
}; |
|
|
}; |
|
|
const groupCancel = () => { |
|
|
const groupCancel = () => { |
|
|
addGroupManage.value = false |
|
|
addGroupManage.value = false; |
|
|
unitFormRef.value.resetFields(); |
|
|
unitFormRef.value.resetFields(); |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grpDesc: '计量单位', |
|
|
grpDesc: '计量单位', |
|
|
} |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
const addUnit = (data) => { |
|
|
const addUnit = (data) => { |
|
|
if (data.id) { |
|
|
if (data.id) { |
|
|
canSelect.value = true |
|
|
canSelect.value = true; |
|
|
formState.value.parentId = data.id |
|
|
formState.value.parentId = data.id; |
|
|
} else { |
|
|
} else { |
|
|
canSelect.value = false |
|
|
canSelect.value = false; |
|
|
} |
|
|
} |
|
|
fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => { |
|
|
groupData.value = res.data |
|
|
groupData.value = res.data; |
|
|
}); |
|
|
}); |
|
|
addUnitTitle.value = '新增单位' |
|
|
addUnitTitle.value = '新增单位'; |
|
|
addUnitManage.value = true |
|
|
addUnitManage.value = true; |
|
|
}; |
|
|
}; |
|
|
const editUnit = (data) => { |
|
|
const editUnit = (data) => { |
|
|
addUnitTitle.value = '编辑单位' |
|
|
addUnitTitle.value = '编辑单位'; |
|
|
addUnitManage.value = true |
|
|
addUnitManage.value = true; |
|
|
canSelect.value = true |
|
|
canSelect.value = true; |
|
|
formState.value.parentId = data.parentId |
|
|
formState.value.parentId = data.parentId; |
|
|
formState.value.id = data.id |
|
|
formState.value.id = data.id; |
|
|
formState.value.cnValue = data.cnValue |
|
|
formState.value.cnValue = data.cnValue; |
|
|
}; |
|
|
}; |
|
|
const unitCancel = () => { |
|
|
const unitCancel = () => { |
|
|
addUnitManage.value = false |
|
|
addUnitManage.value = false; |
|
|
unitFormRef.value.resetFields(); |
|
|
unitFormRef.value.resetFields(); |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grpDesc: '计量单位', |
|
|
grpDesc: '计量单位', |
|
|
} |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
const unitOrGroupOk = () => { |
|
|
const unitOrGroupOk = () => { |
|
|
unitFormRef.value |
|
|
unitFormRef.value |
|
@ -914,43 +940,43 @@ |
|
|
console.log('values', formState, toRaw(formState)); |
|
|
console.log('values', formState, toRaw(formState)); |
|
|
if (formState.value.id) { |
|
|
if (formState.value.id) { |
|
|
fetch(carbonEmissionFactorLibrary.updateDictionary, formState.value).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.updateDictionary, formState.value).then((res) => { |
|
|
unitTreeData.value = res.data |
|
|
unitTreeData.value = res.data; |
|
|
if (formState.value.parentId) { |
|
|
if (formState.value.parentId) { |
|
|
addUnitManage.value = false |
|
|
addUnitManage.value = false; |
|
|
} else { |
|
|
} else { |
|
|
addGroupManage.value = false |
|
|
addGroupManage.value = false; |
|
|
} |
|
|
} |
|
|
unitFormRef.value.resetFields(); |
|
|
unitFormRef.value.resetFields(); |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grpDesc: '计量单位', |
|
|
grpDesc: '计量单位', |
|
|
} |
|
|
}; |
|
|
getUnitTree() |
|
|
getUnitTree(); |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
fetch(carbonEmissionFactorLibrary.createDictionary, formState.value).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.createDictionary, formState.value).then((res) => { |
|
|
unitTreeData.value = res.data |
|
|
unitTreeData.value = res.data; |
|
|
if (formState.value.parentId) { |
|
|
if (formState.value.parentId) { |
|
|
addUnitManage.value = false |
|
|
addUnitManage.value = false; |
|
|
} else { |
|
|
} else { |
|
|
addGroupManage.value = false |
|
|
addGroupManage.value = false; |
|
|
} |
|
|
} |
|
|
unitFormRef.value.resetFields(); |
|
|
unitFormRef.value.resetFields(); |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grp: 'MEASUREMENT_UNIT', |
|
|
grpDesc: '计量单位', |
|
|
grpDesc: '计量单位', |
|
|
} |
|
|
}; |
|
|
getUnitTree() |
|
|
getUnitTree(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch(error => { |
|
|
.catch((error) => { |
|
|
console.log('error', error); |
|
|
console.log('error', error); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
// 删除单位管理的树节点 |
|
|
// 删除单位管理的树节点 |
|
|
const delUnit = (data) => { |
|
|
const delUnit = (data) => { |
|
|
formState.value.id = data.id |
|
|
formState.value.id = data.id; |
|
|
Modal.confirm({ |
|
|
Modal.confirm({ |
|
|
title: '警告', |
|
|
title: '警告', |
|
|
content: '确定要删除吗?', |
|
|
content: '确定要删除吗?', |
|
@ -960,7 +986,7 @@ |
|
|
onOk() { |
|
|
onOk() { |
|
|
fetch(carbonEmissionFactorLibrary.delDictionary, formState.value).then((res) => { |
|
|
fetch(carbonEmissionFactorLibrary.delDictionary, formState.value).then((res) => { |
|
|
message.success('操作成功!'); |
|
|
message.success('操作成功!'); |
|
|
getUnitTree() |
|
|
getUnitTree(); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
onCancel() { |
|
|
onCancel() { |
|
@ -968,7 +994,6 @@ |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
<style lang="less" scoped> |
|
|
<style lang="less" scoped> |
|
|
.main { |
|
|
.main { |
|
@ -1034,7 +1059,7 @@ |
|
|
height: 13px; |
|
|
height: 13px; |
|
|
width: 3px; |
|
|
width: 3px; |
|
|
border-radius: 1px; |
|
|
border-radius: 1px; |
|
|
background-color: #2778FF; |
|
|
background-color: #2778ff; |
|
|
} |
|
|
} |
|
|
.treeRow { |
|
|
.treeRow { |
|
|
display: flex; |
|
|
display: flex; |
|
|