Przeglądaj źródła

协议费用录入、编辑增加入口比例录入校验

@dongkboy 2 miesięcy temu
rodzic
commit
25a0f5fff3

+ 37 - 6
src/views/quoteConfig/agreement/agreementDetails.vue

@@ -232,7 +232,7 @@
       @cancel="ruleConditionVisible = false" @save="ruleConditionSave" :attrIdList="attrIdList" />
     <!-- 规则费用抽屉组件 -->
     <ruleFeeDialog v-if="ruleFeeVisible" :ruleFeeVisible="ruleFeeVisible" :agreementInfo="agreementInfo"
-      :RulesInfo="RulesInfo" @save="ruleFeeSave" @cancel="ruleFeeVisible = false" />
+      :RulesInfo="RulesInfo" @save="ruleFeeSave" @cancel="ruleFeeVisible = false" :handlingFee="handlingFeeInfo" />
     <!-- 规则费用编辑组件 -->
     <ruleFeeDialogEdit :ruleFeeVisible="ruleFeeEditVisible" :headerTitle="ruleFeeHeaderTitle"
       :agreementInfo="agreementInfo" :RulesInfo="RulesInfo" :costitemEditInfo="costitemEditInfo" @save="ruleFeeEditSave"
@@ -312,6 +312,7 @@ onBeforeMount(async () => {
     activeName.value = 'costManagement'
   }
 })
