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,12 +329,16 @@ const uploadQiniu = async (file, token, name, md5) => { ...@@ -329,12 +329,16 @@ const uploadQiniu = async (file, token, name, md5) => {
329 329
330 // 校验模块 330 // 校验模块
331 const validFileUploader = () => { 331 const validFileUploader = () => {
332 + if (props.item.component_props.disabled) { // 通过规则隐藏的属性,不校验
333 + show_empty.value = false;
334 + } else {
332 // 必填项 未上传文件 335 // 必填项 未上传文件
333 if (props.item.component_props.required && !fileList.value.length) { 336 if (props.item.component_props.required && !fileList.value.length) {
334 show_empty.value = true; 337 show_empty.value = true;
335 } else { 338 } else {
336 show_empty.value = false; 339 show_empty.value = false;
337 } 340 }
341 + }
338 return !show_empty.value; 342 return !show_empty.value;
339 }; 343 };
340 344
......
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,12 +361,16 @@ const uploadQiniu = async (file, token, name, md5) => { ...@@ -361,12 +361,16 @@ const uploadQiniu = async (file, token, name, md5) => {
361 361
362 // 校验模块 362 // 校验模块
363 const validImageUploader = () => { 363 const validImageUploader = () => {
364 + if (props.item.component_props.disabled) { // 通过规则隐藏的属性,不校验
365 + show_empty.value = false;
366 + } else {
364 // 必填项 未上传图片 367 // 必填项 未上传图片
365 if (props.item.component_props.required && !fileList.value.length) { 368 if (props.item.component_props.required && !fileList.value.length) {
366 show_empty.value = true; 369 show_empty.value = true;
367 } else { 370 } else {
368 show_empty.value = false; 371 show_empty.value = false;
369 } 372 }
373 + }
370 return !show_empty.value; 374 return !show_empty.value;
371 }; 375 };
372 376
......