Просмотр исходного кода

feat: 优化新建客户编号生成功能

qiny 1 год назад
Родитель
Сommit
cadd85304d
1 измененных файлов с 35 добавлено и 4 удалено
  1. 35 4
      client/src/views/OaSystem/marketCenter/khxjPage/index.vue

+ 35 - 4
client/src/views/OaSystem/marketCenter/khxjPage/index.vue

@@ -11,7 +11,10 @@
         <h4><i class="icon"></i>基本信息</h4>
         <table>
           <tr>
-            <td class="th">客户名称:</td>
+            <td class="th">
+              <span class="required-star">*</span>
+              客户名称:
+            </td>
             <td><el-input clearable v-model="queryParams.customerName" /></td>
             <td class="th">客户编号:</td>
             <td>
@@ -29,7 +32,10 @@
             </td>
           </tr>
           <tr>
-            <td class="th">所属公司:</td>
+            <td class="th">
+              <span class="required-star">*</span>
+              所属公司:</td
+            >
             <td>
               <CompanySelect
                 v-model="queryParams.belongCompanyId"
@@ -54,7 +60,10 @@
             </td>
           </tr>
           <tr>
-            <td class="th">所属区域:</td>
+            <td class="th">
+              <span class="required-star">*</span>
+              所属区域:
+            </td>
             <td>
               <DistrictTree v-model="queryParams.xzqdm" />
             </td>
@@ -409,6 +418,25 @@ const onEditItem = (index) => {
 }
 // 生成客户编号
 const customerCode = () => {
+  if (
+    !queryParams.value.customerName ||
+    !queryParams.value.belongCompanyId ||
+    !queryParams.value.xzqdm
+  ) {
+    ElMessage({
+      message: '请先将客户基本信息填写完整',
+      type: 'error'
+    })
+    return
+  }
+  if (queryParams.value.customerNumber) {
+    ElMessage({
+      message: '客户编号已生成,请勿重复生成!',
+      type: 'success'
+    })
+    return
+  }
+
   request
     .post(
       {
@@ -428,7 +456,7 @@ const customerCode = () => {
     })
     .catch(() => {
       ElMessage({
-        message: '客户编号生成失败,请填写基本信息后重试',
+        message: '客户编号生成失败,请后重试',
         type: 'error'
       })
     })
@@ -477,6 +505,9 @@ const customerCode = () => {
   }
 
   .tableBox {
+    .required-star {
+      color: #f5222d;
+    }
     .add-contact {
       display: flex;
       justify-content: space-between;