feat: 新增个人客户选择弹窗组件

main
halo 2026-07-09 21:38:59 +08:00
parent 9941449afb
commit e19b1fe0f0
1 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,68 @@
<!-- src/components/PersonalCustomerPicker.vue -->
<template>
<a-modal v-model:open="open" title="选择个人客户" width="800px" :footer="null">
<ProTable
:columns="columns"
:fetch-data="loadList"
:row-selection="false"
:initial-search="{ organizationIdEq: undefined, customerCodeEq: '', customerNameLike: '' }"
>
<template #search="{ form }">
<a-form-item label="所属机构">
<OrgTreeSelect v-model="form.organizationIdEq" style="width: 180px" />
</a-form-item>
<a-form-item label="客户编号">
<a-input v-model:value="form.customerCodeEq" placeholder="请输入客户编号" allow-clear style="width: 160px" />
</a-form-item>
<a-form-item label="客户名称">
<a-input v-model:value="form.customerNameLike" placeholder="请输入客户名称" allow-clear style="width: 160px" />
</a-form-item>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'index'">{{ index + 1 }}</template>
<template v-else-if="column.dataIndex === 'action'">
<a @click="handleSelect(record)"></a>
</template>
</template>
</ProTable>
</a-modal>
</template>
<script setup>
import { ref } from 'vue'
import ProTable from '@/components/ProTable.vue'
import OrgTreeSelect from '@/components/OrgTreeSelect.vue'
import { fetchPersonalCustomerListApi } from '@/api/customer'
const emit = defineEmits(['select'])
const open = ref(false)
const columns = [
{ title: '序号', dataIndex: 'index', width: 60 },
{ title: '客户编号', dataIndex: 'customerCode' },
{ title: '客户名称', dataIndex: 'customerName' },
{ title: '证件号码', dataIndex: 'certificateNumber' },
{ title: '手机号码', dataIndex: 'mobilePhone' },
{ title: '操作', dataIndex: 'action', width: 80 }
]
async function loadList(params) {
const res = await fetchPersonalCustomerListApi(params)
if (res.data.code === 200) {
return { list: res.data.data.records || [], total: res.data.data.total || 0 }
}
return { list: [], total: 0 }
}
function handleSelect(record) {
emit('select', record)
open.value = false
}
function show() {
open.value = true
}
defineExpose({ show })
</script>