Commit 5ea0d8dc authored by 何远江's avatar 何远江

修改客户查询和产品查询条件为模糊查询

parent 1d57f3ea
......@@ -12,7 +12,7 @@
<template #default>
<el-form :model="formState" size="small" inline>
<el-form-item label="客户名称">
<el-input v-model="formState.customerName"></el-input>
<el-input v-model="formState.customerName" clearable ></el-input>
</el-form-item>
<el-form-item>
......@@ -47,10 +47,11 @@
</template>
<script lang="ts">
import { defineComponent, ref, onMounted, reactive, watch } from 'vue'
import { defineComponent, ref, onMounted, reactive, watch, unref } from 'vue'
import { getCustomerPage } from '@/api/customer'
import type { VxeTableInstance } from 'vxe-table'
import { ElMessage } from 'element-plus'
import { queryParamsFilter } from '@/utils/query'
export default defineComponent({
name: 'CustomerModal',
......@@ -90,7 +91,7 @@ export default defineComponent({
const queryCustomer = async () => {
loading.value = true
try {
const { data } = await getCustomerPage(formState)
const { data } = await getCustomerPage(queryParamsFilter(unref(formState)))
tableData.value = data.result.records
formState.total = +data.result.total
} catch {}
......
......@@ -3,10 +3,10 @@
<template #default>
<el-form :model="formState" size="small" inline>
<el-form-item label="产品名称">
<el-input v-model="formState.productName"></el-input>
<el-input v-model="formState.productName" clearable></el-input>
</el-form-item>
<el-form-item label="产品品牌">
<el-select v-model="formState.brandName"> </el-select>
<el-form-item label="产品编码">
<el-input v-model="formState.productCode" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="resetForm">重置</el-button>
......@@ -40,10 +40,11 @@
</template>
<script lang="ts">
import { defineComponent, ref, onMounted, reactive, watch } from 'vue'
import { defineComponent, ref, onMounted, reactive, watch, unref } from 'vue'
import { getProductList } from '@/api/product'
import type { VxeTableInstance } from 'vxe-table'
import { ElMessage } from 'element-plus'
import { queryParamsFilter } from '@/utils/query'
export default defineComponent({
name: 'ProductModal',
......@@ -61,7 +62,7 @@ import { ElMessage } from 'element-plus'
const tableData = ref([])
const formState = reactive({
productName: '',
brandName: '',
productCode: '',
currentPage: 1,
pageSize: 10,
total: 0
......@@ -74,13 +75,14 @@ import { ElMessage } from 'element-plus'
const resetForm = () => {
Object.assign(formState, {
productName: '',
brandName: ''
productCode: ''
})
}
const queryCustomer = async () => {
loading.value = true
try {
const { data } = await getProductList(formState)
const params = queryParamsFilter(unref(formState))
const { data } = await getProductList(params)
tableData.value = data.result.records
formState.total = +data.result.total
} catch {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment