ソースを参照

fix: 修改一些客户管理的问题

qiny 1 年間 前
コミット
d545e971a8

+ 1 - 1
client/.env.dev

@@ -5,7 +5,7 @@ VITE_DEV=false
 
 # 请求路径
 # VITE_BASE_URL='http://10.10.9.113:48080'
-VITE_BASE_URL='http://10.10.10.7:48080'
+VITE_BASE_URL='http://10.10.10.7:48080/'
 
 # VITE_BASE_URL='http://10.10.9.168:48080'
 

+ 37 - 15
client/src/components/AreaSelectTree/index.vue

@@ -1,30 +1,52 @@
+<template>
+  <el-tree-select
+    v-model="checkCode"
+    :props="defaultProps"
+    :data="treeData"
+    check-strictly
+    filterable
+    clearable
+    default-expand-all
+    :multiple="false"
+    class="select-tree"
+  />
+</template>
 <script lang="ts" setup>
 /**
  * @description 行政区选择树
  */
+import { ref, onMounted } from 'vue'
 import { getAreaTree } from '@/service/system'
+import { defaultProps } from '@/utils/tree'
 
+const checkCode = ref<string | Number>('')
 const treeData = ref([])
-const checkCode = ref('')
 onMounted(async () => {
   const data = await getAreaTree()
   treeData.value = data
+  // console.log('checkCode.value', props.defaultValue)
+  // const area: any = getNode(props.defaultValue, treeData.value)
+  // if (area) {
+  //   checkCode.value = area.name
+  // }
 })
+
+// 通过id获取name
+const getNode = (id: string | Number, treeData: any[]): any => {
+  for (const item of treeData) {
+    if (item.id == id) {
+      return item
+    } else if (item.children) {
+      const childNode = getNode(id, item.children)
+      if (childNode) {
+        return childNode
+      }
+    }
+  }
+  return null
+}
 </script>
