|
|
@@ -9,7 +9,7 @@
|
|
|
|
|
|
<template>
|
|
|
<div class="sc-tree-select">
|
|
|
- <el-tree-select v-model="defaultValue" :props="defaultProps" lazy :load="loadNode" :cache-data="cacheData" v-bind="$attrs" @node-click="nodeClick"></el-tree-select>
|
|
|
+ <el-tree-select v-model="defaultValue" :props="defaultProps" filterable default-expand-all lazy :load="loadNode" v-bind="$attrs" @node-click="nodeClick"></el-tree-select>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -31,7 +31,6 @@
|
|
|
return {
|
|
|
defaultValue: null,
|
|
|
treeList: [],
|
|
|
- cacheData: [],
|
|
|
defaultProps: {
|
|
|
label: config.props.label,
|
|
|
value: config.props.value,
|
|
|
@@ -43,7 +42,6 @@
|
|
|
watch: {
|
|
|
modelValue(val) {
|
|
|
this.defaultValue = val;
|
|
|
- this.cacheData = this.treeList.filter(t => t[this.defaultProps.value] == this.modelValue);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -57,11 +55,14 @@
|
|
|
async loadNode({ level, data }, resolve) {
|
|
|
if (this.apiObj) {
|
|
|
if (level == 0) {
|
|
|
- const res = await this.apiObj[this.apiKey]();
|
|
|
+ const params = this.isAllDept && { deptType: "控股公司" } || {};
|
|
|
+ const res = await this.apiObj[this.apiKey](params);
|
|
|
this.treeList = config.parseData(res) || [];
|
|
|
- this.cacheData = this.treeList.filter(t => t[this.defaultProps.value] == this.modelValue);
|
|
|
- if (this.isDept && !this.isAllDept) resolve(this.treeList.filter(t => t.deptId == this.$TOOL.data.get("USER_INFO").deptId));
|
|
|
- else resolve(this.treeList.filter(t => t.pid == 0));
|
|
|
+
|
|
|
+ if (this.isDept) {
|
|
|
+ if (this.isAllDept) resolve(this.treeList.filter(t => t.pid == 1));
|
|
|
+ else resolve(this.treeList.filter(t => t.deptId == this.$TOOL.data.get("USER_INFO").deptId));
|
|
|
+ } else resolve(this.treeList.filter(t => t.pid == 0));
|
|
|
this.$emit("finished");
|
|
|
} else resolve(this.treeList.filter(t => t.pid == data[this.defaultProps.value]));
|
|
|
} else resolve([]);
|