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/contract/components/ContractList.vue | 136 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 136 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/contract/components/ContractList.vue b/src/views/crm/contract/components/ContractList.vue
new file mode 100644
index 0000000..f693c9a
--- /dev/null
+++ b/src/views/crm/contract/components/ContractList.vue
@@ -0,0 +1,136 @@
+<template>
+ <!-- 鎿嶄綔鏍� -->
+ <el-row justify="end">
+ <el-button @click="openForm">
+ <Icon class="mr-5px" icon="clarity:contract-line" />
+ 鍒涘缓鍚堝悓
+ </el-button>
+ </el-row>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap class="mt-10px">
+ <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="no" />
+ <el-table-column label="瀹㈡埛鍚嶇О" align="center" prop="customerName" />
+ <el-table-column
+ label="鍚堝悓閲戦锛堝厓锛�"
+ align="center"
+ prop="totalPrice"
+ :formatter="erpPriceTableColumnFormatter"
+ />
+ <el-table-column
+ label="寮�濮嬫椂闂�"
+ align="center"
+ prop="startTime"
+ :formatter="dateFormatter"
+ width="180px"
+ />
+ <el-table-column
+ label="缁撴潫鏃堕棿"
+ align="center"
+ prop="endTime"
+ :formatter="dateFormatter"
+ width="180px"
+ />
+ <el-table-column align="center" label="鐘舵��" prop="auditStatus">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ :total="total"
+ v-model:page="queryParams.pageNo"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </ContentWrap>
+
+ <!-- 琛ㄥ崟寮圭獥锛氭坊鍔� -->
+ <ContractForm ref="formRef" @success="getList" />
+</template>
+<script setup lang="ts">
+import * as ContractApi from '@/api/crm/contract'
+import ContractForm from './../ContractForm.vue'
+import { BizTypeEnum } from '@/api/crm/permission'
+import { dateFormatter } from '@/utils/formatTime'
+import { DICT_TYPE } from '@/utils/dict'
+import { erpPriceTableColumnFormatter } from '@/utils'
+
+defineOptions({ name: 'CrmContractList' })
+const props = defineProps<{
+ bizType: number // 涓氬姟绫诲瀷
+ bizId: number // 涓氬姟缂栧彿
+}>()
+
+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 ContractApi.getContractPageByCustomer(queryParams)
+ break
+ case BizTypeEnum.CRM_BUSINESS:
+ queryParams.businessId = props.bizId
+ data = await ContractApi.getContractPageByBusiness(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 = () => {
+ formRef.value.open('create')
+}
+
+/** 鎵撳紑鍚堝悓璇︽儏 */
+const { push } = useRouter()
+const openDetail = (id: number) => {
+ push({ name: 'CrmContractDetail', params: { id } })
+}
+
+/** 鐩戝惉鎵撳紑鐨� bizId + bizType锛屼粠鑰屽姞杞芥渶鏂扮殑鍒楄〃 */
+watch(
+ () => [props.bizId, props.bizType],
+ () => {
+ handleQuery()
+ },
+ { immediate: true, deep: true }
+)
+</script>
--
Gitblit v1.8.0