hookehuyr

🐞 fix(上传图片和上传文件组件): 通过规则隐藏的必填字段需要忽略校验

1 <!-- 1 <!--
2 * @Date: 2022-08-31 16:16:49 2 * @Date: 2022-08-31 16:16:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-06-17 09:57:29 4 + * @LastEditTime: 2024-07-27 08:08:34
5 * @FilePath: /data-table/src/components/FileUploaderField/index.vue 5 * @FilePath: /data-table/src/components/FileUploaderField/index.vue
6 * @Description: 文件上传控件 6 * @Description: 文件上传控件
7 --> 7 -->
...@@ -329,11 +329,15 @@ const uploadQiniu = async (file, token, name, md5) => { ...@@ -329,11 +329,15 @@ const uploadQiniu = async (file, token, name, md5) => {
329 329
330 // 校验模块 330 // 校验模块
331 const validFileUploader = () => { 331 const validFileUploader = () => {
332 - // 必填项 未上传文件 332 + if (props.item.component_props.disabled) { // 通过规则隐藏的属性,不校验
333 - if (props.item.component_props.required && !fileList.value.length) {
334 - show_empty.value = true;
335 - } else {
336 show_empty.value = false; 333 show_empty.value = false;
334 + } else {
335 + // 必填项 未上传文件
336 + if (props.item.component_props.required && !fileList.value.length) {
337 + show_empty.value = true;
338 + } else {
339 + show_empty.value = false;
340 + }
337 } 341 }
338 return !show_empty.value; 342 return !show_empty.value;
339 }; 343 };
......
1 <!-- 1 <!--
2 * @Date: 2022-08-31 16:16:49 2 * @Date: 2022-08-31 16:16:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-06-17 10:04:35 4 + * @LastEditTime: 2024-07-27 08:06:38
5 * @FilePath: /data-table/src/components/ImageUploaderField/index.vue 5 * @FilePath: /data-table/src/components/ImageUploaderField/index.vue
6 * @Description: 图片上传控件 6 * @Description: 图片上传控件
7 --> 7 -->
...@@ -361,11 +361,15 @@ const uploadQiniu = async (file, token, name, md5) => { ...@@ -361,11 +361,15 @@ const uploadQiniu = async (file, token, name, md5) => {
361 361
362 // 校验模块 362 // 校验模块
363 const validImageUploader = () => { 363 const validImageUploader = () => {
364 - // 必填项 未上传图片 364 + if (props.item.component_props.disabled) { // 通过规则隐藏的属性,不校验
365 - if (props.item.component_props.required && !fileList.value.length) {
366 - show_empty.value = true;
367 - } else {
368 show_empty.value = false; 365 show_empty.value = false;
366 + } else {
367 + // 必填项 未上传图片
368 + if (props.item.component_props.required && !fileList.value.length) {
369 + show_empty.value = true;
370 + } else {
371 + show_empty.value = false;
372 + }
369 } 373 }
370 return !show_empty.value; 374 return !show_empty.value;
371 }; 375 };
......