Showing
2 changed files
with
21 additions
and
1 deletions
... | ... | @@ -37,7 +37,6 @@ |
37 | 37 | const getBindProps = computed<Recordable>(() => { |
38 | 38 | const { value, apiTreeSelectProps = {} } = props; |
39 | 39 | const { params = {} } = apiTreeSelectProps; |
40 | - console.log(props, 'props'); | |
41 | 40 | return { |
42 | 41 | replaceFields: { children: 'children', key: 'id', title: 'name', value: 'id' }, |
43 | 42 | getPopupContainer: () => document.body, | ... | ... |
... | ... | @@ -78,6 +78,27 @@ |
78 | 78 | componentProps: { |
79 | 79 | placeholder: '示例:{"code":"3654"}', |
80 | 80 | }, |
81 | + dynamicRules: () => { | |
82 | + return [ | |
83 | + { | |
84 | + required: true, | |
85 | + validator: (_, value) => { | |
86 | + try { | |
87 | + if (typeof value == 'object') { | |
88 | + return Promise.resolve(); | |
89 | + } else { | |
90 | + if (typeof JSON.parse(value) == 'object') { | |
91 | + return Promise.resolve(); | |
92 | + } | |
93 | + return Promise.reject('请输入JSON格式例如{"code":"123"}'); | |
94 | + } | |
95 | + } catch { | |
96 | + return Promise.reject('请输入JSON格式例如{"code":"123"}'); | |
97 | + } | |
98 | + }, | |
99 | + }, | |
100 | + ]; | |
101 | + }, | |
81 | 102 | }, |
82 | 103 | { |
83 | 104 | field: 'remark', | ... | ... |