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/components/ContactListModal.vue | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 160 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/contact/components/ContactListModal.vue b/src/views/crm/contact/components/ContactListModal.vue
new file mode 100644
index 0000000..8b655c1
--- /dev/null
+++ b/src/views/crm/contact/components/ContactListModal.vue
@@ -0,0 +1,160 @@
+<template>
+ <Dialog v-model="dialogVisible" title="鍏宠仈鑱旂郴浜�">
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <ContentWrap>
+ <el-form
+ ref="queryFormRef"
+ :inline="true"
+ :model="queryParams"
+ class="-mb-15px"
+ label-width="90px"
+ >
+ <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>
+ <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:business:create']" type="primary" @click="openForm()">
+ <Icon class="mr-5px" icon="ep:plus" />
+ 鏂板
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap class="mt-10px">
+ <el-table
+ ref="contactRef"
+ v-loading="loading"
+ :data="list"
+ :show-overflow-tooltip="true"
+ :stripe="true"
+ >
+ <el-table-column type="selection" width="55" />
+ <el-table-column align="center" fixed="left" label="濮撳悕" prop="name">
+ <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" label="鎵嬫満鍙�" prop="mobile" />
+ <el-table-column align="center" label="鑱屼綅" prop="post" />
+ <el-table-column align="center" label="鐩村睘涓婄骇" prop="parentName" />
+ <el-table-column align="center" label="鏄惁鍏抽敭鍐崇瓥浜�" min-width="100" prop="master">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ v-model:limit="queryParams.pageSize"
+ v-model:page="queryParams.pageNo"
+ :total="total"
+ @pagination="getList"
+ />
+ </ContentWrap>
+ <template #footer>
+ <el-button :disabled="formLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ </template>
+
+ <!-- 琛ㄥ崟寮圭獥锛氭坊鍔� -->
+ <ContactForm ref="formRef" @success="getList" />
+ </Dialog>
+</template>
+<script lang="ts" setup>
+import * as ContactApi from '@/api/crm/contact'
+import ContactForm from '../ContactForm.vue'
+import { DICT_TYPE } from '@/utils/dict'
+
+const message = useMessage() // 娑堟伅寮圭獥
+const props = defineProps<{
+ customerId: number
+}>()
+defineOptions({ name: 'ContactListModal' })
+
+const dialogVisible = ref(false) // 寮圭獥鐨勬槸鍚﹀睍绀�
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑锛�1锛変慨鏀规椂鐨勬暟鎹姞杞斤紱2锛夋彁浜ょ殑鎸夐挳绂佺敤
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ name: undefined,
+ customerId: props.customerId
+})
+
+/** 鎵撳紑寮圭獥 */
+const open = async () => {
+ dialogVisible.value = true
+ queryParams.customerId = props.customerId // 瑙e喅 props.customerId 娌℃洿鏂板埌 queryParams 涓婄殑闂
+ await getList()
+}
+defineExpose({ open }) // 鎻愪緵 open 鏂规硶锛岀敤浜庢墦寮�寮圭獥
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await ContactApi.getContactPageByCustomer(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()
+}
+
+/** 娣诲姞鎿嶄綔 */
+const formRef = ref()
+const openForm = () => {
+ formRef.value.open('create')
+}
+
+/** 鍏宠仈鑱旂郴浜烘彁浜� */
+const emit = defineEmits(['success']) // 瀹氫箟 success 浜嬩欢锛岀敤浜庢搷浣滄垚鍔熷悗鐨勫洖璋�
+const contactRef = ref()
+const submitForm = async () => {
+ const contactIds = contactRef.value.getSelectionRows().map((row: ContactApi.ContactVO) => row.id)
+ if (contactIds.length === 0) {
+ return message.error('鏈�夋嫨鑱旂郴浜�')
+ }
+ dialogVisible.value = false
+ emit('success', contactIds, contactRef.value.getSelectionRows())
+}
+
+/** 鎵撳紑鑱旂郴浜鸿鎯� */
+const { push } = useRouter()
+const openDetail = (id: number) => {
+ push({ name: 'CrmContactDetail', params: { id } })
+}
+</script>
--
Gitblit v1.8.0