|
@@ -33,7 +33,7 @@
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- props: ["defaultList", "type", "closeList", "resetList"],
|
|
|
+ props: ["defaultList", "type", "closeList", "resetList", "only"],
|
|
|
data() {
|
|
|
return {
|
|
|
treeList: [],
|
|
@@ -119,23 +119,25 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleCheckChange() {
|
|
|
+ console.log(this.only, "only");
|
|
|
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();
|
|
|
+ if (this.only) {
|
|
|
+ if (nodeList.length === 1) {
|
|
|
+ this.$emit("treeCheck", nodeList);
|
|
|
+ } else if (nodeList.length === 0) {
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
+ this.$emit("treeCheck", nodeList);
|
|
|
+ } else {
|
|
|
+ let obj = { ...nodeList[0] };
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.tree.setChecked(obj, true);
|
|
|
+ });
|
|
|
+ this.$message.error("这里只能选择一个审批人");
|
|
|
+ }
|
|
|
+ } else if (!this.only) {
|
|
|
+ this.$emit("treeCheck", nodeList);
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
@@ -144,7 +146,6 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
type() {
|
|
|
- console.log("aaa");
|
|
|
this.defaultListc = this.defaultList;
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
@@ -152,7 +153,7 @@ export default {
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
closeList() {
|
|
|
- this.$refs.tree.setCheckedKeys([]);
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
if ([...this.resetList] && [...this.resetList].length > 0) {
|
|
|
[...this.resetList].forEach((el) => {
|
|
|
this.$nextTick(() => {
|