Commit a9144f5c by yancanhua

feat: 上传组件修改

1 parent 36081662
...@@ -29,7 +29,6 @@ const rules = ref({}); ...@@ -29,7 +29,6 @@ const rules = ref({});
//加载中 //加载中
const pageLoading = ref(false); const pageLoading = ref(false);
watch(() => props.leafNodes, (nodes) => { watch(() => props.leafNodes, (nodes) => {
pageLoading.value = true; pageLoading.value = true;
columnsList.value = (nodes || []).map((item: any) => ({ ...item, value: getValueText(item), })); columnsList.value = (nodes || []).map((item: any) => ({ ...item, value: getValueText(item), }));
...@@ -125,8 +124,17 @@ async function validate(): Promise<CustomizeFormValidateResult> { ...@@ -125,8 +124,17 @@ async function validate(): Promise<CustomizeFormValidateResult> {
let message = ''; let message = '';
columnsList.value.forEach((item: any) => { columnsList.value.forEach((item: any) => {
if (item.required == 1 && !item.value) { if (item.required == 1 && !item.value) {
let title = '请选择';
const inputList = ['text_input', 'textarea_input', 'number_input'];
const dropdownList = ['image_upload', 'video_upload'];
if (inputList.includes(item.interactionType)) {
title = '请输入';
}
if (dropdownList.includes(item.interactionType)) {
title = '请上传';
}
success = false; success = false;
message = message ? message : item.nodeName; message = message ? message : title + item.nodeName;
} }
}); });
return { return {
......
...@@ -63,8 +63,13 @@ function setupdate() { ...@@ -63,8 +63,13 @@ function setupdate() {
valueKey: item || '', valueKey: item || '',
}; };
}); });
props.item.value = JSON.stringify(valueList || []); if (valueList.length) {
emit("update", JSON.stringify(valueList || [])); props.item.value = JSON.stringify(valueList || []);
emit("update", JSON.stringify(valueList || []));
} else {
props.item.value = '';
emit("update", '');
}
} }
</script> </script>
......
...@@ -71,8 +71,13 @@ function handleDelete(item: string) { ...@@ -71,8 +71,13 @@ function handleDelete(item: string) {
} }
function updateData() { function updateData() {
props.item.value = JSON.stringify(pickerValue.value); if (pickerValue.value.length) {
emit("update", JSON.stringify(pickerValue.value)); props.item.value = JSON.stringify(pickerValue.value);
emit("update", JSON.stringify(pickerValue.value));
} else {
props.item.value = '';
emit("update", '');
}
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!