crm:联系人增加 ContactList 组件,提供给其它模块内嵌

This commit is contained in:
YunaiV 2023-11-29 21:42:10 +08:00
parent 2cda0cdd9f
commit 7de0e93d5a
7 changed files with 181 additions and 46 deletions

View File

@ -26,32 +26,37 @@ export interface ContactVO {
ownerUserName: string ownerUserName: string
} }
// 查询crm联系人列表 // 查询 CRM 联系人列表
export const getContactPage = async (params) => { export const getContactPage = async (params) => {
return await request.get({ url: `/crm/contact/page`, params }) return await request.get({ url: `/crm/contact/page`, params })
} }
// 查询crm联系人详情 // 查询 CRM 联系人列表,基于指定客户
export const getContactPageByCustomer = async (params: any) => {
return await request.get({ url: `/crm/contact/page-by-customer`, params })
}
// 查询 CRM 联系人详情
export const getContact = async (id: number) => { export const getContact = async (id: number) => {
return await request.get({ url: `/crm/contact/get?id=` + id }) return await request.get({ url: `/crm/contact/get?id=` + id })
} }
// 新增crm联系人 // 新增 CRM 联系人
export const createContact = async (data: ContactVO) => { export const createContact = async (data: ContactVO) => {
return await request.post({ url: `/crm/contact/create`, data }) return await request.post({ url: `/crm/contact/create`, data })
} }
// 修改crm联系人 // 修改 CRM 联系人
export const updateContact = async (data: ContactVO) => { export const updateContact = async (data: ContactVO) => {
return await request.put({ url: `/crm/contact/update`, data }) return await request.put({ url: `/crm/contact/update`, data })
} }
// 删除crm联系人 // 删除 CRM 联系人
export const deleteContact = async (id: number) => { export const deleteContact = async (id: number) => {
return await request.delete({ url: `/crm/contact/delete?id=` + id }) return await request.delete({ url: `/crm/contact/delete?id=` + id })
} }
// 导出crm联系人 Excel // 导出 CRM 联系人 Excel
export const exportContact = async (params) => { export const exportContact = async (params) => {
return await request.download({ url: `/crm/contact/export-excel`, params }) return await request.download({ url: `/crm/contact/export-excel`, params })
} }
@ -59,3 +64,5 @@ export const exportContact = async (params) => {
export const simpleAllList = async () => { export const simpleAllList = async () => {
return await request.get({ url: `/crm/contact/simple-all-list` }) return await request.get({ url: `/crm/contact/simple-all-list` })
} }
//

View File

@ -12,6 +12,14 @@ export interface PermissionVO {
createTime?: Date createTime?: Date
} }
export enum BizTypeEnum {
CRM_LEADS = 1, // 线索
CRM_CUSTOMER = 2, // 客户
CRM_CONTACTS = 3, // 联系人
CRM_BUSINESS = 5, // 商机
CRM_CONTRACT = 6 // 合同
}
// 查询团队成员列表 // 查询团队成员列表
export const getPermissionList = async (params) => { export const getPermissionList = async (params) => {
return await request.get({ url: `/crm/permission/list`, params }) return await request.get({ url: `/crm/permission/list`, params })

View File

@ -15,6 +15,7 @@
</el-button> </el-button>
<el-button type="danger" @click="handleQuit"> 退出团队</el-button> <el-button type="danger" @click="handleQuit"> 退出团队</el-button>
</el-row> </el-row>
<!-- 团队成员展示 --> <!-- 团队成员展示 -->
<el-table <el-table
v-loading="loading" v-loading="loading"

View File

@ -1,5 +1,6 @@
import CrmPermissionList from './CrmPermissionList.vue' import CrmPermissionList from './CrmPermissionList.vue'
// TODO @puhui999迁移到 api/permission/index.ts 里;我已经迁移了一部分哈
enum CrmBizTypeEnum { enum CrmBizTypeEnum {
CRM_LEADS = 1, // 线索 CRM_LEADS = 1, // 线索
CRM_CUSTOMER = 2, // 客户 CRM_CUSTOMER = 2, // 客户

View File

@ -0,0 +1,146 @@
<template>
<!-- 操作栏 -->
<el-row justify="end">
<el-button class="mb-10px">
<Icon class="mr-5px" icon="system-uicons:contacts" />
创建联系人
</el-button>
</el-row>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="姓名" fixed="left" align="center" prop="name">
<template #default="scope">
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
{{ scope.row.name }}
</el-link>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="职位" align="center" prop="post" />
<el-table-column label="直属上级" align="center" prop="parentName" />
<el-table-column label="是否关键决策人" align="center" prop="master">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="200">
<template #default="scope">
<el-button
plain
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['crm:contact:update']"
>
编辑
</el-button>
<el-button
plain
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['crm:contact:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ContactForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import * as ContactApi from '@/api/crm/contact'
import ContactForm from './../ContactForm.vue'
import { DICT_TYPE } from '@/utils/dict'
import { BizTypeEnum } from '@/api/crm/permission'
defineOptions({ name: 'CrmContactList' })
const props = defineProps<{
bizType: number //
bizId: number //
}>()
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
customerId: undefined as unknown // undefined + number
})
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
//
queryParams.customerId = undefined
//
let data = { list: [], total: 0 }
switch (props.bizType) {
case BizTypeEnum.CRM_CUSTOMER:
queryParams.customerId = props.bizId
data = await ContactApi.getContactPageByCustomer(queryParams)
break
default:
return
}
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ContactApi.deleteContact(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 打开客户详情 */
const { push } = useRouter()
const openDetail = (id: number) => {
push({ name: 'CrmContactDetail', params: { id } })
}
watch(
() => [props.bizId, props.bizType],
() => {
handleQuery()
},
{ immediate: true, deep: true }
)
</script>

View File

@ -13,6 +13,7 @@
<el-button>更改成交状态</el-button> <el-button>更改成交状态</el-button>
</div> </div>
</div> </div>
<!-- TODO 芋艿 -->
<el-row class="mt-10px"> <el-row class="mt-10px">
<el-button> <el-button>
<Icon class="mr-5px" icon="ph:calendar-fill" /> <Icon class="mr-5px" icon="ph:calendar-fill" />
@ -22,10 +23,6 @@
<Icon class="mr-5px" icon="carbon:email" /> <Icon class="mr-5px" icon="carbon:email" />
发送邮件 发送邮件
</el-button> </el-button>
<el-button>
<Icon class="mr-5px" icon="system-uicons:contacts" />
创建联系人
</el-button>
<el-button> <el-button>
<Icon class="mr-5px" icon="ep:opportunity" /> <Icon class="mr-5px" icon="ep:opportunity" />
创建商机 创建商机

View File

@ -5,55 +5,30 @@
<el-tab-pane label="详细资料"> <el-tab-pane label="详细资料">
<CustomerDetails :customer="customer" /> <CustomerDetails :customer="customer" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="活动" lazy> 活动</el-tab-pane> <el-tab-pane label="操作日志" lazy>TODO 待开发</el-tab-pane>
<el-tab-pane label="邮件" lazy> 邮件</el-tab-pane>
<el-tab-pane label="工商信息" lazy> 工商信息</el-tab-pane>
<el-tab-pane label="客户关系" lazy> 客户关系</el-tab-pane>
<!-- TODO wanwan 以下标签上的数量需要接口统计返回 -->
<el-tab-pane label="联系人" lazy> <el-tab-pane label="联系人" lazy>
<template #label> <ContactList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
联系人
<el-badge class="item" type="primary" />
</template>
联系人
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="团队成员" lazy> <el-tab-pane label="团队成员" lazy>
<template #label> <CrmPermissionList :biz-id="customer.id!" :biz-type="BizTypeEnum.CRM_CUSTOMER" />
团队成员
<el-badge class="item" type="primary" />
</template>
<CrmPermissionList :biz-id="customer.id" :biz-type="CrmBizTypeEnum.CRM_CUSTOMER" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="商机" lazy> 商机</el-tab-pane> <el-tab-pane label="商机" lazy> 商机</el-tab-pane>
<el-tab-pane label="合同" lazy> <el-tab-pane label="合同" lazy>TODO 待开发</el-tab-pane>
<template #label> <el-tab-pane label="回款" lazy>TODO 待开发</el-tab-pane>
合同 <el-tab-pane label="回访" lazy>TODO 待开发</el-tab-pane>
<el-badge class="item" type="primary" /> <el-tab-pane label="发票" lazy>TODO 待开发</el-tab-pane>
</template>
合同
</el-tab-pane>
<el-tab-pane label="回款" lazy>
<template #label>
回款
<el-badge class="item" type="primary" />
</template>
回款
</el-tab-pane>
<el-tab-pane label="回访" lazy> 回访</el-tab-pane>
<el-tab-pane label="发票" lazy> 发票</el-tab-pane>
</el-tabs> </el-tabs>
</el-col> </el-col>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ElMessage } from 'element-plus'
import { useTagsViewStore } from '@/store/modules/tagsView' import { useTagsViewStore } from '@/store/modules/tagsView'
import * as CustomerApi from '@/api/crm/customer' import * as CustomerApi from '@/api/crm/customer'
import CustomerBasicInfo from '@/views/crm/customer/detail/CustomerBasicInfo.vue'
import { DICT_TYPE } from '@/utils/dict'
import CustomerDetails from '@/views/crm/customer/detail/CustomerDetails.vue' import CustomerDetails from '@/views/crm/customer/detail/CustomerDetails.vue'
import CustomerForm from '@/views/crm/customer/CustomerForm.vue' import { CrmPermissionList } from '@/views/crm/components'
import { CrmBizTypeEnum, CrmPermissionList } from '@/views/crm/components' import ContactList from '@/views/crm/contact/components/ContactList.vue'
import CustomerDetailsHeader from './CustomerDetailsHeader.vue'
import { BizTypeEnum } from '@/api/crm/permission'
defineOptions({ name: 'CustomerDetail' }) defineOptions({ name: 'CustomerDetail' })