-<template>
-  <el-tree-select
-    v-model="checkCode"
-    node-key="id"
-    check-strictly
-    filterable
-    clearable
-    default-expand-all
-    :props="{ label: 'name' }"
-    :data="treeData"
-    :multiple="false"
-    class="select-tree"
-  />
-</template>
+
 <style scoped lang="scss">
 .select-tree {
   width: 100%;

+ 5 - 5
client/src/views/OaSystem/marketCenter/khglPage/CustomerTable.vue

@@ -78,7 +78,7 @@
     </div>
     <div class="pageBox">
       <el-pagination
-        :page-size="10"
+        :page-size="20"
         v-model:current-page="pageNo"
         background
         layout="prev, pager, next, jumper"
@@ -142,8 +142,8 @@ const newCustomer = (isAdd: boolean, row?) => {
   const params = !isAdd
     ? `/editCustomer?id=${row.id}&edit=true`
     : row
-    ? `/newCustomer?id=${row.id}`
-    : '/newCustomer'
+      ? `/newCustomer?id=${row.id}`
+      : '/newCustomer'
   push(params)
 }
 // 查看客户详情
@@ -157,7 +157,7 @@ const onCurrentChange = (page) => {
 }
 const message = useMessage() // 消息弹窗
 // 删除客户
-const deleteCustomer = (row) => {
+const deleteCustomer = (row: any) => {
   request
     .get(
       {
@@ -168,7 +168,7 @@ const deleteCustomer = (row) => {
       },
       '/business'
     )
-    .then((res) => {
+    .then(() => {
       message.success('删除成功')
       pageNo.value = 1
       getCustomerList()

+ 22 - 8
client/src/views/OaSystem/marketCenter/khxjPage/index.vue

@@ -21,6 +21,7 @@
                 disabled
                 class="code-input"
                 placeholder="请填写基本信息后生成编号"
+                :style="{ width: isEditType ? '100%' : 'auto' }"
               />
               <el-button type="primary" @click="customerCode" class="code-button" v-if="!isEditType"
                 >生成编号</el-button
@@ -30,7 +31,10 @@
           <tr>
             <td class="th">所属公司:</td>
             <td>
-              <CompanySelect v-model="queryParams.belongCompanyId" :isDisabled="customerId" />
+              <CompanySelect
+                v-model="queryParams.belongCompanyId"
+                :isDisabled="customerId ? true : false"
+              />
             </td>
             <td class="th">客户类型:</td>
             <td>
@@ -52,6 +56,7 @@
           <tr>
             <td class="th">所属区域:</td>
             <td>
+              <!-- <AreaSelectTree v-model="queryParams.xzqdm" :defaultValue="defaultAreaCode" /> -->
               <AreaSelectTree v-model="queryParams.xzqdm" />
             </td>
             <td class="th">联系地址:</td>
@@ -77,8 +82,8 @@
           <tr>
             <td class="th">开户银行账号:</td>
             <td><el-input clearable v-model="queryParams.bankaccount" /></td>
-            <td class="th">排序序号:</td>
-            <td><el-input clearable v-model="queryParams.indexCode" /></td>
+            <!-- <td class="th">排序序号:</td>
+            <td><el-input disabled v-model="queryParams.indexCode" /></td> -->
           </tr>
         </table>
       </div>
@@ -177,8 +182,7 @@ const queryParams = ref<ICustomer>({
   description: '',
   taxNumber: '',
   phone: '',
-  bankaccount: '',
-  indexCode: ''
+  bankaccount: ''
 })
 
 // 客户类型
@@ -201,6 +205,7 @@ onMounted(() => {
   if (propId) {
     customerId.value = propId
     queryParams.value.pid = propId
+    getCustomerDetail(propId, true)
   }
   // 如果是编辑
   if (isEdit && propId) {
@@ -210,7 +215,9 @@ onMounted(() => {
   }
 })
 
-const getCustomerDetail = async (id) => {
+// const defaultAreaCode = ref('') // 所属区域默认值
+
+const getCustomerDetail = async (id, child?: boolean) => {
   // 获取当前路由id及周报详情
   try {
     const result: any = await request.get(
@@ -220,8 +227,14 @@ const getCustomerDetail = async (id) => {
       },
       '/business'
     )
+    if (result && child) {
+      // 新增下级客户回填公司和区域
+      queryParams.value.belongCompanyId = result.belongCompanyId
+      queryParams.value.belongCompanyName = result.belongCompanyName
+      queryParams.value.xzqdm = result.xzqdm
+    }
 
-    if (result) {
+    if (result && !child) {
       queryParams.value = {
         id: result.id,
         customerName: result.customerName,
@@ -237,6 +250,7 @@ const getCustomerDetail = async (id) => {
         bankaccount: result.bankaccount,
         indexCode: result.indexCode
       }
+      // defaultAreaCode.value = result.xzqdm
     }
   } catch (error) {
     console.error('Error getting customer detail:', error)
@@ -501,7 +515,7 @@ const customerCode = () => {
     }
 
     .code-input {
-      width: auto;
+      // width: auto;
     }
     .code-button {
       margin-left: 20px;

+ 16 - 1
client/src/views/OaSystem/marketCenter/khxqPage/CustomerInfo.vue

@@ -4,6 +4,8 @@
  */
 import request from '@/config/axios'
 import { getDisplayName } from '@/components/Area'
+import { getDictOptions } from '@/utils/dict'
+
 interface IProp {
   detailData: any
 }
@@ -25,10 +27,23 @@ const getCompanyName = (id: any) => {
   })
   return name
 }
+
+// 客户类型
+const customerTypeObj = ref({})
+
 onMounted(() => {
   // 获取所属公司列表
   getCompanyList()
+  // 客户类型字典
+  getDictOptions('customer_type').map((item: any) => {
+    customerTypeObj.value[item.value] = item.label
+  })
 })
+
+const setCustomerType = (type: any) => {
+  if (!type) return ''
+  return customerTypeObj.value[type] ?? '其他'
+}
 </script>
 <template>
   <div class="content">
@@ -45,7 +60,7 @@ onMounted(() => {
           <td class="th">所属公司:</td>
           <td>{{ getCompanyName(detailData.belongCompanyId) }}</td>
           <td class="th">客户类型:</td>
-          <td>{{ detailData.customerType ?? '' }}</td>
+          <td>{{ setCustomerType(detailData.customerType) }}</td>
         </tr>
         <tr>
           <td class="th">所属区域:</td>