feat: 新增企业客户列表页
parent
6c35fbebdd
commit
3e3a2097a3
|
|
@ -0,0 +1,105 @@
|
||||||
|
<!-- src/views/customer/enterprise/EnterpriseList.vue -->
|
||||||
|
<template>
|
||||||
|
<div class="enterprise-customer-list-page">
|
||||||
|
<ProTable
|
||||||
|
:columns="columns"
|
||||||
|
:fetch-data="loadList"
|
||||||
|
:row-selection="false"
|
||||||
|
:initial-search="{ enterpriseName: '', businessLicense: '', mobilePhone: '' }"
|
||||||
|
>
|
||||||
|
<template #search="{ form }">
|
||||||
|
<a-form-item label="企业名称">
|
||||||
|
<a-input v-model:value="form.enterpriseName" placeholder="请输入企业名称" allow-clear style="width: 180px" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="营业执照号">
|
||||||
|
<a-input v-model:value="form.businessLicense" placeholder="请输入营业执照号" allow-clear style="width: 200px" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="手机号码">
|
||||||
|
<a-input v-model:value="form.mobilePhone" placeholder="请输入手机号码" allow-clear style="width: 160px" />
|
||||||
|
</a-form-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #actions>
|
||||||
|
<a-button v-permission="'customer-enterprise:add'" type="primary" @click="goCreate">
|
||||||
|
<PlusOutlined /> 新增
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.dataIndex === 'index'">{{ index + 1 }}</template>
|
||||||
|
<template v-else-if="column.dataIndex === 'organizationName'">
|
||||||
|
{{ orgNameMap[record.organizationId] || record.organizationId }}
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.dataIndex === 'ocrStatus'">
|
||||||
|
<StatusTag :value="record.ocrStatus" :map="ocrStatusMap" />
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.dataIndex === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="goDetail(record)">查看</a>
|
||||||
|
<a v-permission="'customer-enterprise:edit'" @click="goEdit(record)">编辑</a>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||||
|
import ProTable from '@/components/ProTable.vue'
|
||||||
|
import StatusTag from '@/components/StatusTag.vue'
|
||||||
|
import { fetchEnterpriseCustomerPageApi } from '@/api/customer'
|
||||||
|
import { fetchOrgListAllApi } from '@/api/system'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const orgNameMap = ref({})
|
||||||
|
|
||||||
|
const ocrStatusMap = {
|
||||||
|
PENDING: { text: '待识别', color: 'default' },
|
||||||
|
PROCESSING: { text: '识别中', color: 'blue' },
|
||||||
|
SUCCESS: { text: '识别成功', color: 'green' },
|
||||||
|
FAILED: { text: '识别失败', color: 'red' }
|
||||||
|
}
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{ title: '序号', dataIndex: 'index', width: 60 },
|
||||||
|
{ title: '客户编号', dataIndex: 'enterpriseCode' },
|
||||||
|
{ title: '客户名称', dataIndex: 'enterpriseName' },
|
||||||
|
{ title: '证件号', dataIndex: 'businessLicense' },
|
||||||
|
{ title: '所属机构', dataIndex: 'organizationName' },
|
||||||
|
{ title: '资料状态', dataIndex: 'ocrStatus' },
|
||||||
|
{ title: '创建时间', dataIndex: 'createTime' },
|
||||||
|
{ title: '操作', dataIndex: 'action', width: 140 }
|
||||||
|
]
|
||||||
|
|
||||||
|
async function loadOrgNameMap() {
|
||||||
|
const res = await fetchOrgListAllApi()
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
orgNameMap.value = Object.fromEntries((res.data.data || []).map((o) => [o.id, o.organizationName]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(loadOrgNameMap)
|
||||||
|
|
||||||
|
async function loadList(params) {
|
||||||
|
const res = await fetchEnterpriseCustomerPageApi(params)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
return { list: res.data.data.records || [], total: res.data.data.total || 0 }
|
||||||
|
}
|
||||||
|
return { list: [], total: 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
function goCreate() {
|
||||||
|
router.push({ path: '/customer/enterprise/create' })
|
||||||
|
}
|
||||||
|
|
||||||
|
function goEdit(record) {
|
||||||
|
router.push({ path: '/customer/enterprise/edit', query: { id: record.id } })
|
||||||
|
}
|
||||||
|
|
||||||
|
function goDetail(record) {
|
||||||
|
router.push({ path: '/customer/enterprise/detail', query: { id: record.id } })
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue