|
|
@@ -50,7 +50,7 @@
|
|
|
:props="defaultProps"
|
|
|
node-key="id"
|
|
|
show-checkbox
|
|
|
- check-strictly
|
|
|
+ :check-strictly="true"
|
|
|
:expand-on-click-node="false"
|
|
|
:default-checked-keys="nodes"
|
|
|
@node-click="handleNodeClick"
|
|
|
@@ -80,6 +80,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ //是否取消关联父子级
|
|
|
+ strictly: true,
|
|
|
//清除图标
|
|
|
showClearable: false,
|
|
|
//弹窗显示
|
|
|
@@ -117,10 +119,19 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
+ checked: {
|
|
|
+ handler(v) {
|
|
|
+ if (v) {
|
|
|
+ this.strictly = false;
|
|
|
+ } else {
|
|
|
+ this.strictly = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
// queryForm: {
|
|
|
// deep: true,
|
|
|
// handler(n, o) {
|
|
|
-
|
|
|
+
|
|
|
// if(!n.value&&!n.type){
|
|
|
// this.$refs.tree.filter({});
|
|
|
// }else{
|
|
|
@@ -146,8 +157,8 @@ export default {
|
|
|
this.$emit("selectNode", JSON.stringify(this.sNodeList));
|
|
|
},
|
|
|
//筛选条件变化
|
|
|
- serchTreeHandler(){
|
|
|
- this.$refs.tree.filter(this.queryForm)
|
|
|
+ serchTreeHandler() {
|
|
|
+ this.$refs.tree.filter(this.queryForm);
|
|
|
},
|
|
|
/** 查询机构树 */
|
|
|
getDeptTree() {
|
|
|
@@ -155,10 +166,12 @@ export default {
|
|
|
this.orgTree = response.data;
|
|
|
});
|
|
|
},
|
|
|
- filterNode(value,data,node){
|
|
|
-
|
|
|
+ filterNode(value, data, node) {
|
|
|
if (this.queryForm.value && this.queryForm.type) {
|
|
|
- return data.name.indexOf(this.queryForm.value) !== -1 && data.type == this.queryForm.type;
|
|
|
+ return (
|
|
|
+ data.name.indexOf(this.queryForm.value) !== -1 &&
|
|
|
+ data.type == this.queryForm.type
|
|
|
+ );
|
|
|
}
|
|
|
if (this.queryForm.value) {
|
|
|
return data.name.indexOf(this.queryForm.value) !== -1;
|
|
|
@@ -166,14 +179,33 @@ export default {
|
|
|
if (this.queryForm.type) {
|
|
|
return data.type == this.queryForm.type;
|
|
|
}
|
|
|
- return true
|
|
|
+ return true;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
handleNodeClick() {},
|
|
|
onCheck(data, checked, tree) {
|
|
|
-
|
|
|
- this.sNodeList = this.$refs.tree.getCheckedNodes();
|
|
|
- this.$emit("selectNode", JSON.stringify(this.sNodeList));
|
|
|
+ if (this.checked) {
|
|
|
+ //当前按过滤机构类型勾选
|
|
|
+
|
|
|
+ //递归查询
|
|
|
+ this.recursionTreeHandler(this.queryForm.type, [data]);
|
|
|
+ }
|
|
|
+ // debugger;
|
|
|
+ // this.sNodeList = this.$refs.tree.getCheckedNodes();
|
|
|
+ // this.$emit("selectNode", JSON.stringify(this.sNodeList));
|
|
|
+ },
|
|
|
+ recursionTreeHandler(type, tree) {
|
|
|
+ tree.forEach((item) => {
|
|
|
+ if (type == item.type) {
|
|
|
+ this.$refs.tree.setCheckedKeys([item.id])
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (tree.children && tree.children.length > 0) {
|
|
|
+ this.recursionTreeHandler(type,tree.children)
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
+ }
|
|
|
},
|
|
|
getSubOrgIdsByOrgType(topOrg, orgType, orgIdList) {
|
|
|
if (!topOrg) return;
|