修改维修工单选择客户时的搜索功能

This commit is contained in:
xiaofajia 2024-10-31 14:06:03 +08:00
parent 2197c2a78e
commit af2c3f27ea

View File

@ -1,5 +1,5 @@
<template> <template>
<el-select v-model="userSelected" clearable filterable > <el-select v-model="userSelected" clearable filterable :filter-method="handleQuery">
<el-option v-for="user in userList" :key="user.id" :label="user.cusName + ' ' + user.phoneNumber" :value="user.id"/> <el-option v-for="user in userList" :key="user.id" :label="user.cusName + ' ' + user.phoneNumber" :value="user.id"/>
</el-select> </el-select>
</template> </template>
@ -26,7 +26,9 @@ export default {
userSelected: undefined, userSelected: undefined,
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10,
cusName: null,
phoneNumber: null,
}, },
total: 0 total: 0
} }
@ -61,6 +63,14 @@ export default {
const res = await getCustomerMainPage(this.queryParams) const res = await getCustomerMainPage(this.queryParams)
this.userList = res.data.records this.userList = res.data.records
this.total = res.data.total this.total = res.data.total
},
handleQuery(data) {
if (/^\d+$/.test(data)) {
this.queryParams.phoneNumber = data
} else {
this.queryParams.cusName = data
}
this.listCustomer()
} }
} }
} }