Showing
2 changed files
with
12 additions
and
3 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-03-29 17:44:24 | 2 | * @Date: 2023-03-29 17:44:24 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-03-30 11:04:24 | 4 | + * @LastEditTime: 2023-04-18 15:29:10 |
| 5 | * @FilePath: /data-table/src/components/SignField/MyComponent.vue | 5 | * @FilePath: /data-table/src/components/SignField/MyComponent.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -200,6 +200,8 @@ const cancelSign = () => { | ... | @@ -200,6 +200,8 @@ const cancelSign = () => { |
| 200 | 200 | ||
| 201 | // 此处传入的值会替代 Field 组件内部的 value | 201 | // 此处传入的值会替代 Field 组件内部的 value |
| 202 | useCustomFieldValue(() => sign_value.value); | 202 | useCustomFieldValue(() => sign_value.value); |
| 203 | + | ||
| 204 | +defineExpose({ handleReset }); | ||
| 203 | </script> | 205 | </script> |
| 204 | 206 | ||
| 205 | <style lang="less" scoped> | 207 | <style lang="less" scoped> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-06 16:29:31 | 2 | * @Date: 2022-09-06 16:29:31 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-03-29 17:58:28 | 4 | + * @LastEditTime: 2023-04-18 15:34:06 |
| 5 | * @FilePath: /data-table/src/components/SignField/index.vue | 5 | * @FilePath: /data-table/src/components/SignField/index.vue |
| 6 | * @Description: 电子签名控件 | 6 | * @Description: 电子签名控件 |
| 7 | --> | 7 | --> |
| ... | @@ -13,13 +13,14 @@ | ... | @@ -13,13 +13,14 @@ |
| 13 | </div> | 13 | </div> |
| 14 | <van-field :name="item.key" :rules="rules" style="padding: 0;"> | 14 | <van-field :name="item.key" :rules="rules" style="padding: 0;"> |
| 15 | <template #input> | 15 | <template #input> |
| 16 | - <my-component /> | 16 | + <my-component ref="refComponent" /> |
| 17 | </template> | 17 | </template> |
| 18 | </van-field> | 18 | </van-field> |
| 19 | </div> | 19 | </div> |
| 20 | </template> | 20 | </template> |
| 21 | 21 | ||
| 22 | <script setup> | 22 | <script setup> |
| 23 | +import { showSuccessToast, showFailToast } from 'vant'; | ||
| 23 | import MyComponent from './MyComponent.vue'; | 24 | import MyComponent from './MyComponent.vue'; |
| 24 | 25 | ||
| 25 | const props = defineProps({ | 26 | const props = defineProps({ |
| ... | @@ -32,11 +33,17 @@ const HideShow = computed(() => { | ... | @@ -32,11 +33,17 @@ const HideShow = computed(() => { |
| 32 | return !props.item.component_props.disabled | 33 | return !props.item.component_props.disabled |
| 33 | }) | 34 | }) |
| 34 | 35 | ||
| 36 | +const refComponent = ref(null) | ||
| 37 | + | ||
| 35 | // 规则校验 | 38 | // 规则校验 |
| 36 | const required = props.item.component_props.required; | 39 | const required = props.item.component_props.required; |
| 37 | const validator = (val) => { | 40 | const validator = (val) => { |
| 38 | if (required && !val.url) { | 41 | if (required && !val.url) { |
| 39 | return false; | 42 | return false; |
| 43 | + } else if (!val.url) { // 处理生成URL可能为空情况 | ||
| 44 | + showFailToast('电子签名保存失败,请重新生成') | ||
| 45 | + refComponent.value.handleReset(); | ||
| 46 | + return false; | ||
| 40 | } else { | 47 | } else { |
| 41 | return true; | 48 | return true; |
| 42 | } | 49 | } | ... | ... |
-
Please register or login to post a comment