From 0ee8a10229422134010f2dd41523e2d8c3c54cef Mon Sep 17 00:00:00 2001 From: timorls <318739742@qq.com> Date: Wed, 17 Aug 2022 20:43:04 +0800 Subject: [PATCH] mode --- .../content/modelManager/setting/create.vue | 37 +++++++++++++------ .../modelManager/setting/filterManager.vue | 2 +- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/view/home/content/modelManager/setting/create.vue b/src/view/home/content/modelManager/setting/create.vue index 9d227b1..3d404d6 100644 --- a/src/view/home/content/modelManager/setting/create.vue +++ b/src/view/home/content/modelManager/setting/create.vue @@ -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; " > @@ -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; " > @@ -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) " > @@ -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++) { diff --git a/src/view/home/content/modelManager/setting/filterManager.vue b/src/view/home/content/modelManager/setting/filterManager.vue index 263c2c1..cd5bee1 100644 --- a/src/view/home/content/modelManager/setting/filterManager.vue +++ b/src/view/home/content/modelManager/setting/filterManager.vue @@ -120,7 +120,7 @@ export default { }, view(val) { - this.form = val; + this.form = JSON.parse(JSON.stringify(val)); this.visible = true; this.isCreate = false; },