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/business/components/BusinessListModal.vue | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 156 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/business/components/BusinessListModal.vue b/src/views/crm/business/components/BusinessListModal.vue
new file mode 100644
index 0000000..3c21f06
--- /dev/null
+++ b/src/views/crm/business/components/BusinessListModal.vue
@@ -0,0 +1,156 @@
+<template>
+ <Dialog title="鍏宠仈鍟嗘満" v-model="dialogVisible">
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <ContentWrap>
+ <el-form
+ class="-mb-15px"
+ :model="queryParams"
+ ref="queryFormRef"
+ :inline="true"
+ label-width="68px"
+ >
+ <el-form-item label="鍟嗘満鍚嶇О" prop="name">
+ <el-input
+ v-model="queryParams.name"
+ placeholder="璇疯緭鍏ュ晢鏈哄悕绉�"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item>
+ <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 鎼滅储</el-button>
+ <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 閲嶇疆</el-button>
+ <el-button type="primary" @click="openForm()" v-hasPermi="['crm:business:create']">
+ <Icon icon="ep:plus" class="mr-5px" /> 鏂板
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap class="mt-10px">
+ <el-table
+ v-loading="loading"
+ ref="businessRef"
+ :data="list"
+ :stripe="true"
+ :show-overflow-tooltip="true"
+ >
+ <el-table-column type="selection" width="55" />
+ <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="totalPrice"
+ :formatter="erpPriceTableColumnFormatter"
+ />
+ <el-table-column label="瀹㈡埛鍚嶇О" align="center" prop="customerName" />
+ <el-table-column label="鍟嗘満缁�" align="center" prop="statusTypeName" />
+ <el-table-column label="鍟嗘満闃舵" align="center" prop="statusName" />
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ :total="total"
+ v-model:page="queryParams.pageNo"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </ContentWrap>
+ <template #footer>
+ <el-button @click="submitForm" type="primary" :disabled="formLoading">纭� 瀹�</el-button>
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ </template>
+
+ <!-- 琛ㄥ崟寮圭獥锛氭坊鍔� -->
+ <BusinessForm ref="formRef" @success="getList" />
+ </Dialog>
+</template>
+<script setup lang="ts">
+import * as BusinessApi from '@/api/crm/business'
+import BusinessForm from '../BusinessForm.vue'
+import { erpPriceTableColumnFormatter } from '@/utils'
+
+const message = useMessage() // 娑堟伅寮圭獥
+const props = defineProps<{
+ customerId: number
+}>()
+defineOptions({ name: 'BusinessListModal' })
+
+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 BusinessApi.getBusinessPageByCustomer(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 businessRef = ref()
+const submitForm = async () => {
+ const businessIds = businessRef.value
+ .getSelectionRows()
+ .map((row: BusinessApi.BusinessVO) => row.id)
+ if (businessIds.length === 0) {
+ return message.error('鏈�夋嫨鍟嗘満')
+ }
+ dialogVisible.value = false
+ emit('success', businessIds, businessRef.value.getSelectionRows())
+}
+
+/** 鎵撳紑鍟嗘満璇︽儏 */
+const { push } = useRouter()
+const openDetail = (id: number) => {
+ push({ name: 'CrmBusinessDetail', params: { id } })
+}
+</script>
--
Gitblit v1.8.0