Browse Source

crm:code review 联系人管理

YunaiV 1 year ago
parent
commit
85e953b920

+ 10 - 5
src/views/crm/contact/ContactForm.vue

@@ -28,6 +28,7 @@
           />
         </el-select>
       </el-form-item>
+      <!-- TODO 芋艿:封装成一个组件 -->
       <el-form-item label="客户名称" prop="customerName">
         <el-popover
           placement="bottom"
@@ -89,7 +90,6 @@
           />
         </el-select>
       </el-form-item>
-
       <el-form-item label="手机号" prop="mobile">
         <el-input v-model="formData.mobile" placeholder="请输入手机号" />
       </el-form-item>
@@ -212,6 +212,7 @@ const formRules = reactive({
 const formRef = ref() // 表单 Ref
 const ownerUserList = ref<any[]>([])
 const userList = ref<UserApi.UserVO[]>([]) // 用户列表
+
 /** 打开弹窗 */
 const open = async (type: string, id?: number) => {
   dialogVisible.value = true
@@ -231,6 +232,8 @@ const open = async (type: string, id?: number) => {
     }
   }
 }
+defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+
 /** 查询列表 */
 const getList = async () => {
   loading.value = true
@@ -242,7 +245,7 @@ const getList = async () => {
     loading.value = false
   }
 }
-defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+
 const gotOwnerUser = (owerUserId: any) => {
   if (owerUserId !== null) {
     owerUserId.split(',').forEach((item: string) => {
@@ -254,6 +257,7 @@ const gotOwnerUser = (owerUserId: any) => {
     })
   }
 }
+
 /** 提交表单 */
 const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
 const submitForm = async () => {
@@ -305,12 +309,13 @@ const resetForm = () => {
   formRef.value?.resetFields()
   ownerUserList.value = []
 }
+
 /** 添加/修改操作 */
+// TODO @zyna:owner?拼写要注意哈;
 const owerRef = ref()
 const openOwerForm = (type: string) => {
   owerRef.value.open(type, ownerUserList.value)
 }
-
 const owerSelectValue = (value) => {
   ownerUserList.value = value.value
   formData.value.ownerUserId = undefined
@@ -322,7 +327,7 @@ const owerSelectValue = (value) => {
     }
   })
 }
-//选择客户
+// 选择客户
 const showCustomer = ref(false)
 const openCustomerSelect = () => {
   showCustomer.value = !showCustomer.value
@@ -341,7 +346,7 @@ const selectCustomer = () => {
   formData.value.customerName = multipleSelection.value.name
   showCustomer.value = !showCustomer.value
 }
-const allContactList = ref([]) //所有联系人列表
+const allContactList = ref([]) // 所有联系人列表
 onMounted(async () => {
   allContactList.value = await ContactApi.simpleAlllist()
 })

+ 1 - 0
src/views/crm/contact/OwerSelect.vue

@@ -18,6 +18,7 @@
   </Dialog>
 </template>
 <script setup lang="ts">
+// TODO 芋艿:统一选择框。
 import * as UserApi from '@/api/system/user'
 import { parseBigInt } from 'jsencrypt/lib/lib/jsbn/jsbn'
 const dialogVisible = ref(false) // 弹窗的是否展示

+ 2 - 1
src/views/crm/contact/detail/ContactBasicInfo.vue

@@ -3,7 +3,7 @@
  * @Date: 2023-11-11 14:50:11
  * @LastEditTime: 2023-11-11 14:52:47
  * @FilePath: \yudao-ui-admin-vue3\src\views\crm\contact\detail\ContactBasicInfo.vue
- * @Description: 
+ * @Description:
 -->
 <template>
   <el-col>
@@ -17,6 +17,7 @@
   </el-col>
 </template>
 <script setup lang="ts">
+// TODO 芋艿:后面在 review 么?
 import * as ContactApi from '@/api/crm/contact'
 
 const { contact } = defineProps<{ contact: ContactApi.ContactVO }>()

+ 1 - 0
src/views/crm/contact/detail/ContactDetails.vue

@@ -62,6 +62,7 @@
   </el-collapse>
 </template>
 <script setup lang="ts">
+// TODO 芋艿:后面在 review 么?
 import * as ContactApi from '@/api/crm/contact'
 import { DICT_TYPE } from '@/utils/dict'
 import { formatDate } from '@/utils/formatTime'

+ 2 - 0
src/views/crm/contact/detail/index.vue

@@ -1,4 +1,5 @@
 <template>
+  <!-- TODO 芋艿:要不要把 3 到 62 合并成一个组件 -->
   <div v-loading="loading">
     <div class="flex items-start justify-between">
       <div>
@@ -105,6 +106,7 @@ import ContactDetails from '@/views/crm/contact/detail/ContactDetails.vue'
 import ContactForm from '@/views/crm/contact/ContactForm.vue'
 import { formatDate } from '@/utils/formatTime'
 import * as CustomerApi from '@/api/crm/customer'
+// TODO 芋艿:后面在 review 么?
 
 defineOptions({ name: 'ContactDetail' })
 const { delView } = useTagsViewStore() // 视图操作

+ 7 - 1
src/views/crm/contact/index.vue

@@ -1,6 +1,7 @@
 <template>
   <ContentWrap>
     <!-- 搜索工作栏 -->
+    <!-- TODO zyna:筛选项,按照需求简化下 -->
     <el-form
       class="-mb-15px"
       :model="queryParams"
@@ -214,6 +215,7 @@ import * as UserApi from '@/api/system/user'
 import * as CustomerApi from '@/api/crm/customer'
 
 defineOptions({ name: 'CrmContact' })
+
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化
 
@@ -244,6 +246,7 @@ const queryParams = reactive({
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
 const userList = ref<UserApi.UserVO[]>([]) // 用户列表
+
 /** 查询列表 */
 const getList = async () => {
   loading.value = true
@@ -301,6 +304,8 @@ const handleExport = async () => {
     exportLoading.value = false
   }
 }
+
+// TODO @zyna:这个负责人的读取,放在后端好点
 const gotOwnerUser = (owerUserId: string) => {
   let ownerName = ''
   if (owerUserId !== null) {
@@ -315,13 +320,14 @@ const gotOwnerUser = (owerUserId: string) => {
   }
   return ownerName
 }
-/** 详情页面 */
+
 /** 打开客户详情 */
 const { push } = useRouter()
 const openDetail = (id: number) => {
   push({ name: 'CrmContactDetail', params: { id } })
 }
 
+// TODO @zyna:这个上级的读取,放在后端读取,更合适;因为可能数据量比较大
 const allContactList = ref([]) //所有联系人列表
 const allCustomerList = ref([]) //客户列表
 /** 初始化 **/