|
@@ -4,7 +4,7 @@
|
|
|
@Date: 2021-08-02 13:49
|
|
|
-->
|
|
|
<template>
|
|
|
- <!-- :loading="loading" -->
|
|
|
+ <!-- :loading="loading" -->
|
|
|
|
|
|
<el-select
|
|
|
ref="reference"
|
|
@@ -13,6 +13,7 @@
|
|
|
v-bind="$attrs"
|
|
|
v-on="$listeners"
|
|
|
@filter-org="handleFilterOrg"
|
|
|
+ @clearSelect="handleClearSelect"
|
|
|
:placeholder="placeholder"
|
|
|
:filterable="true"
|
|
|
:options="treeData"
|
|
@@ -65,11 +66,15 @@ export default {
|
|
|
},
|
|
|
apiName: {
|
|
|
type: String,
|
|
|
- default: 'getTree'
|
|
|
+ default: 'getOrgTree'
|
|
|
},
|
|
|
placeholder: {
|
|
|
type: String,
|
|
|
default: '请选择所属单位'
|
|
|
+ },
|
|
|
+ // 目前所知道的值有:APP, 0
|
|
|
+ type: {
|
|
|
+ type: String
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -117,7 +122,8 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
handleNodeClick(data, node, tree) {
|
|
|
- // debugger
|
|
|
+ this.$emit('orgTreeValue', data[this.nodeKey]);
|
|
|
+ this.$emit('orgTreeNode', data);
|
|
|
},
|
|
|
loadNode(node, resolve) {
|
|
|
// debugger
|
|
@@ -126,7 +132,7 @@ export default {
|
|
|
// 组织机构
|
|
|
getTree(id, resolve) {
|
|
|
const { params, apiName } = this;
|
|
|
- commonApi[apiName]({ id, ...params })
|
|
|
+ commonApi[apiName]({ id, type: this.type })
|
|
|
.then((res) => {
|
|
|
// 就为了存根节点, 用于刷新
|
|
|
return resolve(res || []);
|
|
@@ -156,12 +162,18 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ handleClearSelect() {
|
|
|
+ this.treeValue = '';
|
|
|
+ this.$refs.tree.setCurrentKey(null);
|
|
|
+ this.$refs.tree.setRadioKeys([]);
|
|
|
+ },
|
|
|
handleScrollToBottom() {
|
|
|
if (!this.lazy && !this.isLast) {
|
|
|
this.searchForm.pageNum++;
|
|
|
this.getSearchTree();
|
|
|
}
|
|
|
},
|
|
|
+ // 查询
|
|
|
getSearchTree() {
|
|
|
this.loading = true;
|
|
|
commonApi.treeMatch(this.searchForm).then((res) => {
|
|
@@ -180,8 +192,7 @@ export default {
|
|
|
this.isLast = this.treeData.length == totalElements;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
- },
|
|
|
- handleFilter(val, data) {}
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|