+let handlingFeeInfo = ref({})
 //协议详情
 const detailsInfo = () => {
   api.agreementApi.agreementGet(id.value).then((res: any) => {
@@ -321,7 +322,8 @@ const detailsInfo = () => {
         res.data.agreement.fileSize = formatFileSize(res.data.agreement.fileSize);
       }
       agreementInfo.value = res.data.agreement;
-
+      handlingFeeInfo.value = { jqEntranceFeeRatio: res.data.agreement.jqEntranceFeeRatio, syEntranceFeeRatio: res.data.agreement.syEntranceFeeRatio, jyEntranceFeeRatio: res.data.agreement.jyEntranceFeeRatio };
+      console.log(handlingFeeInfo)
       authDeptlength.value = res.data.dept.length;
       imageUrl.value = res.data.agreement.fileUrl;
     } else {
@@ -767,20 +769,49 @@ const ruleFeeAdd = (item: any) => {
 }
 //费用提交
 const ruleFeeSave = (data: object) => {
+
   api.agreementApi.ptlAgreementCostsave(data).then((res: any) => {
     if (res.code == '200') {
-      ruleFeeVisible.value = false;
-      agreementRulesList()
-    } else {
       ElMessage({
-        type: 'error',
+        type: 'success',
         message: res.msg,
         plain: true,
       });
+      ruleFeeVisible.value = false;
+      agreementRulesList()
+    } else {
+
     }
   });
 }
 const ruleFeeEditSave = (data: object) => {
+  // 检查入口比例是否小于入口手续费比例
+  const hasInvalidItem = data.ptlAgreementCostTypeList.some((item: any) => {
+    // 获取当前险种对应的入口手续费比例
+    let entranceFeeRatio = 0;
+    if (item.costType == '交强险') {
+      entranceFeeRatio = handlingFeeInfo.value?.jqEntranceFeeRatio || 0;
+    } else if (item.costType == '商业险') {
+      entranceFeeRatio = handlingFeeInfo.value?.syEntranceFeeRatio || 0;
+    } else if (item.costType == '驾意险') {
+      entranceFeeRatio = handlingFeeInfo.value?.jyEntranceFeeRatio || 0;
+    }
+
+    // 检查入口比例是否小于入口手续费比例(转换为数字比较)
+    if (Number(item.inlet) < Number(entranceFeeRatio)) {
+      ElMessage({
+        type: 'warning',
+        message: `${item.costType}入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
+        plain: true,
+      });
+      return true; // 找到不符合条件的项,中断循环
+    }
+    return false;
+  });
+
+  if (hasInvalidItem) {
+    return;
+  }
   api.agreementApi.AgreementFeeupdate(data).then((res: any) => {
     if (res.code == '200') {
       ElMessage({

+ 173 - 121
src/views/quoteConfig/agreement/components/ruleFeeDialog.vue

@@ -1,8 +1,7 @@
 <!-- 模板区域 -->
 <template>
   <div>
-    <el-drawer v-model="props.ruleFeeVisible" :direction="direction"  size="57%"
-      @close="close">
+    <el-drawer v-model="props.ruleFeeVisible" :direction="direction" size="62%" @close="close">
       <template #header>
         <h4>添加费用</h4>
       </template>
@@ -72,19 +71,20 @@
                               :disabled-date="(date: any) => disabledEndDate(date, index, Costindex)" />
                           </el-form-item>
                         </ElCol>
-                          <ElCol :md="24" :lg="12">
-                              <el-form-item label="审核方式" prop="auditMethod">
-                                  <el-select v-model="Costitem.auditMethod" placeholder="选择审核方式">
-                                      <el-option label="自动审核" value="0" />
-                                      <el-option label="手动审核" value="1" />
-                                  </el-select>
-                              </el-form-item>
-                          </ElCol>
-                          <ElCol :md="24" :lg="12">
-                              <el-form-item label="优先级" prop="priorityLevel">
-                                  <el-input-number style="width: 100%" v-model="Costitem.priorityLevel" placeholder="请填写优先级" />
-                              </el-form-item>
-                          </ElCol>
+                        <ElCol :md="24" :lg="12">
+                          <el-form-item label="审核方式" prop="auditMethod">
+                            <el-select v-model="Costitem.auditMethod" placeholder="选择审核方式">
+                              <el-option label="自动审核" value="0" />
+                              <el-option label="手动审核" value="1" />
+                            </el-select>
+                          </el-form-item>
+                        </ElCol>
+                        <ElCol :md="24" :lg="12">
+                          <el-form-item label="优先级" prop="priorityLevel">
+                            <el-input-number style="width: 100%" v-model="Costitem.priorityLevel"
+                              placeholder="请填写优先级" />
+                          </el-form-item>
+                        </ElCol>
                         <ElCol :md="24" :lg="24">
                           <el-form-item label="费用描述" prop="costDescribe">
                             <el-input v-model="Costitem.costDescribe" maxlength="500" placeholder="请输入费用描述"
@@ -120,7 +120,15 @@
                         </div>
                       </template>
                       <el-table-column prop="costType" label="类型"></el-table-column>
-                      <el-table-column prop="inlet" label="入口比例" width="180" align="center">
+                      <el-table-column prop="costType" label="入口手续费比例" width="150" align="center"
+                        v-if="handlingFee.jqEntranceFeeRatio || handlingFee.syEntranceFeeRatio || handlingFee.jyEntranceFeeRatio">
+                        <template #default="scope">
+                          <span v-if="scope.row.costType == '交强险'">{{ handlingFee.jqEntranceFeeRatio }}%</span>
+                          <span v-if="scope.row.costType == '商业险'">{{ handlingFee.syEntranceFeeRatio }}%</span>
+                          <span v-if="scope.row.costType == '驾意险'">{{ handlingFee.jyEntranceFeeRatio }}%</span>
+                        </template>
+                      </el-table-column>
+                      <el-table-column prop="inlet" label="入口比例" width="160" align="center">
                         <template #default="scope">
                           <el-input-number v-model="scope.row.inlet" :precision="2" controls-position="right"
                             style="width: 100%;" :min="0" :max="100" @change="handelRK(scope)">
@@ -136,38 +144,30 @@
                           </el-input-number>
                         </template>
                       </el-table-column>
-<!--                      <el-table-column prop="commission" label="手续费比例" width="180" align="center">
+                      <el-table-column prop="addThrow" label="加投比例" width="160" align="center">
                         <template #default="scope">
-                          <el-input-number v-model="scope.row.commission" :precision="2" controls-position="right"
-                            style="width: 100%;" :min="0" :max="100">
+                          <el-input-number v-model="scope.row.addThrow" :precision="2" controls-position="right"
+                            style="width: 100%;" :min="0" :max="100" @change="handelJT(scope)">
+                            <template #suffix>%</template>
+                          </el-input-number>
+                        </template>
+                      </el-table-column>
+                      <el-table-column prop="keepPointRatio" label="留点比例" width="160" align="center">
+                        <template #default="scope">
+                          <el-input-number v-model="scope.row.keepPointRatio" :precision="2" controls-position="right"
+                            style="width: 100%;" :min="0" :max="100" @change="handelLD(scope)">
+                            <template #suffix>%</template>
+                          </el-input-number>
+                        </template>
+                      </el-table-column>
+                      <el-table-column prop="keepPointRatio" label="出口留点比例" width="180" align="center">
+                        <template #default="scope">
+                          <el-input-number v-model="scope.row.exportKeepPointRatio" :precision="2"
+                            controls-position="right" style="width: 100%;" :min="0" :max="100">
                             <template #suffix>%</template>
                           </el-input-number>
                         </template>
-                      </el-table-column>-->
-                      <el-table-column prop="addThrow" label="加投比例" width="180" align="center">
-                          <template #default="scope">
-                              <el-input-number v-model="scope.row.addThrow" :precision="2" controls-position="right"
-                                               style="width: 100%;" :min="0" :max="100" @change="handelJT(scope)">
-                                  <template #suffix>%</template>
-                              </el-input-number>
-                          </template>
                       </el-table-column>
-                        <el-table-column prop="keepPointRatio" label="留点比例" width="180" align="center">
-                            <template #default="scope">
-                                <el-input-number v-model="scope.row.keepPointRatio" :precision="2" controls-position="right"
-                                                 style="width: 100%;" :min="0" :max="100" @change="handelLD(scope)">
-                                    <template #suffix>%</template>
-                                </el-input-number>
-                            </template>
-                        </el-table-column>
-                        <el-table-column prop="keepPointRatio" label="出口留点比例" width="180" align="center">
-                            <template #default="scope">
-                                <el-input-number v-model="scope.row.exportKeepPointRatio" :precision="2" controls-position="right"
-                                                 style="width: 100%;" :min="0" :max="100">
-                                    <template #suffix>%</template>
-                                </el-input-number>
-                            </template>
-                        </el-table-column>
                     </el-table>
                   </div>
                 </div>
@@ -185,8 +185,8 @@
       </template>
     </el-drawer>
     <!-- 规则条件弹窗 -->
-    <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible" @cancel="ruleConditionVisible = false"
-      @save="ruleConditionSave" :attrIdList="echoResponse" />
+    <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible"
+      @cancel="ruleConditionVisible = false" @save="ruleConditionSave" :attrIdList="echoResponse" />
   </div>
 </template>
 
@@ -206,6 +206,7 @@ const props = defineProps<{
   ruleFeeVisible: boolean,
   agreementInfo: any,
   RulesInfo: any,
+  handlingFee?: any,
 }>();
 const emits = defineEmits(["cancel", 'save']);
 const ruleFeeinfo = ref();//规则费用集合
@@ -224,9 +225,9 @@ const feerules = ref<FormRules>({
   auditMethod: [
     { required: true, trigger: 'change', message: '请选择审核方式' },
   ],
-    priorityLevel: [
-        { required: true, trigger: 'blur', message: '请填写优先级' },
-    ]
+  priorityLevel: [
+    { required: true, trigger: 'blur', message: '请填写优先级' },
+  ]
 })
 interface RuleCondition {
   min: number | string;
@@ -244,7 +245,9 @@ onMounted(async () => {
       ptlAgreementCostAddList: [],//费用集合
     }
   })
+  console.log(props.handlingFee)
 })
+
 // 禁用失效时间选择
 const disabledEndDate = (date: any, index: number, Costindex: number) => {
   let start = ruleFeeinfo.value[index].ptlAgreementCostAddList[Costindex]?.effectiveTime;
@@ -300,6 +303,7 @@ const save = async (formEl: FormInstance | undefined | any) => {
       if (formRef) {
         formEl[index].validate((valid: boolean) => {
           if (valid) {
+
             if (!ruleFeeinfo.value[insuranceTypeIndex.value].ptlAgreementCostAddList[index].ruleConditions.length) {
               ElMessage({
                 type: 'error',
@@ -318,7 +322,7 @@ const save = async (formEl: FormInstance | undefined | any) => {
             //     return;
             // }
             const result = checkArrayValues(ruleFeeinfo.value[insuranceTypeIndex.value].ptlAgreementCostAddList[index].ruleConditions as RuleCondition[]);
-            if(!result){
+            if (!result) {
               ElMessage({
                 type: 'error',
                 message: `规则条件不能为空值`,
@@ -326,8 +330,34 @@ const save = async (formEl: FormInstance | undefined | any) => {
               });
               return;
             }
-            if(ruleFeeinfo.value[insuranceTypeIndex.value].ptlAgreementCostAddList[index].ruleConditions.length && result ) {
-                resolve(true);
+            // 检查入口比例是否小于入口手续费比例
+            const hasInvalidItem = formRef.ptlAgreementCostTypeList.some((item: any) => {
+              // 获取当前险种对应的入口手续费比例
+              let entranceFeeRatio = 0;
+              if (item.costType == '交强险') {
+                entranceFeeRatio = props.handlingFee?.jqEntranceFeeRatio || 0;
+              } else if (item.costType == '商业险') {
+                entranceFeeRatio = props.handlingFee?.syEntranceFeeRatio || 0;
+              } else if (item.costType == '驾意险') {
+                entranceFeeRatio = props.handlingFee?.jyEntranceFeeRatio || 0;
+              }
+
+              // 检查入口比例是否小于入口手续费比例(转换为数字比较)
+              if (Number(item.inlet) < Number(entranceFeeRatio)) {
+                ElMessage({
+                  type: 'warning',
+                  message: `${item.costType}入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
+                  plain: true,
+                });
+                return true; // 找到不符合条件的项,中断循环
+              }
+              return false;
+            });
+            if (hasInvalidItem) {
+              return;
+            }
+            if (ruleFeeinfo.value[insuranceTypeIndex.value].ptlAgreementCostAddList[index].ruleConditions.length && result) {
+              resolve(true);
             }
           } else {
             reject(index);
@@ -348,7 +378,7 @@ const save = async (formEl: FormInstance | undefined | any) => {
 
       return val;
     })
-    emits("save",{ptlAgreementCode:props.agreementInfo.agreementCode,ptlAgreementName:props.agreementInfo.agreementTitle,costAddList:ruleFeeinfo.value} )
+    emits("save", { ptlAgreementCode: props.agreementInfo.agreementCode, ptlAgreementName: props.agreementInfo.agreementTitle, costAddList: ruleFeeinfo.value })
   } catch (error) {
     const invalidIndex: any = error; // 获取未通过校验的表单索引
     // const invalidForm = ruleFeeinfo.value[insuranceTypeIndex.value].ptlAgreementCostAddList[invalidIndex]; // 获取未通过校验的表单对象
@@ -364,40 +394,40 @@ const save = async (formEl: FormInstance | undefined | any) => {
   }
 };
 const checkArrayValues = <T, K extends keyof T>(arr: T[]) => {
-    console.log('规则数组', arr)
+  console.log('规则数组', arr)
   // 遍历数组
   for (let item of arr) {
-      // 检查指定键的值是否为空
-      if (item.operator === null || item.operator === undefined || item.operator === "") {
-          return false; // 如果为空,返回 false
-      }
-      if(item.attrType == 'radio') {
-          if (item.min === null || item.min === undefined || item.min === "") {
-              return false; // 如果为空,返回 false
-          }
+    // 检查指定键的值是否为空
+    if (item.operator === null || item.operator === undefined || item.operator === "") {
+      return false; // 如果为空,返回 false
+    }
+    if (item.attrType == 'radio') {
+      if (item.min === null || item.min === undefined || item.min === "") {
+        return false; // 如果为空,返回 false
       }
-      if(item.attrType == 'checkbox' || item.attrType == 'select' || item.attrType == 'inputTag') {
-          if (item.minArray === null || item.minArray === undefined || item.minArray === "") {
-              return false; // 如果为空,返回 false
-          }
+    }
+    if (item.attrType == 'checkbox' || item.attrType == 'select' || item.attrType == 'inputTag') {
+      if (item.minArray === null || item.minArray === undefined || item.minArray === "") {
+        return false; // 如果为空,返回 false
       }
-      if(item.attrType == 'inputNumber' || item.attrType == 'datetime') {
-        if(item.operator == '1' || item.operator == null) {
-            if ((item.min === null || item.min === undefined || item.min === "") || (item.max === null || item.max === undefined || item.max === "")) {
-                return false; // 如果为空,返回 false
-            }
+    }
+    if (item.attrType == 'inputNumber' || item.attrType == 'datetime') {
+      if (item.operator == '1' || item.operator == null) {
+        if ((item.min === null || item.min === undefined || item.min === "") || (item.max === null || item.max === undefined || item.max === "")) {
+          return false; // 如果为空,返回 false
         }
-        if(item.operator == '2' || item.operator == '3') {
-            if(item.min === null || item.min === undefined || item.min === "") {
-                return false; // 如果为空,返回 false
-            }
+      }
+      if (item.operator == '2' || item.operator == '3') {
+        if (item.min === null || item.min === undefined || item.min === "") {
+          return false; // 如果为空,返回 false
         }
-        if(item.operator == '4' || item.operator == '5') {
-            if(item.max === null || item.max === undefined || item.max === "") {
-                return false; // 如果为空,返回 false
-            }
+      }
+      if (item.operator == '4' || item.operator == '5') {
+        if (item.max === null || item.max === undefined || item.max === "") {
+          return false; // 如果为空,返回 false
         }
       }
+    }
   }
   return true; // 如果所有值都不为空,返回 true
 }
@@ -406,58 +436,80 @@ const addRuleCondition = (index: number, Costindex: number) => {
   insuranceTypeIndex.value = index;
   feeIndex.value = Costindex;
   ruleConditionVisible.value = true;
-    RuleConditionRefs.value.ruleAttr(props.agreementInfo.companyId)
+  RuleConditionRefs.value.ruleAttr(props.agreementInfo.companyId)
 }
 
 const handelRK = (scope) => {
-    if(scope.row.export&&scope.row.addThrow || scope.row.export&&scope.row.addThrow === 0) {
-        scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
-    }
-    if(scope.row.export&&scope.row.keepPointRatio) {
-        scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
-    }
-    if(scope.row.keepPointRatio&&scope.row.addThrow || scope.row.keepPointRatio&&scope.row.addThrow === 0) {
-        scope.row.export = scope.row.inlet + scope.row.addThrow - scope.row.keepPointRatio
-    }
+  // 获取当前险种对应的入口手续费比例
+  let entranceFeeRatio = 0;
+  if (scope.row.costType == '交强险') {
+    entranceFeeRatio = props.handlingFee?.jqEntranceFeeRatio || 0;
+  } else if (scope.row.costType == '商业险') {
+    entranceFeeRatio = props.handlingFee?.syEntranceFeeRatio || 0;
+  } else if (scope.row.costType == '驾意险') {
+    entranceFeeRatio = props.handlingFee?.jyEntranceFeeRatio || 0;
+  }
+
+  // 检查入口比例是否小于入口手续费比例
+  if (scope.row.inlet < entranceFeeRatio) {
+    ElMessage({
+      type: 'warning',
+      message: `入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
+      plain: true,
+    });
+    scope.row.inlet = entranceFeeRatio;
+    return;
+  }
+
+  console.log(scope.row)
+  if (scope.row.export && scope.row.addThrow || scope.row.export && scope.row.addThrow === 0) {
+    scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
+  }
+  if (scope.row.export && scope.row.keepPointRatio) {
+    scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
+  }
+  if (scope.row.keepPointRatio && scope.row.addThrow || scope.row.keepPointRatio && scope.row.addThrow === 0) {
+    scope.row.export = scope.row.inlet + scope.row.addThrow - scope.row.keepPointRatio
+  }
 }
 const handelCK = (scope) => {
-    if(scope.row.inlet&&scope.row.addThrow || scope.row.inlet&&scope.row.addThrow === 0) {
-        scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
-    }
-    if(scope.row.inlet&&scope.row.keepPointRatio) {
-        scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
-    }
-    if(scope.row.keepPointRatio&&scope.row.addThrow || scope.row.keepPointRatio&&scope.row.addThrow === 0) {
-        scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
-    }
-    if(scope.row.keepPointRatio) {
-        scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
-    }
+  if (scope.row.inlet && scope.row.addThrow || scope.row.inlet && scope.row.addThrow === 0) {
+    scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
+  }
+  if (scope.row.inlet && scope.row.keepPointRatio) {
+    scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
+  }
+  if (scope.row.keepPointRatio && scope.row.addThrow || scope.row.keepPointRatio && scope.row.addThrow === 0) {
+    scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
+  }
+  if (scope.row.keepPointRatio) {
+    scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
+  }
 }
 const handelJT = (scope) => {
-    if(scope.row.inlet&&scope.row.export) {
-        scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
-    }
-    if(scope.row.inlet&&scope.row.keepPointRatio) {
-        scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
-    }
-    if(scope.row.keepPointRatio&&scope.row.export) {
-        scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
-    }
+  if (scope.row.inlet && scope.row.export) {
+    scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
+  }
+  if (scope.row.inlet && scope.row.keepPointRatio) {
+    scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
+  }
+  if (scope.row.keepPointRatio && scope.row.export) {
+    scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
+  }
 }
 const handelLD = (scope) => {
-    if(scope.row.inlet&&scope.row.export) {
-        scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
-    }
-    if(scope.row.inlet&&scope.row.addThrow || scope.row.inlet&&scope.row.addThrow === 0) {
-        scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
-    }
-    if(scope.row.addThrow&&scope.row.export || scope.row.addThrow === 0&&scope.row.export) {
-        scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
-    }
-    if(scope.row.export) {
-        scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
-    }
+  if (scope.row.inlet && scope.row.export) {
+    scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
+  }
+  if (scope.row.inlet && scope.row.addThrow || scope.row.inlet && scope.row.addThrow === 0) {
+    scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
+  }
+  if (scope.row.addThrow && scope.row.export || scope.row.addThrow === 0 && scope.row.export) {
+    scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
+  }
+  if (scope.row.export) {
+    scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
+  }
 }
 
 //对应险种下添加费用

+ 25 - 4
src/views/quoteConfig/agreement/components/ruleFeeDialogEdit.vue

@@ -97,9 +97,9 @@
             <el-table-column prop="costType" label="类型"></el-table-column>
             <el-table-column prop="costType" label="入口手续费比例" width="150" align="center" v-if="costitemEditInfo.jqEntranceFeeRatio  || costitemEditInfo.syEntranceFeeRatio || costitemEditInfo.jyEntranceFeeRatio">
               <template #default="scope">
-                  <span v-if="scope.$index == 0">{{costitemEditInfo.jqEntranceFeeRatio}}%</span>
-                  <span v-if="scope.$index == 1">{{costitemEditInfo.syEntranceFeeRatio}}%</span>
-                  <span v-if="scope.$index == 2">{{costitemEditInfo.jyEntranceFeeRatio}}%</span>
+                  <span v-if="scope.row.costType == '交强险'">{{costitemEditInfo.jqEntranceFeeRatio}}%</span>
+                  <span v-if="scope.row.costType == '商业险'">{{costitemEditInfo.syEntranceFeeRatio}}%</span>
+                  <span v-if="scope.row.costType == '驾意险'">{{costitemEditInfo.jyEntranceFeeRatio}}%</span>
               </template>
             </el-table-column>
             <el-table-column prop="inlet" label="入口比例" width="160" align="center">
@@ -179,7 +179,7 @@
 <!-- 行为区域 -->
 <script lang='ts' setup>
 import { ref, } from 'vue'
-import { DrawerProps, ComponentSize, ElMessageBox } from 'element-plus';
+import { DrawerProps, ComponentSize, ElMessageBox, ElMessage } from 'element-plus';
 import { loadDicts } from '@/utils/composables/dictService';//字典组件
 const direction = ref<DrawerProps['direction']>('rtl')
 const fromSize = ref<ComponentSize>('default')
@@ -241,6 +241,27 @@ const addRules = () => {
 }
 
 const handelRK = (scope) => {
+ // 获取当前险种对应的入口手续费比例
+ let entranceFeeRatio = 0;
+  if (scope.row.costType == '交强险') {
+    entranceFeeRatio = costitemEditInfo.value?.jqEntranceFeeRatio || 0;
+  } else if (scope.row.costType == '商业险') {
+    entranceFeeRatio = costitemEditInfo.value?.syEntranceFeeRatio || 0;
+  } else if (scope.row.costType == '驾意险') {
+    entranceFeeRatio = costitemEditInfo.value?.jyEntranceFeeRatio || 0;
+  }
+
+  // 检查入口比例是否小于入口手续费比例
+  if (scope.row.inlet < entranceFeeRatio) {
+    ElMessage({
+      type: 'warning',
+      message: `入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
+      plain: true,
+    });
+    scope.row.inlet = entranceFeeRatio;
+    return;
+  }
+
     if(scope.row.export&&scope.row.addThrow || scope.row.export&&scope.row.addThrow === 0) {
         scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
     }