|
@@ -33,7 +33,7 @@
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- props: ["defaultList", "type", "closeList"],
|
|
|
+ props: ["defaultList", "type", "closeList", "resetList"],
|
|
|
data() {
|
|
|
return {
|
|
|
treeList: [],
|
|
@@ -48,17 +48,29 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
getTree() {
|
|
|
- const info = JSON.parse(sessionStorage.userInfo);
|
|
|
- console.log(info, "JSON.parse(sessionStorage.userInfo)");
|
|
|
- this.treeList = [
|
|
|
- {
|
|
|
- children: [],
|
|
|
- o: info.groupId,
|
|
|
- label: `${info.groupName}`,
|
|
|
- haveUserFlag: "Y",
|
|
|
- ou: `${info.groupName}`,
|
|
|
+ this.loading = true;
|
|
|
+ this.$http({
|
|
|
+ url: "/sysmgr/csysdept/queryAllList",
|
|
|
+ method: "post",
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
},
|
|
|
- ];
|
|
|
+ data: {},
|
|
|
+ }).then((res) => {
|
|
|
+ this.treeList = res.data;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ // const info = JSON.parse(sessionStorage.userInfo);
|
|
|
+ // console.log(info, "JSON.parse(sessionStorage.userInfo)");
|
|
|
+ // this.treeList = [
|
|
|
+ // {
|
|
|
+ // children: [],
|
|
|
+ // o: info.groupId,
|
|
|
+ // label: `${info.groupName}`,
|
|
|
+ // haveUserFlag: "Y",
|
|
|
+ // ou: `${info.groupName}`,
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
},
|
|
|
handleNodeClick(v) {
|
|
|
let s = false;
|
|
@@ -106,22 +118,24 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- handleCheckChange(v) {
|
|
|
- let opt = {
|
|
|
- loginNameStr: v.data.loginNoStr,
|
|
|
- leaderAuditName: v.data.label,
|
|
|
- displayname: v.data.displayname,
|
|
|
- groupId: v.data.o,
|
|
|
- };
|
|
|
- this.$emit("treeCheck", opt);
|
|
|
- for (let i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
|
|
|
- if (v.data.o == this.$refs.tree.store._getAllNodes()[i].data.o) {
|
|
|
- this.$refs.tree.store._getAllNodes()[i].checked = true;
|
|
|
- } else {
|
|
|
- this.$refs.tree.store._getAllNodes()[i].checked = false;
|
|
|
- }
|
|
|
- }
|
|
|
- this.$forceUpdate();
|
|
|
+ handleCheckChange() {
|
|
|
+ const nodeList = this.$refs.tree.store.getCheckedNodes();
|
|
|
+ // let opt = {
|
|
|
+ // loginNameStr: v.data.loginNoStr,
|
|
|
+ // leaderAuditName: v.data.label,
|
|
|
+ // displayname: v.data.displayname,
|
|
|
+ // groupId: v.data.o,
|
|
|
+ // };
|
|
|
+ this.$emit("treeCheck", nodeList);
|
|
|
+ // for (let i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
|
|
|
+ // if (v.data.o == this.$refs.tree.store._getAllNodes()[i].data.o) {
|
|
|
+ // this.$refs.tree.store._getAllNodes()[i].checked = !this.$refs.tree.store._getAllNodes()[i].checked;
|
|
|
+ // }
|
|
|
+ // // else {
|
|
|
+ // // this.$refs.tree.store._getAllNodes()[i].checked = false;
|
|
|
+ // // }
|
|
|
+ // }
|
|
|
+ // this.$forceUpdate();
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
@@ -130,6 +144,7 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
type() {
|
|
|
+ console.log("aaa");
|
|
|
this.defaultListc = this.defaultList;
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
@@ -137,7 +152,14 @@ export default {
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
closeList() {
|
|
|
- this.$refs.tree.setCheckedNodes([]);
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
+ if ([...this.resetList] && [...this.resetList].length > 0) {
|
|
|
+ [...this.resetList].forEach((el) => {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.tree.setChecked(el, true);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|