【中汽测试】标准体系默认根节点默认展开

This commit is contained in:
赵霄
2023-11-10 17:45:20 +08:00
parent 2797c2b682
commit ad1b05eaee
3 changed files with 53 additions and 12 deletions
@@ -12,6 +12,7 @@
:show-line="true"
:show-icon="true"
:tree-data="treeData"
:expanded-keys="expandedKeys"
:selectedKeys="currentTreeNode"
:default-expand-all="defaultExpandAll">
<template #title="record">
@@ -276,7 +277,8 @@ export default {
downTemplateUrl: '/laws/standard/enterprise/templateDownload' // 下载导入模板
},
showAction: true, // 是否显示操作列
currentShare: {}
currentShare: {},
expandedKeys: [] // 体系展开的节点
}
},
mounted () {
@@ -293,6 +295,7 @@ export default {
this.filters.nodeCode = null
if (res.success) {
this.treeData = res.result || []
this.expandedKeys = [this.treeData[0].key]
} else {
this.treeData = []
}
@@ -7,7 +7,11 @@
@search="handleTreeSearch" />
<div class="page-tree-box page-tree-box-has-search">
<a-spin :spinning="treeLoading">
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData" :selected-keys="selectedTreeKeys">
<a-tree :show-line="true"
:show-icon="true"
:tree-data="treeData"
:expanded-keys="expandedKeys"
:selected-keys="selectedTreeKeys">
<template #title="record">
<div class="tree-operate-node"
@mouseenter="handleTreeMouseover(record.key)"
@@ -282,7 +286,8 @@ export default {
selectedTreeNodeCodes: [], // 选中树节点的code
tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段
treeLoading: false,
isCollection: false
isCollection: false,
expandedKeys: [] // 展开的节点
}
},
computed: {
@@ -312,6 +317,8 @@ export default {
this.filters.nodeCode = null
if (res.success) {
this.treeData = res.result || []
// 根节点默认展开
this.expandedKeys = [this.treeData[0].key]
} else {
this.$message.warn(res.message)
}
@@ -7,14 +7,20 @@
@search="handleTreeSearch" />
<div class="page-tree-box page-tree-box-has-search">
<a-spin :spinning="treeLoading">
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData" :selected-keys="selectedTreeKeys">
<a-tree :show-line="true"
:show-icon="true"
:tree-data="treeData"
:expanded-keys="expandedKeys"
:selected-keys="selectedTreeKeys">
<template #title="record">
<div class="tree-operate-node"
@mouseenter="handleTreeMouseover(record.key)"
@mouseleave="handleTreeMouseout(record.key)"
@click="handleSelectTreeNode(record)">
<a-icon class="parent-node-icon" type="folder" v-if="record.dataRef.children && record.dataRef.children.length > 0" />
<a-icon class="parent-node-icon"
type="folder"
v-if="record.dataRef.children && record.dataRef.children.length > 0" />
<a-tooltip>
<template #title>
{{ record.title }}
@@ -98,13 +104,20 @@
{{ $t('templateDownload') }}
</a-button>
<!-- 批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'overseasStandard:batchDel'">{{ $t('batchDelete') }}</a-button>
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'overseasStandard:batchDel'">{{
$t('batchDelete')
}}
</a-button>
<!-- 配置标准-->
<a-button type="primary" icon="setting" ghost @click="handleConfigStandard" v-has="'overseasStandard:configStandard'">
{{ $t('standardRegulationLibrary.configStandard') }}
</a-button>
<!-- 移出标准-->
<a-button type="primary" icon="minus-circle" ghost @click="handleRemoveStandard" v-has="'overseasStandard:removeStandard'">
<a-button type="primary"
icon="minus-circle"
ghost
@click="handleRemoveStandard"
v-has="'overseasStandard:removeStandard'">
{{ $t('standardRegulationLibrary.removeStandard') }}
</a-button>
</div>
@@ -125,7 +138,10 @@
<template v-slot:standard_number="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{ text }}</div>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
text
}}
</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
@@ -134,7 +150,10 @@
<template v-slot:standard_name="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{ text }}</div>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
text
}}
</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
@@ -176,7 +195,9 @@
<!-- 树新增编辑-->
<overseas-system-tree-modal ref="treeModal" @ok="modalFormOk" />
<!-- 配置标准-->
<selection-overseas-standard-drawer ref="standardSelectionModal" :node-code="selectedTreeNodeCodes[0]" @change="continueConfigStandard" />
<selection-overseas-standard-drawer ref="standardSelectionModal"
:node-code="selectedTreeNodeCodes[0]"
@change="continueConfigStandard" />
</a-card>
</template>
@@ -205,7 +226,14 @@ import { postDownFile } from '../../../api/manage.js'
export default {
name: 'OverseasStandardList',
components: { Search, JTable, UserSelectModal, OverseasStandardModal, OverseasSystemTreeModal, SelectionOverseasStandardDrawer },
components: {
Search,
JTable,
UserSelectModal,
OverseasStandardModal,
OverseasSystemTreeModal,
SelectionOverseasStandardDrawer
},
mixins: [ConfigurableTableMixin],
data () {
return {
@@ -258,7 +286,8 @@ export default {
selectedTreeNodeCodes: [], // 选中树节点的code
tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段
treeLoading: false,
isCollection: false
isCollection: false,
expandedKeys: []
}
},
computed: {
@@ -288,6 +317,8 @@ export default {
this.filters.nodeCode = null
if (res.success) {
this.treeData = res.result || []
// 根节点默认展开
this.expandedKeys = [this.treeData[0].key]
} else {
this.$message.warn(res.message)
}