update:自定义正则

This commit is contained in:
2025-11-12 09:53:22 +08:00
parent 7c36c79bb8
commit f38448e5ce
2 changed files with 16 additions and 2 deletions

View File

@@ -39,12 +39,14 @@ interface Props {
tableName: string;
colNum?: number;
showDisabled?: boolean;
ruleData?: any;
}
const props = withDefaults(defineProps<Props>(), {
tableName: '',
colNum: 1,
showDisabled: false,
ruleData: {},
});
onMounted(() => {
@@ -109,6 +111,16 @@ const getHeadDataFun = () => {
});
}
});
for (const key in props.ruleData) {
props.ruleData[key].forEach((rule: any) => {
const validator = rule.validator;
rulesObj[key].push({
message: rule.message,
trigger: rule.trigger,
validator: (rule: any, value: any, callback: any) => validatorFun(rule, value, callback, validator),
});
});
}
rules.value = rulesObj;
tableData.value = data;
formOptionsFormat(tableData.value);

View File

@@ -98,7 +98,7 @@
<template #default="{ row, column, $rowIndex }">
<template v-if="$slots[`${item.key}-edit`] || $slots[item.key]">
<template v-if="$slots[item.key] && !(editData[$rowIndex] && editData[$rowIndex][`${item.key}-edit`])">
<span class="table-cell" @dblclick="dblclickFun($rowIndex, item, !!$slots[`${item.key}-edit`])">
<span class="table-cell" :class="{edit: !!$slots[`${item.key}-edit`]}" @dblclick="dblclickFun($rowIndex, item, !!$slots[`${item.key}-edit`])">
<slot :name="item.key" :row="row" :column="column" />
</span>
</template>
@@ -433,7 +433,9 @@ defineExpose({
width: 100%;
height: calc(100% - 32px - 10px);
.table-cell {
cursor: pointer;
&.edit {
cursor: pointer;
}
}
}
}