增加台桌搜索功能

This commit is contained in:
YeMingfei666 2024-10-25 18:03:00 +08:00
parent df9a49813a
commit c6fed2af32
2 changed files with 22 additions and 3 deletions

View File

@ -46,7 +46,13 @@
trigger="click" trigger="click"
v-model="tableShow" v-model="tableShow"
> >
<div style="max-height: 398px; overflow-y: scroll"> <el-input
placeholder="请输入内容"
prefix-icon="el-icon-search"
v-model="tableSearchText"
@input="searchInput">
</el-input>
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
<div <div
class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30" class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30"
v-for="(item, index) in tableList" v-for="(item, index) in tableList"
@ -1277,10 +1283,12 @@ import {
isCanBuy, isCanBuy,
arrayContainsAll, arrayContainsAll,
generateCombinations, generateCombinations,
returnReverseVal, returnReverseVal,$strMatch,
returnGiftArr, returnGiftArr,
} from "./util.js"; } from "./util.js";
import { $status } from "@/utils/table.js"; import { $status } from "@/utils/table.js";
let $originTableList=[]
export default { export default {
components: { components: {
returnCart, returnCart,
@ -1296,6 +1304,8 @@ export default {
}, },
data() { data() {
return { return {
//
tableSearchText:"",
// //
canShoukuan: false, canShoukuan: false,
// //
@ -1326,7 +1336,7 @@ export default {
// //
tableQuery: { tableQuery: {
page: 1, page: 1,
size: 20, size: 999,
}, },
tableShow: false, tableShow: false,
status: $status, status: $status,
@ -1820,6 +1830,10 @@ export default {
this.open(this.$route.query.tableId ? this.$route.query : ""); this.open(this.$route.query.tableId ? this.$route.query : "");
}, },
methods: { methods: {
searchInput(e){
console.log(e)
this.tableList=$originTableList.filter(v=>$strMatch(v.name,e.trim()))
},
returnTableColor(key) { returnTableColor(key) {
const item = $status[key]; const item = $status[key];
return item ? item.type : ""; return item ? item.type : "";
@ -2106,6 +2120,7 @@ export default {
this.tableList = content.filter( this.tableList = content.filter(
(v) => v.status != "closed" && v.status != "cleaning" (v) => v.status != "closed" && v.status != "cleaning"
); );
$originTableList=this.tableList
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@ -9,6 +9,10 @@ export function isCanBuy(skuGoods,goods) {
} }
} }
//字符匹配
export function $strMatch(matchStr,str){
return matchStr.toLowerCase().includes(str.toLowerCase())
}
// 一个数组是否包含另外一个数组全部元素 // 一个数组是否包含另外一个数组全部元素
export function arrayContainsAll(arr1, arr2) { export function arrayContainsAll(arr1, arr2) {