[update] 树选择增加loading
This commit is contained in:
@@ -10,40 +10,44 @@
|
|||||||
@cancel="handleCancel">
|
@cancel="handleCancel">
|
||||||
|
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<a-input-search style="margin-bottom: 1px" :placeholder="$t('pleaseEnter') + $t('treeSelection.primaryNodeName')" @search="onSearch" />
|
<a-spin :spinning="topLoading">
|
||||||
<a-tree
|
<a-input-search style="margin-bottom: 1px" :placeholder="$t('pleaseEnter') + $t('treeSelection.primaryNodeName')" @search="onSearch" />
|
||||||
ref="tree"
|
<a-tree
|
||||||
:checkable="checkable"
|
ref="tree"
|
||||||
:checkStrictly="true"
|
:checkable="checkable"
|
||||||
:replaceFields="replaceFields"
|
:checkStrictly="true"
|
||||||
:class="treeScreenClass"
|
:replaceFields="replaceFields"
|
||||||
:treeData="treeData"
|
:class="treeScreenClass"
|
||||||
:autoExpandParent="autoExpandParent"
|
:treeData="treeData"
|
||||||
@check="onCheck"
|
:autoExpandParent="autoExpandParent"
|
||||||
@select="onSelect"
|
@check="onCheck"
|
||||||
@expand="onExpand"
|
@select="onSelect"
|
||||||
:loadData="loadData"
|
@expand="onExpand"
|
||||||
:expandedKeys="expandedKeys"
|
:loadData="loadData"
|
||||||
:checkedKeys="checkedKeys"
|
:expandedKeys="expandedKeys"
|
||||||
:selectedKeys.sync="selectedKeys">
|
:checkedKeys="checkedKeys"
|
||||||
|
:selectedKeys.sync="selectedKeys">
|
||||||
|
|
||||||
<template slot="title" slot-scope="{dataRef}">
|
<template slot="title" slot-scope="{dataRef}">
|
||||||
<span v-if="searchValue && dataRef[replaceFields.title].indexOf(searchValue) > -1">
|
<span v-if="searchValue && dataRef[replaceFields.title].indexOf(searchValue) > -1">
|
||||||
<span style="color: #f50">{{ dataRef[replaceFields.title] }}</span>
|
<span style="color: #f50">{{ dataRef[replaceFields.title] }}</span>
|
||||||
</span>
|
</span>
|
||||||
<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>
|
||||||
<div v-if="dataSourceRight && dataSourceRight.length > 0" class="name-content">
|
<a-spin :spinning="bottomLoading">
|
||||||
<div v-for="(item, index) in dataSourceRight" :key="item[replaceFields.key]" class="name-div">
|
<div v-if="dataSourceRight && dataSourceRight.length > 0" class="name-content">
|
||||||
{{ item[replaceFields.title] }}
|
<div v-for="(item, index) in dataSourceRight" :key="item[replaceFields.key]" class="name-div">
|
||||||
<a-icon type="close" @click="handleDelete(item, index)" />
|
{{ item[replaceFields.title] }}
|
||||||
|
<a-icon type="close" @click="handleDelete(item, index)" />
|
||||||
|
</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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user