lzh 1 ماه پیش
والد
کامیت
1e8664d977
1فایلهای تغییر یافته به همراه129 افزوده شده و 0 حذف شده
  1. 129 0
      src/views/rule/config/components/CreateDialog.vue

+ 129 - 0
src/views/rule/config/components/CreateDialog.vue

@@ -389,6 +389,46 @@
                           </el-select>
                         </div>
                       </el-col>
+                      <el-col v-else-if="sItem.condition === '重复率'" :span="9">
+                        <el-row :gutter="8">
+                          <el-col :span="10">
+                            <!-- 第二参数选择 -->
+                            <div class="rule-condition">
+                              <el-input
+                                :value="getDisplayName(sItem.param2_object)"
+                                placeholder="请选择比较对象"
+                                size="small"
+                                readonly
+                                style="width: 100%;"
+                              />
+                              <el-button
+                                size="small"
+                                style="width: 90px; position: absolute; right: 0; top: 0; opacity: 0;"
+                                @click="openCategoryDialog(index, sIndex, 'param2_object')"
+                              />
+                            </div>
+                          </el-col>
+                          <el-col :span="2">
+                            <div class="text-center" style="line-height: 36px;">≥</div>
+                          </el-col>
+                          <el-col :span="8">
+                            <!-- 重复率值输入 -->
+                            <el-input-number
+                              v-model="sItem.subtract_value"
+                              :precision="1"
+                              :step="0.1"
+                              :max="100"
+                              :min="0"
+                              controls-position="right"
+                              placeholder="重复率"
+                              style="width: 100%;"
+                            />
+                          </el-col>
+                          <el-col :span="2">
+                            <div class="text-left" style="line-height: 36px; padding-left: 5px;">%</div>
+                          </el-col>
+                        </el-row>
+                      </el-col>
                       <el-col :span="2">
                         <div class="button-group">
                           <el-button
@@ -651,6 +691,46 @@
                           </el-select>
                         </div>
                       </el-col>
+                      <el-col v-else-if="sItem.condition === '重复率'" :span="9">
+                        <el-row :gutter="8">
+                          <el-col :span="10">
+                            <!-- 第二参数选择 -->
+                            <div class="rule-condition">
+                              <el-input
+                                :value="getDisplayName(sItem.param2_object)"
+                                placeholder="请选择比较对象"
+                                size="small"
+                                readonly
+                                style="width: 100%;"
+                              />
+                              <el-button
+                                size="small"
+                                style="width: 90px; position: absolute; right: 0; top: 0; opacity: 0;"
+                                @click="openCategoryDialog(index, sIndex, 'param2_object')"
+                              />
+                            </div>
+                          </el-col>
+                          <el-col :span="2">
+                            <div class="text-center" style="line-height: 36px;">≥</div>
+                          </el-col>
+                          <el-col :span="8">
+                            <!-- 重复率值输入 -->
+                            <el-input-number
+                              v-model="sItem.subtract_value"
+                              :precision="1"
+                              :step="0.1"
+                              :max="100"
+                              :min="0"
+                              controls-position="right"
+                              placeholder="重复率"
+                              style="width: 100%;"
+                            />
+                          </el-col>
+                          <el-col :span="2">
+                            <div class="text-left" style="line-height: 36px; padding-left: 5px;">%</div>
+                          </el-col>
+                        </el-row>
+                      </el-col>
                       <el-col :span="2">
                         <div class="button-group">
                           <el-button
@@ -1217,6 +1297,14 @@ export default {
             if (item.hasChildOptions && typeof item.param2 === 'string' && item.param2) {
               item.param2 = item.param2.split(',')
             }
+            // 处理重复率条件的param2
+            if (item.condition === '重复率' && item.param2) {
+              // 将形如 "bllb294_295_2023.BLTD" 的字符串解析为对象数组
+              const parts = item.param2.split('.')
+              if (parts.length === 2) {
+                item.param2_object = [parts[0], parts[1]]
+              }
+            }
           })
         })
         this.ruleForm.rule = ruleList
@@ -1229,6 +1317,14 @@ export default {
             if (item.hasChildOptions && typeof item.param2 === 'string' && item.param2) {
               item.param2 = item.param2.split(',')
             }
+            // 处理重复率条件的param2
+            if (item.condition === '重复率' && item.param2) {
+              // 将形如 "bllb294_295_2023.BLTD" 的字符串解析为对象数组
+              const parts = item.param2.split('.')
+              if (parts.length === 2) {
+                item.param2_object = [parts[0], parts[1]]
+              }
+            }
           })
         })
         this.ruleForm.qztj = preRuleList
@@ -1283,6 +1379,7 @@ export default {
           {
             param1: '',
             param2: '',
+            param2_object: null, // 添加这个字段存储对象选择
             condition: '包含',
             categoryType: '文本',
             sx_1: '',
@@ -1307,6 +1404,7 @@ export default {
       this.ruleForm.qztj[index].condition_content.push({
         param1: '',
         param2: '',
+        param2_object: null, // 添加这个字段存储对象选择
         condition: '包含',
         categoryType: 'text',
         sx_1: '',
@@ -1329,6 +1427,7 @@ export default {
       this.ruleForm.rule[index].condition_content.push({
         param1: '',
         param2: '',
+        param2_object: null, // 添加这个字段存储对象选择
         condition: '包含',
         subtract_param: '',
         subtract_condition: '',
@@ -1451,6 +1550,18 @@ export default {
                     item.param2 = `${parentField}.${item.subtract_param[1]}`
                   }
                 }
+                // 对重复率条件的特殊处理
+                if (item.condition === '重复率') {
+                  // 确保param2格式正确
+                  if (item.param2_object && Array.isArray(item.param2_object)) {
+                    const [field1, field2] = item.param2_object
+                    item.param2 = `${field1}.${field2}`
+                  }
+                  // 确保subtract_value是数字格式
+                  if (item.subtract_value !== undefined) {
+                    item.subtract_value = Number(item.subtract_value)
+                  }
+                }
               })
             }
 
@@ -1714,6 +1825,23 @@ export default {
               condition.subtract_param = [parentField, subItem.field]
             }
           }
+        } else if (this.currentSource === 'param2_object') {
+          // 判断是在前置条件还是质控逻辑中
+          if (this.currentInputSource === 'qztj') {
+            const condition = this.ruleForm.qztj[this.currentRuleIndex].condition_content[this.currentConditionIndex]
+            if (condition) {
+              // 存储完整的对象选择,而不只是字段名
+              condition.param2_object = [parentField, subItem.field]
+              // 同时更新param2为字符串表示形式,用于提交
+              condition.param2 = `${parentField}.${subItem.field}`
+            }
+          } else {
+            const condition = this.ruleForm.rule[this.currentRuleIndex].condition_content[this.currentConditionIndex]
+            if (condition) {
+              condition.param2_object = [parentField, subItem.field]
+              condition.param2 = `${parentField}.${subItem.field}`
+            }
+          }
         }
       }
       this.categoryDialogVisible = false
@@ -1788,6 +1916,7 @@ export default {
           {
             param1: '',
             param2: '',
+            param2_object: null, // 添加这个字段存储对象选择
             condition: '包含',
             categoryType: 'text',
             sx_1: '',