| | |
| | | tableDataArray: { |
| | | handler(newval, oldval) { |
| | | this.tableData = newval; |
| | | this.searchResults=newval |
| | | }, |
| | | }, |
| | | tableHeadFindData: { |
| | |
| | | this.batchImportData.codeClassifyOid = this.codeClassifyOid |
| | | }, |
| | | //输入回车搜索 |
| | | tableFindInp(event) { |
| | | console.log('回车键被按下'); |
| | | console.log(this.WupinFindValue) |
| | | console.log(this.tableData) |
| | | // 在这里执行你的操作 |
| | | // let referList=[] |
| | | // this.tableData.filter(item => { |
| | | // console.log(item.name.includes(this.WupinFindValue)) |
| | | // console.log(item.name.indexOf(this.WupinFindValue)>=0) |
| | | // }) |
| | | // const regex = new RegExp(this.WupinFindValue, 'i'); |
| | | // this.tableData.filter(item => { |
| | | // console.log(regex.test(item.name)) |
| | | // // return regex.test(item.name); |
| | | // }); |
| | | tableFindInp() { |
| | | if (this.WupinFindValue.trim() === '') { |
| | | this.searchResults = []; // 输入值为空,清空搜索结果 |
| | | this.$message.warning('输入值不能为空') |
| | | return; |
| | | } |
| | | |
| | | this.tableData = this.tableData.filter(item => { |
| | | this.tableData = this.searchResults.filter(item => { |
| | | if (typeof item.name === 'string') { |
| | | return item.name.includes(this.WupinFindValue); |
| | | }else { |
| | | return false; // item.name不是字符串类型,返回false |
| | | } |
| | | |
| | | }); |
| | | console.log(this.searchResults); |
| | | |
| | | } |
| | | |
| | | } |