|
@ -21,20 +21,22 @@ |
|
|
:auto-expand-parent="autoExpandParent" |
|
|
:auto-expand-parent="autoExpandParent" |
|
|
:selectedKeys="selectedKeys" |
|
|
:selectedKeys="selectedKeys" |
|
|
:tree-data="gData" |
|
|
:tree-data="gData" |
|
|
|
|
|
:show-line="{ showLeafIcon: false }" |
|
|
show-line |
|
|
show-line |
|
|
@expand="onExpand" |
|
|
@expand="onExpand" |
|
|
@select="onSelect" |
|
|
@select="onSelect" |
|
|
style="padding: 0 16px !important"> |
|
|
style="padding: 0 16px !important"> |
|
|
<template #title="data"> |
|
|
<template #title="data"> |
|
|
<span |
|
|
<!-- <span |
|
|
v-if="data.energyType && searchValue && data.energyType.indexOf(searchValue) > -1"> |
|
|
v-if="data.energyType && searchValue && data.energyType.indexOf(searchValue) > -1"> |
|
|
{{ data.energyType.substring(0, data.energyType.indexOf(searchValue)) }} |
|
|
{{ data.energyType.substring(0, data.energyType.indexOf(searchValue)) }} |
|
|
<span style="color: #f50">{{ searchValue }}</span> |
|
|
<span style="color: #f50">{{ searchValue }}</span> |
|
|
{{ |
|
|
{{ |
|
|
data.energyType.substring(data.energyType.indexOf(searchValue) + searchValue.length) |
|
|
data.energyType.substring(data.energyType.indexOf(searchValue) + searchValue.length) |
|
|
}} |
|
|
}} |
|
|
</span> |
|
|
</span> --> |
|
|
<span v-else>{{ data.energyType }}</span> |
|
|
<span v-if="data.code">{{ truncatedName(data.energyType + data.code) }}</span> |
|
|
|
|
|
<span v-else>{{ truncatedName(data.energyType) }}</span> |
|
|
</template> |
|
|
</template> |
|
|
</a-tree> |
|
|
</a-tree> |
|
|
</div> |
|
|
</div> |
|
@ -130,8 +132,8 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { ref, watch, toRaw, defineExpose } from 'vue'; |
|
|
import { ref, watch, toRaw, defineExpose, nextTick } from 'vue'; |
|
|
import type { TreeProps } from 'ant-design-vue'; |
|
|
import { message, TreeProps } from 'ant-design-vue'; |
|
|
import { Pagination, Modal } from 'ant-design-vue'; |
|
|
import { Pagination, Modal } from 'ant-design-vue'; |
|
|
import { columns, drawerColumns } from '../config'; |
|
|
import { columns, drawerColumns } from '../config'; |
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
import { http } from '/nerv-lib/util/http'; |
|
@ -225,6 +227,12 @@ |
|
|
expandedKeys.value = keys; |
|
|
expandedKeys.value = keys; |
|
|
autoExpandParent.value = false; |
|
|
autoExpandParent.value = false; |
|
|
}; |
|
|
}; |
|
|
|
|
|
const truncatedName = (name) => { |
|
|
|
|
|
if (name.length > 8) { |
|
|
|
|
|
return name.substring(0, 8) + '...'; |
|
|
|
|
|
} |
|
|
|
|
|
return name; |
|
|
|
|
|
}; |
|
|
// 被选中的树节点 |
|
|
// 被选中的树节点 |
|
|
const energyType = ref(); |
|
|
const energyType = ref(); |
|
|
const onSelect = (selectedKey: string[], info: any) => { |
|
|
const onSelect = (selectedKey: string[], info: any) => { |
|
@ -245,16 +253,22 @@ |
|
|
return null; |
|
|
return null; |
|
|
}) |
|
|
}) |
|
|
.filter((item, i, self) => item && self.indexOf(item) === i); |
|
|
.filter((item, i, self) => item && self.indexOf(item) === i); |
|
|
expandedKeys.value = expanded; |
|
|
// expandedKeys.value = expanded; |
|
|
searchValue.value = value; |
|
|
searchValue.value = value; |
|
|
autoExpandParent.value = true; |
|
|
autoExpandParent.value = true; |
|
|
}); |
|
|
}); |
|
|
// 查询因子分类树数据 |
|
|
// 查询因子分类树数据 |
|
|
const onSearchTreeData = () => {}; |
|
|
const getTreeQuery = ref({ |
|
|
|
|
|
orgId: orgId.value, |
|
|
|
|
|
}); |
|
|
|
|
|
const onSearchTreeData = () => { |
|
|
|
|
|
getTreeQuery.value.energyType = searchValue.value; |
|
|
|
|
|
getTreeData(); |
|
|
|
|
|
}; |
|
|
const statsId = ref(); |
|
|
const statsId = ref(); |
|
|
// 获取因子分类树数据 |
|
|
// 获取因子分类树数据 |
|
|
const getTreeData = () => { |
|
|
const getTreeData = () => { |
|
|
fetch(quickCalculation.carbonQuickTree, { orgId: orgId.value }).then((res) => { |
|
|
fetch(quickCalculation.carbonQuickTree, getTreeQuery.value).then((res) => { |
|
|
gData.value = res.data; |
|
|
gData.value = res.data; |
|
|
energyType.value = gData.value[0].children[0].id; |
|
|
energyType.value = gData.value[0].children[0].id; |
|
|
statsId.value = gData.value[0].children[0].id; |
|
|
statsId.value = gData.value[0].children[0].id; |
|
@ -271,9 +285,12 @@ |
|
|
}); |
|
|
}); |
|
|
const tableData = ref([]); |
|
|
const tableData = ref([]); |
|
|
const emissionSources = ref(); |
|
|
const emissionSources = ref(); |
|
|
|
|
|
const treeId = ref([]); |
|
|
|
|
|
const tableId = ref([]); |
|
|
const tableConfig = ref({ |
|
|
const tableConfig = ref({ |
|
|
title: '排放因子库', |
|
|
title: '排放因子库', |
|
|
api: quickCalculation.queryCarbonEmissionPage, |
|
|
api: quickCalculation.queryCarbonEmissionPage, |
|
|
|
|
|
rowSelection: null, |
|
|
params: { |
|
|
params: { |
|
|
orgId, |
|
|
orgId, |
|
|
energyType, |
|
|
energyType, |
|
@ -307,12 +324,6 @@ |
|
|
dataIndex: 'carbonEmissionSuffix', |
|
|
dataIndex: 'carbonEmissionSuffix', |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '更新时间', |
|
|
|
|
|
className: 'updateTime', |
|
|
|
|
|
dataIndex: 'updateTime', |
|
|
|
|
|
ellipsis: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '启用时间', |
|
|
title: '启用时间', |
|
|
className: 'startTime', |
|
|
className: 'startTime', |
|
|
dataIndex: 'startTime', |
|
|
dataIndex: 'startTime', |
|
@ -327,6 +338,12 @@ |
|
|
className: 'dataSources', |
|
|
className: 'dataSources', |
|
|
dataIndex: 'dataSources', |
|
|
dataIndex: 'dataSources', |
|
|
}, |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '更新时间', |
|
|
|
|
|
className: 'updateTime', |
|
|
|
|
|
dataIndex: 'updateTime', |
|
|
|
|
|
ellipsis: true, |
|
|
|
|
|
}, |
|
|
], |
|
|
], |
|
|
columnActions: { |
|
|
columnActions: { |
|
|
title: '操作', |
|
|
title: '操作', |
|
@ -342,8 +359,10 @@ |
|
|
formState.value.factorId = record.factorId; |
|
|
formState.value.factorId = record.factorId; |
|
|
text.value = '编辑'; |
|
|
text.value = '编辑'; |
|
|
visible.value = true; |
|
|
visible.value = true; |
|
|
emissionSources.value = record.factorId; //todo |
|
|
emissionSources.value = record.factorId; |
|
|
queryData.value.factorId = emissionSources.value; //todo |
|
|
queryData.value.factorId = emissionSources.value; |
|
|
|
|
|
treeId.value = [record.treeId]; |
|
|
|
|
|
tableId.value = [record.factorId]; |
|
|
getNewTable(); |
|
|
getNewTable(); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -450,6 +469,7 @@ |
|
|
selectedRowKeys.value = []; |
|
|
selectedRowKeys.value = []; |
|
|
formState.value = {}; |
|
|
formState.value = {}; |
|
|
formRef.value.resetFields(); |
|
|
formRef.value.resetFields(); |
|
|
|
|
|
message.success('操作成功!'); |
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
@ -458,6 +478,7 @@ |
|
|
selectedRowKeys.value = []; |
|
|
selectedRowKeys.value = []; |
|
|
formState.value = {}; |
|
|
formState.value = {}; |
|
|
formRef.value.resetFields(); |
|
|
formRef.value.resetFields(); |
|
|
|
|
|
message.success('操作成功!'); |
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -487,9 +508,15 @@ |
|
|
}; |
|
|
}; |
|
|
const openVisible = ref(false); |
|
|
const openVisible = ref(false); |
|
|
const setFactorRef = ref(); |
|
|
const setFactorRef = ref(); |
|
|
const config = setFactorConfig(orgId.value); |
|
|
const config = setFactorConfig(orgId.value, treeId.value, tableId.value); |
|
|
const selectFactor = () => { |
|
|
const selectFactor = () => { |
|
|
openVisible.value = true; |
|
|
openVisible.value = true; |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
setFactorRef.value.nsTableRef.params.emissionList = treeId.value; |
|
|
|
|
|
setFactorRef.value.nsTableRef.treeElRef.selectedKeys = treeId.value; |
|
|
|
|
|
setFactorRef.value.nsTableRef.rowSelection.selectedRowKeys = tableId.value; |
|
|
|
|
|
setFactorRef.value.nsTableRef.reload(); |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const btnClick = () => { |
|
|
const btnClick = () => { |
|
|
let selectRowKeys = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys; |
|
|
let selectRowKeys = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys; |
|
@ -624,6 +651,25 @@ |
|
|
:deep(.ant-modal-footer) { |
|
|
:deep(.ant-modal-footer) { |
|
|
border-top: 10px solid #f0f0f0 !important; |
|
|
border-top: 10px solid #f0f0f0 !important; |
|
|
} |
|
|
} |
|
|
|
|
|
:deep(.ns-table-container) { |
|
|
|
|
|
background: white; |
|
|
|
|
|
} |
|
|
|
|
|
:deep(.ns-part-tree) { |
|
|
|
|
|
border-radius: 8px; |
|
|
|
|
|
background: rgba(255, 255, 255, 1); |
|
|
|
|
|
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%); |
|
|
|
|
|
} |
|
|
|
|
|
:deep(.ns-table-search) { |
|
|
|
|
|
border-radius: 8px; |
|
|
|
|
|
background: rgba(255, 255, 255, 1); |
|
|
|
|
|
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%); |
|
|
|
|
|
} |
|
|
|
|
|
:deep(.ns-table-main) { |
|
|
|
|
|
margin-top: 20px !important; |
|
|
|
|
|
border-radius: 8px; |
|
|
|
|
|
background: rgba(255, 255, 255, 1); |
|
|
|
|
|
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%); |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
<style scoped> |
|
|
<style scoped> |
|
|
th.column-money, |
|
|
th.column-money, |
|
|