[update] 树选择增加loading

This commit is contained in:
lideqin
2024-08-09 10:33:29 +08:00
parent f3b9ae071c
commit 3971666881
@@ -10,6 +10,7 @@
@cancel="handleCancel"> @cancel="handleCancel">
<div class="modal-content"> <div class="modal-content">
<a-spin :spinning="topLoading">
<a-input-search style="margin-bottom: 1px" :placeholder="$t('pleaseEnter') + $t('treeSelection.primaryNodeName')" @search="onSearch" /> <a-input-search style="margin-bottom: 1px" :placeholder="$t('pleaseEnter') + $t('treeSelection.primaryNodeName')" @search="onSearch" />
<a-tree <a-tree
ref="tree" ref="tree"
@@ -34,9 +35,11 @@
<span v-else>{{ dataRef[replaceFields.title] }}</span> <span v-else>{{ dataRef[replaceFields.title] }}</span>
</template> </template>
</a-tree> </a-tree>
</a-spin>
</div> </div>
<p class="modal-content-title">{{ $t('treeSelection.selectedData') }}</p> <p class="modal-content-title">{{ $t('treeSelection.selectedData') }}</p>
<a-spin :spinning="bottomLoading">
<div v-if="dataSourceRight && dataSourceRight.length > 0" class="name-content"> <div v-if="dataSourceRight && dataSourceRight.length > 0" class="name-content">
<div v-for="(item, index) in dataSourceRight" :key="item[replaceFields.key]" class="name-div"> <div v-for="(item, index) in dataSourceRight" :key="item[replaceFields.key]" class="name-div">
{{ item[replaceFields.title] }} {{ item[replaceFields.title] }}
@@ -44,6 +47,7 @@
</div> </div>
</div> </div>
<a-empty v-else /> <a-empty v-else />
</a-spin>
<!--底部父子关联操作和确认取消按钮--> <!--底部父子关联操作和确认取消按钮-->
<template slot="footer" v-if="treeOpera && checkable"> <template slot="footer" v-if="treeOpera && checkable">
@@ -162,6 +166,8 @@ export default {
width: 800, width: 800,
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
topLoading: false,
bottomLoading: false,
parentChildRelate: true, // 父子节点是否关联 parentChildRelate: true, // 父子节点是否关联
autoExpandParent: false, // 是否自动展开父节点 autoExpandParent: false, // 是否自动展开父节点
treeData: [], treeData: [],
@@ -324,7 +330,7 @@ export default {
if (node.dataRef.children) { if (node.dataRef.children) {
return return
} }
this.confirmLoading = true this.topLoading = true
const params = {} const params = {}
params.dictId = this.dictId params.dictId = this.dictId
// 查询条件的名称 // 查询条件的名称
@@ -338,7 +344,7 @@ export default {
node.dataRef[this.replaceFields.children] = res.result.record || res.result node.dataRef[this.replaceFields.children] = res.result.record || res.result
} }
}).finally(() => { }).finally(() => {
this.confirmLoading = false this.topLoading = false
}) })
}, },
handleCancel () { handleCancel () {
@@ -378,7 +384,7 @@ export default {
} }
}, },
getTreeData () { getTreeData () {
this.confirmLoading = true this.topLoading = true
const params = {} const params = {}
params.dictId = this.dictId params.dictId = this.dictId
getAction(this.optionsHref, params).then(res => { getAction(this.optionsHref, params).then(res => {
@@ -386,7 +392,7 @@ export default {
this.treeData = res.result.records || res.result this.treeData = res.result.records || res.result
} }
}).finally(() => { }).finally(() => {
this.confirmLoading = false this.topLoading = false
}) })
}, },
// 已选数据列表的删除 // 已选数据列表的删除
@@ -411,6 +417,7 @@ export default {
this.close() this.close()
}, },
getSelectedList (codes) { getSelectedList (codes) {
this.bottomLoading = true
const params = { const params = {
selectNodeCodes: codes, selectNodeCodes: codes,
dictId: this.dictId dictId: this.dictId
@@ -429,6 +436,8 @@ export default {
if (res.success) { if (res.success) {
this.dataSourceRight = JSON.parse(JSON.stringify(res.result)) this.dataSourceRight = JSON.parse(JSON.stringify(res.result))
} }
}).finally(() => {
this.bottomLoading = false
}) })
} }
} }