From ae8cb9218cc4b236daecf9361c8cea74bffc9fad Mon Sep 17 00:00:00 2001
From: YunaiV <zhijiantianya@gmail.com>
Date: Sun, 26 Nov 2023 20:18:33 +0800
Subject: [PATCH] =?UTF-8?q?crm=EF=BC=9Acode=20review=20=E5=AE=A2=E6=88=B7?=
 =?UTF-8?q?=E8=AF=A6=E6=83=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/views/crm/clue/ClueForm.vue                  |  1 +
 .../customerLimitConfig/customerLimitConfig.ts   |  4 ----
 .../crm/customer/detail/CustomerBasicInfo.vue    |  4 +++-
 .../crm/customer/detail/CustomerDetails.vue      |  4 +++-
 ...rDetailsTop.vue => CustomerDetailsHeader.vue} | 16 ++++++++++------
 src/views/crm/customer/detail/index.vue          |  4 ++--
 6 files changed, 19 insertions(+), 14 deletions(-)
 delete mode 100644 src/views/crm/config/customerLimitConfig/customerLimitConfig.ts
 rename src/views/crm/customer/detail/{CustomerDetailsTop.vue => CustomerDetailsHeader.vue} (90%)

diff --git a/src/views/crm/clue/ClueForm.vue b/src/views/crm/clue/ClueForm.vue
index f0cfcab6..1b2637c9 100644
--- a/src/views/crm/clue/ClueForm.vue
+++ b/src/views/crm/clue/ClueForm.vue
@@ -10,6 +10,7 @@
       <el-form-item label="线索名称" prop="name">
         <el-input v-model="formData.name" placeholder="请输入线索名称" />
       </el-form-item>
+      <!-- TODO 芋艿:后续客户的选择 -->
       <el-form-item label="客户" prop="customerId">
         <el-select v-model="formData.customerId" clearable placeholder="请选择客户">
           <el-option
diff --git a/src/views/crm/config/customerLimitConfig/customerLimitConfig.ts b/src/views/crm/config/customerLimitConfig/customerLimitConfig.ts
deleted file mode 100644
index 7584849a..00000000
--- a/src/views/crm/config/customerLimitConfig/customerLimitConfig.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-// TODO 可以挪到它对应的 api.ts 文件里哈
-/**
- * 客户限制配置类型
- */
diff --git a/src/views/crm/customer/detail/CustomerBasicInfo.vue b/src/views/crm/customer/detail/CustomerBasicInfo.vue
index 86f9c9d7..2542b006 100644
--- a/src/views/crm/customer/detail/CustomerBasicInfo.vue
+++ b/src/views/crm/customer/detail/CustomerBasicInfo.vue
@@ -12,5 +12,7 @@
 <script setup lang="ts">
 import * as CustomerApi from '@/api/crm/customer'
 
-const { customer } = defineProps<{ customer: CustomerApi.CustomerVO }>()
+const { customer } = defineProps<{
+  customer: CustomerApi.CustomerVO
+}>()
 </script>
diff --git a/src/views/crm/customer/detail/CustomerDetails.vue b/src/views/crm/customer/detail/CustomerDetails.vue
index 67beae94..f7c92ca2 100644
--- a/src/views/crm/customer/detail/CustomerDetails.vue
+++ b/src/views/crm/customer/detail/CustomerDetails.vue
@@ -87,7 +87,9 @@ import * as CustomerApi from '@/api/crm/customer'
 import { DICT_TYPE } from '@/utils/dict'
 import { formatDate } from '@/utils/formatTime'
 
-const { customer } = defineProps<{ customer: CustomerApi.CustomerVO }>()
+const { customer } = defineProps<{
+  customer: CustomerApi.CustomerVO
+}>()
 
 // 展示的折叠面板
 const activeNames = ref(['basicInfo', 'systemInfo'])
diff --git a/src/views/crm/customer/detail/CustomerDetailsTop.vue b/src/views/crm/customer/detail/CustomerDetailsHeader.vue
similarity index 90%
rename from src/views/crm/customer/detail/CustomerDetailsTop.vue
rename to src/views/crm/customer/detail/CustomerDetailsHeader.vue
index 509d0a27..6e14c829 100644
--- a/src/views/crm/customer/detail/CustomerDetailsTop.vue
+++ b/src/views/crm/customer/detail/CustomerDetailsHeader.vue
@@ -7,7 +7,7 @@
       </div>
       <div>
         <!-- 右上:按钮 -->
-        <el-button v-hasPermi="['crm:customer:update']" @click="openForm('update', customer.id)">
+        <el-button v-hasPermi="['crm:customer:update']" @click="openForm(customer.id)">
           编辑
         </el-button>
         <el-button>更改成交状态</el-button>
@@ -70,16 +70,20 @@
 <script setup lang="ts">
 import * as CustomerApi from '@/api/crm/customer'
 import { DICT_TYPE } from '@/utils/dict'
+// TODO @wanwan:是不是把 CustomerBasicInfo 也放进来。
 import CustomerBasicInfo from '@/views/crm/customer/detail/CustomerBasicInfo.vue'
 import CustomerForm from '@/views/crm/customer/CustomerForm.vue'
 
-const { customer, loading } = defineProps<{ customer: CustomerApi.CustomerVO; loading: boolean }>()
-
-const openForm = (type: string, id?: number) => {
-  formRef.value.open(type, id)
-}
+const { customer, loading } = defineProps<{
+  customer: CustomerApi.CustomerVO
+  loading: boolean
+}>()
 
+/** 修改操作 */
 const formRef = ref()
+const openForm = (id?: number) => {
+  formRef.value.open('update', id)
+}
 
 const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
 </script>
diff --git a/src/views/crm/customer/detail/index.vue b/src/views/crm/customer/detail/index.vue
index 59b18c5b..e6c9e9a9 100644
--- a/src/views/crm/customer/detail/index.vue
+++ b/src/views/crm/customer/detail/index.vue
@@ -1,5 +1,5 @@
 <template>
-  <CustomerDetailsTop :customer="customer" :loading="loading" @refresh="getCustomerData(id)" />
+  <CustomerDetailsHeader :customer="customer" :loading="loading" @refresh="getCustomerData(id)" />
   <el-col>
     <el-tabs>
       <el-tab-pane label="详细资料">
@@ -66,7 +66,7 @@ const loading = ref(true) // 加载中
 /**
  * 获取详情
  *
- * @param id
+ * @param id 客户编号
  */
 const customer = ref<CustomerApi.CustomerVO>({} as CustomerApi.CustomerVO) // 客户详情
 const getCustomerData = async (id: number) => {