|
@@ -61,14 +61,18 @@ export default {
|
|
|
// },//过滤使用字段
|
|
|
// dataRes: [],
|
|
|
checkedData: {},//当前点击的数据
|
|
|
+ num: '',//判断是多选还是单选
|
|
|
|
|
|
+ valued: [],
|
|
|
+ Informationed: [],
|
|
|
|
|
|
Information: '',
|
|
|
+ value: '',
|
|
|
|
|
|
|
|
|
id: '',
|
|
|
positionInformation: [],
|
|
|
- value: '',
|
|
|
+
|
|
|
|
|
|
|
|
|
tenantsTree: [],
|
|
@@ -84,36 +88,86 @@ export default {
|
|
|
/** 控制树形单选 */
|
|
|
checkChange (data, checked) {
|
|
|
this.checkedData = {}
|
|
|
- if (checked) {
|
|
|
- if (!!data.children && data.children.length > 0) {
|
|
|
- console.log("有子节点不可选")
|
|
|
+
|
|
|
+ if (this.num != 1) {
|
|
|
+ debugger
|
|
|
+ if (checked) {
|
|
|
+ if (!!data.children && data.children.length > 0) {
|
|
|
+ console.log("有子节点不可选")
|
|
|
+ } else {
|
|
|
+ this.checkedData = data;
|
|
|
+ debugger
|
|
|
+ this.valued.push(Number(this.checkedData.value));
|
|
|
+ this.Informationed.push(this.checkedData.name);
|
|
|
+ }
|
|
|
} else {
|
|
|
- // checked.disabled = !checked.disabled;
|
|
|
- this.$refs.tenantstree.setCheckedKeys([data.value], true);
|
|
|
- this.checkedData = data;
|
|
|
- this.value = this.checkedData.value;
|
|
|
- // console.log("checked data", data, this.checkedData)
|
|
|
- this.Information = this.checkedData.name
|
|
|
+ for (let i = 0; i < this.valued.length; i++) {
|
|
|
+ if (data.value == this.valued[i]) {
|
|
|
+ this.valued.splice(i + 1, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let k = 0; k < this.Informationed.length; k++) {
|
|
|
+ if (data.name == this.Informationed[k]) {
|
|
|
+ this.Informationed.splice(k + 1, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ debugger
|
|
|
+ if (checked) {
|
|
|
+ if (!!data.children && data.children.length > 0) {
|
|
|
+ console.log("有子节点不可选")
|
|
|
+ } else {
|
|
|
+ this.$refs.tenantstree.setCheckedKeys([data.value], true);
|
|
|
+ this.checkedData = data;
|
|
|
+ this.value = this.checkedData.value;
|
|
|
+ this.Information = this.checkedData.name
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ // if (checked) {
|
|
|
+ // if (!!data.children && data.children.length > 0) {
|
|
|
+ // console.log("有子节点不可选")
|
|
|
+ // } else {
|
|
|
+ // // checked.disabled = !checked.disabled;
|
|
|
+ // // this.$refs.tenantstree.setCheckedKeys([data.value]);
|
|
|
+ // this.checkedData = data;
|
|
|
+ // // this.value = this.checkedData.value;
|
|
|
+ // // console.log("checked data", data, this.checkedData)
|
|
|
+ // // this.Information = this.checkedData.name
|
|
|
+ // this.value.push(this.checkedData.value);
|
|
|
+ // this.Information.push(this.checkedData.name);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
submit () {
|
|
|
- if (this.Information != undefined) {
|
|
|
+ debugger
|
|
|
+ if (this.num == 1) {
|
|
|
this.positionInformation.push({ positionInformation: this.Information, id: this.id, value: this.value });
|
|
|
- this.params.callback(this.positionInformation);
|
|
|
- this.$emit('close');
|
|
|
} else {
|
|
|
- this.$message('请重新选择车位号');
|
|
|
+ this.positionInformation.push({ positionInformation: this.Informationed, id: this.id, value: this.valued });
|
|
|
}
|
|
|
+ // this.positionInformation.push({ positionInformation: this.Information, id: this.id, value: this.value });
|
|
|
+ this.params.callback(this.positionInformation);
|
|
|
+ this.$emit('close');
|
|
|
+
|
|
|
|
|
|
},
|
|
|
|
|
|
filterTreeData (trData) {
|
|
|
- debugger
|
|
|
trData.map((item, index) => {
|
|
|
if (this.isNotEmpty(item.children)) {
|
|
|
item.disabled = true;
|
|
@@ -127,7 +181,6 @@ export default {
|
|
|
return arr && Array.isArray(arr) && arr.length > 0;
|
|
|
},
|
|
|
thisCheck (ev, node, data) {
|
|
|
- debugger
|
|
|
if (!data.disabled) {
|
|
|
node.checked = node.checked;
|
|
|
}
|
|
@@ -145,11 +198,26 @@ export default {
|
|
|
this.garage();
|
|
|
this.id = this.params.id;
|
|
|
console.log(this.id);
|
|
|
- this.Information = this.params.positionInformation;
|
|
|
- this.value = this.params.value;
|
|
|
+ // this.Information = this.params.positionInformation;
|
|
|
+ // this.value = this.params.value;
|
|
|
// 显示
|
|
|
- this.defaultcheckedkeys = [this.params.value]
|
|
|
|
|
|
+ debugger
|
|
|
+ this.num = this.params.count
|
|
|
+ if (this.num == 1) {
|
|
|
+ this.Information = this.params.positionInformation;
|
|
|
+ this.value = this.params.value;
|
|
|
+ this.defaultcheckedkeys = [this.params.value];
|
|
|
+ } else {
|
|
|
+ debugger
|
|
|
+ if (this.params.positionInformation != '') {
|
|
|
+ let positionInformation = (this.params.positionInformation).split(',')
|
|
|
+ this.Informationed = positionInformation;
|
|
|
+ this.valued = this.params.value;
|
|
|
+ this.defaultcheckedkeys = this.params.value;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|