let area=this.arealist.filter(v=>v.areaNo==this.current); console.log(area); console.log(this.arealist); console.log(this.current); let single=this.singlelist.filter(v=>v.singleNo==this.current); console.log(single); let work=this.workingProcedureList.filter(v=>v.procedureNo==this.current); console.log(work); let team=this.teamlist.filter(v=>v.teamNo==this.current); console.log(team); let line=this.productLineList.filter(v=>v.productLineNo==this.current); console.log(line); let project=this.projectlist.filter(v=>v.projectNo==this.current); console.log(project); if(area>-1){ this.handleSearch({'areaNo':this.current},'1') }else if(single>-1){ this.handleSearch({'singleNo':this.current},'1') }else if(work>-1){ this.handleSearch({'outProcedureNo':this.current},'1') }else if(team>-1){ this.handleSearch({'teamNo':this.current},'1') }else if(line>-1){ this.handleSearch({'productLineNo':this.current},'1') }else if(project>-1){ this.handleSearch({'projectNo':this.current},'1') } this.$refs.popup.close() this.current='' 变成多选
时间: 2024-01-21 17:18:27 浏览: 82
如果要将这段代码改为多选,你需要在弹出框中添加复选框或多选框,并将选择的值存储在一个数组中。例如,你可以将变量`current`改为`selected`,并将其初始化为空数组`[]`。然后,将选中的值添加到`selected`数组中,而不是将其赋值给`current`变量。最后,在 `if` 语句中使用 `includes()` 函数来判断选中的值是否在相应的列表中。
以下是修改后的代码示例:
```
// 初始化为一个空数组
selected: [],
// 处理选择事件
handleSelect(value) {
// 判断当前值是否已经选中,如果没有则添加到 selected 数组中
if (!this.selected.includes(value)) {
this.selected.push(value);
}
},
// 处理搜索事件
handleSearch() {
let area = this.arealist.filter(v => this.selected.includes(v.areaNo));
console.log(area);
let single = this.singlelist.filter(v => this.selected.includes(v.singleNo));
console.log(single);
let work = this.workingProcedureList.filter(v => this.selected.includes(v.procedureNo));
console.log(work);
let team = this.teamlist.filter(v => this.selected.includes(v.teamNo));
console.log(team);
let line = this.productLineList.filter(v => this.selected.includes(v.productLineNo));
console.log(line);
let project = this.projectlist.filter(v => this.selected.includes(v.projectNo));
console.log(project);
// ...
}
```
阅读全文
相关推荐



















