CN-1642 fix: 修复新增report时,切换category后输入params,再切换category搜索params不生效的问题

This commit is contained in:
刘洪洪
2024-04-30 15:49:42 +08:00
parent 0bb8233140
commit 82a31fe3da

View File

@@ -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)
}
}
}