This commit is contained in:
timorls 2022-08-17 20:43:04 +08:00
parent 024969bd4d
commit 0ee8a10229
2 changed files with 26 additions and 13 deletions

View File

@ -73,10 +73,10 @@
newForm[0].value.length !== 0
? data.filter_range.push({
value: newForm[0].value,
choices: [],
})
: null,
(newForm[0].value = '')
(newForm[0].value = '');
form[0].index = data.filter_range.length - 1;
"
></el-input>
</el-col>
@ -150,10 +150,11 @@
newForm[1].value.length !== 0
? data.filter_range[form[0].index].choices.push({
value: newForm[1].value,
choices: [],
})
: null,
(newForm[1].value = '')
(newForm[1].value = '');
form[1].index =
data.filter_range[form[0].index].choices.length - 1;
"
></el-input>
</el-col>
@ -233,9 +234,13 @@
newForm[2].value.length !== 0
? data.filter_range[form[0].index].choices[
form[1].index
].choices.push({ value: newForm[2].value, choices: [] })
].choices.push({ value: newForm[2].value })
: null,
(newForm[2].value = '')
(newForm[2].value = ''),
(form[2].index =
data.filter_range[form[0].index].choices[
form[1].index
].choices.length-1)
"
></el-input>
</el-col>
@ -309,7 +314,6 @@
form[1].index
].choices[form[2].index].choices.push({
value: newForm[3].value,
choices: [],
})
: null,
(newForm[3].value = '')
@ -356,8 +360,17 @@ export default {
this.form[m].text = "";
}
} else {
for (let m = i + 1; m < 4; m++) {
this.form[m].status = true;
this.checkChoices(val, i + 1);
}
},
checkChoices(val, index) {
if (val && (val[0].choices || val[0].value)) {
this.form[index].status = true;
return this.checkChoices(val[0].choices, index + 1);
} else {
for (let i = index; i < 4; i++) {
this.form[i].status = false;
}
}
},
@ -390,11 +403,11 @@ export default {
checkStatus(newVal) {
if (newVal.filter_range.length !== 0) {
this.form[0].status = true;
if (newVal.filter_range[0].choices.length) {
if (newVal.filter_range[0].choices) {
this.form[1].status = true;
if (newVal.filter_range[0].choices[0].choices.length) {
if (newVal.filter_range[0].choices[0].choices) {
this.form[2].status = true;
if (newVal.filter_range[0].choices[0].choices[0].choices.length) {
if (newVal.filter_range[0].choices[0].choices[0].choices) {
this.form[3].status = true;
} else {
for (let i = 3; i < 4; i++) {

View File

@ -120,7 +120,7 @@ export default {
},
view(val) {
this.form = val;
this.form = JSON.parse(JSON.stringify(val));
this.visible = true;
this.isCreate = false;
},