From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/crm/contact/index.vue | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 332 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/contact/index.vue b/src/views/crm/contact/index.vue
new file mode 100644
index 0000000..ec26f1e
--- /dev/null
+++ b/src/views/crm/contact/index.vue
@@ -0,0 +1,332 @@
+<template>
+ <doc-alert title="銆愬鎴枫�戝鎴风鐞嗐�佸叕娴峰鎴�" url="https://doc.iocoder.cn/crm/customer/" />
+ <doc-alert title="銆愰�氱敤銆戞暟鎹潈闄�" url="https://doc.iocoder.cn/crm/permission/" />
+
+ <ContentWrap>
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <el-form
+ ref="queryFormRef"
+ :inline="true"
+ :model="queryParams"
+ class="-mb-15px"
+ label-width="68px"
+ >
+ <el-form-item label="瀹㈡埛" prop="customerId">
+ <el-select
+ v-model="queryParams.customerId"
+ class="!w-240px"
+ clearable
+ lable-key="name"
+ placeholder="璇烽�夋嫨瀹㈡埛"
+ value-key="id"
+ @keyup.enter="handleQuery"
+ >
+ <el-option
+ v-for="item in customerList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id!"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="濮撳悕" prop="name">
+ <el-input
+ v-model="queryParams.name"
+ class="!w-240px"
+ clearable
+ placeholder="璇疯緭鍏ュ鍚�"
+ @keyup.enter="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鎵嬫満鍙�" prop="mobile">
+ <el-input
+ v-model="queryParams.mobile"
+ class="!w-240px"
+ clearable
+ placeholder="璇疯緭鍏ユ墜鏈哄彿"
+ @keyup.enter="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鐢佃瘽" prop="telephone">
+ <el-input
+ v-model="queryParams.telephone"
+ class="!w-240px"
+ clearable
+ placeholder="璇疯緭鍏ョ數璇�"
+ @keyup.enter="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="寰俊" prop="wechat">
+ <el-input
+ v-model="queryParams.wechat"
+ class="!w-240px"
+ clearable
+ placeholder="璇疯緭鍏ュ井淇�"
+ @keyup.enter="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="鐢靛瓙閭" prop="email">
+ <el-input
+ v-model="queryParams.email"
+ class="!w-240px"
+ clearable
+ placeholder="璇疯緭鍏ョ數瀛愰偖绠�"
+ @keyup.enter="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item>
+ <el-button @click="handleQuery">
+ <Icon class="mr-5px" icon="ep:search" />
+ 鎼滅储
+ </el-button>
+ <el-button @click="resetQuery">
+ <Icon class="mr-5px" icon="ep:refresh" />
+ 閲嶇疆
+ </el-button>
+ <el-button v-hasPermi="['crm:contact:create']" type="primary" @click="openForm('create')">
+ <Icon class="mr-5px" icon="ep:plus" />
+ 鏂板
+ </el-button>
+ <el-button
+ v-hasPermi="['crm:contact:export']"
+ :loading="exportLoading"
+ plain
+ type="success"
+ @click="handleExport"
+ >
+ <Icon class="mr-5px" icon="ep:download" />
+ 瀵煎嚭
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap>
+ <el-tabs v-model="activeName" @tab-click="handleTabClick">
+ <el-tab-pane label="鎴戣礋璐g殑" name="1" />
+ <el-tab-pane label="鎴戝弬涓庣殑" name="2" />
+ <el-tab-pane label="涓嬪睘璐熻矗鐨�" name="3" />
+ </el-tabs>
+ <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
+ <el-table-column align="center" fixed="left" label="鑱旂郴浜哄鍚�" prop="name" width="160">
+ <template #default="scope">
+ <el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
+ {{ scope.row.name }}
+ </el-link>
+ </template>
+ </el-table-column>
+ <el-table-column align="center" fixed="left" label="瀹㈡埛鍚嶇О" prop="customerName" width="120">
+ <template #default="scope">
+ <el-link
+ :underline="false"
+ type="primary"
+ @click="openCustomerDetail(scope.row.customerId)"
+ >
+ {{ scope.row.customerName }}
+ </el-link>
+ </template>
+ </el-table-column>
+ <el-table-column align="center" label="鎵嬫満" prop="mobile" width="120" />
+ <el-table-column align="center" label="鐢佃瘽" prop="telephone" width="130" />
+ <el-table-column align="center" label="閭" prop="email" width="180" />
+ <el-table-column align="center" label="鑱屼綅" prop="post" width="120" />
+ <el-table-column align="center" label="鍦板潃" prop="detailAddress" width="120" />
+ <el-table-column align="center" label="鍏抽敭鍐崇瓥浜�" prop="master" width="100">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
+ </template>
+ </el-table-column>
+ <el-table-column align="center" label="鐩村睘涓婄骇" prop="parentName" width="160">
+ <template #default="scope">
+ <el-link :underline="false" type="primary" @click="openDetail(scope.row.parentId)">
+ {{ scope.row.parentName }}
+ </el-link>
+ </template>
+ </el-table-column>
+ <el-table-column label="鍦板潃" align="center" prop="detailAddress" width="180" />
+ <el-table-column
+ :formatter="dateFormatter"
+ align="center"
+ label="涓嬫鑱旂郴鏃堕棿"
+ prop="contactNextTime"
+ width="180px"
+ />
+ <el-table-column align="center" label="鎬у埆" prop="sex">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex" />
+ </template>
+ </el-table-column>
+ <el-table-column align="center" label="澶囨敞" prop="remark" />
+ <el-table-column
+ :formatter="dateFormatter"
+ align="center"
+ label="鏈�鍚庤窡杩涙椂闂�"
+ prop="contactLastTime"
+ width="180px"
+ />
+ <el-table-column align="center" label="璐熻矗浜�" prop="ownerUserName" width="120" />
+ <el-table-column align="center" label="鎵�灞為儴闂�" prop="ownerUserDeptName" width="100" />
+ <el-table-column
+ :formatter="dateFormatter"
+ align="center"
+ label="鏇存柊鏃堕棿"
+ prop="updateTime"
+ width="180px"
+ />
+ <el-table-column
+ :formatter="dateFormatter"
+ align="center"
+ label="鍒涘缓鏃堕棿"
+ prop="createTime"
+ width="180px"
+ />
+ <el-table-column align="center" label="鍒涘缓浜�" prop="creatorName" width="120" />
+ <el-table-column align="center" fixed="right" label="鎿嶄綔" width="200">
+ <template #default="scope">
+ <el-button
+ v-hasPermi="['crm:contact:update']"
+ link
+ type="primary"
+ @click="openForm('update', scope.row.id)"
+ >
+ 缂栬緫
+ </el-button>
+ <el-button
+ v-hasPermi="['crm:contact:delete']"
+ link
+ type="danger"
+ @click="handleDelete(scope.row.id)"
+ >
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ v-model:limit="queryParams.pageSize"
+ v-model:page="queryParams.pageNo"
+ :total="total"
+ @pagination="getList"
+ />
+ </ContentWrap>
+
+ <!-- 琛ㄥ崟寮圭獥锛氭坊鍔�/淇敼 -->
+ <ContactForm ref="formRef" @success="getList" />
+</template>
+
+<script lang="ts" setup>
+import { dateFormatter } from '@/utils/formatTime'
+import download from '@/utils/download'
+import * as ContactApi from '@/api/crm/contact'
+import ContactForm from './ContactForm.vue'
+import { DICT_TYPE } from '@/utils/dict'
+import * as CustomerApi from '@/api/crm/customer'
+import { TabsPaneContext } from 'element-plus'
+
+defineOptions({ name: 'CrmContact' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ sceneType: '1', // 榛樿鍜� activeName 鐩哥瓑
+ mobile: undefined,
+ telephone: undefined,
+ email: undefined,
+ customerId: undefined,
+ name: undefined,
+ wechat: undefined
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑
+const activeName = ref('1') // 鍒楄〃 tab
+const customerList = ref<CustomerApi.CustomerVO[]>([]) // 瀹㈡埛鍒楄〃
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await ContactApi.getContactPage(queryParams)
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ queryParams.pageNo = 1
+ getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+ queryFormRef.value.resetFields()
+ handleQuery()
+}
+
+/** tab 鍒囨崲 */
+const handleTabClick = (tab: TabsPaneContext) => {
+ queryParams.sceneType = tab.paneName
+ handleQuery()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+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 handleExport = async () => {
+ try {
+ // 瀵煎嚭鐨勪簩娆$‘璁�
+ await message.exportConfirm()
+ // 鍙戣捣瀵煎嚭
+ exportLoading.value = true
+ const data = await ContactApi.exportContact(queryParams)
+ download.excel(data, '鑱旂郴浜�.xls')
+ } catch {
+ } finally {
+ exportLoading.value = false
+ }
+}
+
+/** 鎵撳紑鑱旂郴浜鸿鎯� */
+const { push } = useRouter()
+const openDetail = (id: number) => {
+ push({ name: 'CrmContactDetail', params: { id } })
+}
+
+/** 鎵撳紑瀹㈡埛璇︽儏 */
+const openCustomerDetail = (id: number) => {
+ push({ name: 'CrmCustomerDetail', params: { id } })
+}
+
+/** 鍒濆鍖� **/
+onMounted(async () => {
+ await getList()
+ customerList.value = await CustomerApi.getCustomerSimpleList()
+})
+</script>
--
Gitblit v1.8.0