3f690ac9 by lihua

fix

1 parent 8a8e0e2e
......@@ -1525,7 +1525,7 @@ const panelChange = (scope, row) => {
</el-tooltip>
<!-- 输入框右上角显示验证按钮 -->
<span v-if="item.validateBtn" style="position: absolute;right: 0;top: 0px" class="text_btn" @click="item.validateBtn.click">{{ item.validateBtn.label }}</span>
<div v-if="item.validateMsg?.msg" class="validate-input-after-msg" :style="{ color: item.validateMsg.status == 'success' ? '#4FA55D' : '#E63E33', right: item.validateMsg.status == 'success' ? '-106px' : '-120px' }"><el-icon class="title-icon"><CircleCloseFilled v-if="item.validateMsg.status != 'success'" />
<div v-if="item.validateMsg?.msg" class="validate-input-after-msg" :style="{ color: item.validateMsg.status == 'success' ? '#4FA55D' : '#E63E33' }"><el-icon class="title-icon"><CircleCloseFilled v-if="item.validateMsg.status != 'success'" />
<CircleCheckFilled v-else /></el-icon><span class="title_text">{{ item.validateMsg?.msg }}</span></div>
<span v-if="item.afterMsg" style="color: #212121">{{ item.afterMsg }}</span>
</div>
......@@ -2501,8 +2501,8 @@ const panelChange = (scope, row) => {
display: flex;
align-items: center;
position: absolute;
top: 26px;
right: -120px;
top: 54px;
left: 0px;
:deep(.el-icon) {
width: 16px;
......@@ -2513,4 +2513,8 @@ const panelChange = (scope, row) => {
}
}
}
.mb8 {
margin-bottom: 8px;
}
</style>
......
......@@ -90,7 +90,7 @@ const tableInfo = ref({
matchEnValue.value.value = labelRuleField.matchEnValue;
matchEnValue.value.disabled = false;
formRows.value = labelRuleField.vagueMatchRule || [{ matchValue: '', position: '', name: '', disabled: false }];
tabsInfo.value.activeName = 'labelRuleField';
let labelRuleContent = detail.labelRuleContent || {};
ruleContentFormItems.value[1].visible = labelRuleContent.ruleType == 1;
......@@ -298,10 +298,10 @@ const newCreateLabelDialogInfo = ref({
},
submit: (btn, info) => {
// 需要验证两个
let validateRuleField = () => {
if (!matchChValue.value.value && !matchEnValue.value.value && (!formRows.value.length || (formRows.value.length == 1 && formRows.value[0].matchValue &&
let validateRuleField = (showMsg = true) => {
if (!matchChValue.value.value && !matchEnValue.value.value && (!formRows.value.length || (formRows.value.length == 1 && !formRows.value[0].matchValue &&
!formRows.value[0].position && !formRows.value[0].name))) {
proxy.$ElMessage.error('字段识别匹配规则不能为空');
showMsg && proxy.$ElMessage.error('字段识别匹配规则不能为空');
return false;
}
for (let i = 0; i < formRows.value.length; i++) {
......@@ -311,7 +311,7 @@ const newCreateLabelDialogInfo = ref({
continue; // 如果全为空,跳过这一行的校验
}
if (!row.matchValue || !row.position || !row.name) {
proxy.$ElMessage.error('请填写完整的模糊匹配规则');
showMsg && proxy.$ElMessage.error('请填写完整的模糊匹配规则');
return false;
}
}
......@@ -388,18 +388,42 @@ const newCreateLabelDialogInfo = ref({
})
}
} else { //只需匹配一项即可。
if (!matchChValue.value.value && !matchEnValue.value.value && (!formRows.value.length || (formRows.value.length == 1 && formRows.value[0].matchValue &&
!formRows.value[0].position && !formRows.value[0].name))) { // 没有配置字段识别内容
if (tabsInfo.value.activeName == 'labelRuleField') { //先验证字段识别
if (!matchChValue.value.value && !matchEnValue.value.value && (!formRows.value.length || (formRows.value.length == 1 && (!formRows.value[0].matchValue &&
!formRows.value[0].position && !formRows.value[0].name)))) { // 没有配置字段识别内容
ruleContentFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
submitLabel();
} else {
proxy.$ElMessage.error('字段识别和内容识别不能同时为空');
return;
}
})
} else {
ruleContentFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
submitLabel(); //只需要满足一个即可。
} else {
ruleContentFormRef.value?.ruleFormRef?.clearValidate(['builtInRuleCode', 'regularExpression', 'hitRate']);// 先清除验证
// 去 验证 字段识别
if (!validateRuleField(true)) {
return;
}
submitLabel();
}
})
}
} else {
ruleContentFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
submitLabel();
submitLabel(); //只需要满足一个即可。
} else {
proxy.$ElMessage.error('字段识别和内容识别不能同时为空');
return;
if (!validateRuleField(false)) {
return;
}
submitLabel();
}
})
} else {
submitLabel();
}
}
}
......@@ -471,6 +495,8 @@ const handleCreate = () => {
matchEnValue.value.disabled = false;
formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
tabsInfo.value.activeName = 'labelRuleField';
ruleContentFormItems.value[1].visible = true;
ruleContentFormItems.value[2].visible = false;
ruleContentFormItems.value.forEach(item => {
......@@ -544,7 +570,8 @@ const ruleContentFormItems = ref([{
default: '',
required: false,
clearable: true,
block: false,
col: 'mb8',
block: true,
visible: true,
validateBtn: {
value: 'validate',
......@@ -583,7 +610,7 @@ const ruleContentFormItems = ref([{
}, {
label: '命中率设置(%)',
type: 'input',
placeholder: '请输入0~100',
placeholder: '请输入1~100',
field: 'hitRate',
min: 1,
max: 100,
......@@ -593,7 +620,7 @@ const ruleContentFormItems = ref([{
block: true,
clearable: true,
visible: true,
width: '110px',
width: '100px',
beforeMsg: '一列数据中的非空数据,大于等于',
afterMsg: ' %的数据符合以上识别条件,则认为命中该识别规则。'
}]);
......@@ -817,8 +844,9 @@ onBeforeMount(() => {
.add-Icon {
display: flex;
align-items: center;
margin-top: 13px;
margin-top: 4px;
width: 50%;
margin-left: -4px;
.el-icon svg {
height: 19px;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!