| | |
| | | return { |
| | | dateTime: null, |
| | | dateTime2: null, |
| | | province: null, |
| | | city: null, |
| | | area: null, |
| | | classifyId: null, |
| | | content: "", |
| | | dateTxt: "", |
| | |
| | | |
| | | // 城市选择变化 |
| | | handleCityChange(value) { |
| | | // 重置所有地区字段 |
| | | this.province = null; |
| | | this.city = null; |
| | | this.area = null; |
| | | |
| | | if (value && value.length > 0) { |
| | | // 取最后一级作为城市 |
| | | this.city = value[value.length - 1]; |
| | | } else { |
| | | this.city = null; |
| | | // 根据选择的级别,设置对应的字段 |
| | | if (value.length === 1) { |
| | | // 只选择了省份 |
| | | this.province = value[0]; |
| | | } else if (value.length === 2) { |
| | | // 选择了省份和城市 |
| | | this.province = value[0]; |
| | | this.city = value[1]; |
| | | } else if (value.length === 3) { |
| | | // 选择了省份、城市和区县 |
| | | this.province = value[0]; |
| | | this.city = value[1]; |
| | | this.area = value[2]; |
| | | } |
| | | } |
| | | this.handleSearch(); |
| | | }, |
| | |
| | | pageSize: this.pageSize, |
| | | }; |
| | | |
| | | // 添加筛选条件 |
| | | // 添加筛选条件 - 根据选择的级别传递对应的参数 |
| | | if (this.province) { |
| | | params.province = this.province; |
| | | } |
| | | if (this.city) { |
| | | params.city = this.city; |
| | | } |
| | | if (this.area) { |
| | | params.area = this.area; |
| | | } |
| | | if (this.classifyId) { |
| | | params.classifyId = this.classifyId; |
| | |
| | | // 清除城市选择 |
| | | handleClearCity() { |
| | | this.cascaderValue = []; |
| | | this.province = null; |
| | | this.city = null; |
| | | this.area = null; |
| | | this.handleSearch(); |
| | | }, |
| | | |