update:复制

This commit is contained in:
2026-03-05 20:59:42 +08:00
parent 7f966783ff
commit 2471a4f458
2 changed files with 27 additions and 4 deletions

View File

@@ -14,6 +14,18 @@
<div class="toper">
<div class="total">{{ tableData.length }}个列表字段</div>
<div class="add-btn">
<el-input
class="copy-name"
v-model="copyName"
placeholder="请输入要同步的表头名称"
clearable
>
<template #append>
<el-button :disabled="!copyName || disabled" @click="copyFun">
同步表头数据
</el-button>
</template>
</el-input>
<!-- <el-button type="primary" plain @click="previewVisible = true">预览列表</el-button> -->
<el-button v-if="!disabled" type="primary" :icon="Plus" @click="addFun">
新增字段
@@ -325,9 +337,9 @@ watch(
}
);
const getHeadDataFun = () => {
const getHeadDataFun = (name?: string) => {
const params = {
formName: props.name,
formName: name || props.name,
};
getFormConfigureApi(params).then((res: any) => {
if (res.code === 200) {
@@ -386,9 +398,16 @@ const rowDragendFun = () => {
tableData.value = vxeTableRef.value.getFullData();
};
const copyName = ref('');
const closeFun = () => {
copyName.value = '';
emit('update:modelValue', false);
};
const copyFun = () => {
getHeadDataFun(copyName.value);
};
</script>
<style lang="scss">
@@ -406,7 +425,11 @@ const closeFun = () => {
color: var(--el-text-color-secondary);
}
.add-btn {
display: flex;
text-align: right;
.copy-name {
margin-right: 16px;
}
}
}
.table {

View File

@@ -43,8 +43,8 @@ const choseList = ref<any>([]);
const emit = defineEmits(['update:modelValue', 'change', 'clear']);
const getUserDataByKeyFun = (query: string) => {
// 2个或更多汉字或者4个或更多 (汉字+英文+数字)
const regex = /^([\u4e00-\u9fa5]{2,}|[\u4e00-\u9fa5a-zA-Z0-9]{4,})$/;
// 1个或更多汉字或者4个或更多 (汉字+英文+数字)
const regex = /^([\u4e00-\u9fa5]{1,}|[\u4e00-\u9fa5a-zA-Z0-9]{4,})$/;
if (!query || !regex.test(query)) {
listData.value = [];
return;