diff options
| author | 刘洪洪 <[email protected]> | 2024-04-30 15:49:42 +0800 |
|---|---|---|
| committer | 刘洪洪 <[email protected]> | 2024-04-30 15:49:42 +0800 |
| commit | 82a31fe3da000a476cbfa9ea74b3582e17ccf150 (patch) | |
| tree | 5d6b4c34ee1fd8e26e927f38e19edaf6811f9360 | |
| parent | 0bb8233140ef8a3c236b434b2e4278cd5022d678 (diff) | |
CN-1642 fix: 修复新增report时,切换category后输入params,再切换category搜索params不生效的问题
| -rw-r--r-- | src/components/rightBox/report/ReportBox.vue | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/components/rightBox/report/ReportBox.vue b/src/components/rightBox/report/ReportBox.vue index 3298bec7..96801168 100644 --- a/src/components/rightBox/report/ReportBox.vue +++ b/src/components/rightBox/report/ReportBox.vue @@ -546,6 +546,7 @@ export default { loadParamOptions () { if (_.isArray(this.editObject.categoryParams) && !_.isEmpty(this.editObject.categoryParams)) { this.editObject.categoryParams.forEach(param => { + this.paramsOptions = _.cloneDeep(this.newParamsOptions) if (!this.paramsOptions.some(p => p.key === param.key)) { axios.get(api.dict, { params: { type: param.key, pageSize: -1 } }).then(response => { if (response.status === 200) { @@ -750,22 +751,20 @@ export default { * @param filterVal */ filterMethod (filterVal) { + const key = this.editObject.categoryParams[0].key if (filterVal) { - if (_.isString(filterVal)) { - const filterArr = _.cloneDeep(this.newParamsOptions[0].options).filter(d => d.toLowerCase().includes(filterVal.toLowerCase())) - this.$nextTick(() => { - this.paramsOptions[0].options = filterArr - }) - } else if (_.isNumber(filterVal)) { - const filterArr = _.cloneDeep(this.newParamsOptions[0].options).filter(d => d.toLowerCase().includes(filterVal)) - this.$nextTick(() => { - this.paramsOptions[0].options = filterArr - }) + const obj = this.newParamsOptions.find(d => d.key === key) + if (_.isString(filterVal) && obj) { + const filterArr = _.cloneDeep(obj.options).filter(d => d.toLowerCase().includes(filterVal.toLowerCase())) + const paramsOptionsObj = this.paramsOptions.find(d => d.key === key) + paramsOptionsObj.options = filterArr + } else if (_.isNumber(filterVal) && obj) { + const filterArr = _.cloneDeep(obj.options).filter(d => d.toLowerCase().includes(filterVal)) + const paramsOptionsObj = this.paramsOptions.find(d => d.key === key) + paramsOptionsObj.options = filterArr } } else { - this.$nextTick(() => { - this.paramsOptions = _.cloneDeep(this.newParamsOptions) - }) + this.paramsOptions = _.cloneDeep(this.newParamsOptions) } } } |
