|
|
@ -38,31 +38,46 @@
|
|
|
|
type: Array,
|
|
|
|
type: Array,
|
|
|
|
default: () => {
|
|
|
|
default: () => {
|
|
|
|
return []
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 表单id
|
|
|
|
// 表单id
|
|
|
|
id: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 表单名称
|
|
|
|
// 表单名称
|
|
|
|
name: {
|
|
|
|
name: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
default: '',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
isTransfer: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
default: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setup(props) {
|
|
|
|
emits: ['TransferData'],
|
|
|
|
|
|
|
|
setup(props, context) {
|
|
|
|
const { t } = useI18n()
|
|
|
|
const { t } = useI18n()
|
|
|
|
// 添加表单到表单设置
|
|
|
|
// 添加表单到表单设置
|
|
|
|
const addFormToSet = () => {
|
|
|
|
const addFormToSet = () => {
|
|
|
|
const columns = props.formSchema.map((item: FormSchema) => {
|
|
|
|
if (props.isTransfer) {
|
|
|
|
|
|
|
|
context.emit('TransferData')
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
FnaddFormToSet(null)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const FnaddFormToSet = (e) => {
|
|
|
|
|
|
|
|
let data: any = e ? e : props.formSchema
|
|
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const columns = data.map((item: FormSchema) => {
|
|
|
|
const res = {
|
|
|
|
const res = {
|
|
|
|
defaultValue: item.defaultValue || '',
|
|
|
|
defaultValue: item.defaultValue || '',
|
|
|
|
field: item.field || '',
|
|
|
|
field: item.field || '',
|
|
|
|
label: item.label || '',
|
|
|
|
label: item.label || '',
|
|
|
|
required: item.required || false,
|
|
|
|
required: item.required || false,
|
|
|
|
colProps: item.colProps || { span: 24 },
|
|
|
|
colProps: item.colProps || { span: 24 },
|
|
|
|
component: item.component
|
|
|
|
component: item.component,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 定义默认显示字段
|
|
|
|
// 定义默认显示字段
|
|
|
|
if (item.show !== false) {
|
|
|
|
if (item.show !== false) {
|
|
|
@ -80,22 +95,25 @@
|
|
|
|
templateName: props.name,
|
|
|
|
templateName: props.name,
|
|
|
|
permissionName: permissionsInfo().permissionName,
|
|
|
|
permissionName: permissionsInfo().permissionName,
|
|
|
|
content: JSON.stringify({
|
|
|
|
content: JSON.stringify({
|
|
|
|
columns: columns
|
|
|
|
columns: columns,
|
|
|
|
})
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
editCodeGoodsType(Apidata).then(res => {
|
|
|
|
editCodeGoodsType(Apidata)
|
|
|
|
if (res.succeeded) {
|
|
|
|
.then((res) => {
|
|
|
|
createMessage.success('添加成功!')
|
|
|
|
if (res.succeeded) {
|
|
|
|
}
|
|
|
|
createMessage.success('添加成功!')
|
|
|
|
}).catch(() => {
|
|
|
|
}
|
|
|
|
createMessage.error('添加失败!')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
|
|
|
|
createMessage.error('添加失败!')
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
t,
|
|
|
|
t,
|
|
|
|
addFormToSet
|
|
|
|
addFormToSet,
|
|
|
|
|
|
|
|
FnaddFormToSet,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
@ -103,4 +121,4 @@
|
|
|
|
.config-form {
|
|
|
|
.config-form {
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|