Commit 7c2ad0ef2d4809731cc2cf0c8d8f9755054753e4
1 parent
4331f4fc
fix: DEFECT-1261 修复看板管理编辑切换前端组件需要重新选择属性
Showing
3 changed files
with
15 additions
and
4 deletions
| ... | ... | @@ -294,8 +294,9 @@ |
| 294 | 294 | watch( |
| 295 | 295 | () => props.frontId, |
| 296 | 296 | async (target, oldTarget) => { |
| 297 | - if (isControlComponent(oldTarget!) && isControlComponent(target!)) return; | |
| 298 | - await resetFormFields(); | |
| 297 | + if ([isControlComponent(oldTarget!), isControlComponent(target!)].some(Boolean)) { | |
| 298 | + await resetFormFields(); | |
| 299 | + } | |
| 299 | 300 | } |
| 300 | 301 | ); |
| 301 | 302 | ... | ... |
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | import { useCalcGridLayout } from '../../hook/useCalcGridLayout'; |
| 15 | 15 | import { FrontComponent } from '../../const/const'; |
| 16 | 16 | import { frontComponentMap } from '../../components/help'; |
| 17 | + import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface'; | |
| 17 | 18 | |
| 18 | 19 | interface DataComponentRouteParams extends RouteParams { |
| 19 | 20 | id: string; |
| ... | ... | @@ -75,7 +76,14 @@ |
| 75 | 76 | unref(isEdit) ? handleUpdateComponent(value) : handleAddComponent(value); |
| 76 | 77 | resetForm(); |
| 77 | 78 | } catch (error: unknown) { |
| 78 | - window.console.error(error); | |
| 79 | + if ( | |
| 80 | + ((error || {}) as ValidateErrorEntity).errorFields && | |
| 81 | + ((error || {}) as ValidateErrorEntity).errorFields.length | |
| 82 | + ) { | |
| 83 | + const tooltip = ((error || {}) as ValidateErrorEntity).errorFields[0]; | |
| 84 | + createMessage.warning(tooltip.errors[0]); | |
| 85 | + } | |
| 86 | + throw error; | |
| 79 | 87 | } |
| 80 | 88 | }; |
| 81 | 89 | |
| ... | ... | @@ -97,7 +105,7 @@ |
| 97 | 105 | closeModal(); |
| 98 | 106 | emit('create'); |
| 99 | 107 | } catch (error) { |
| 100 | - console.log(error); | |
| 108 | + throw error; | |
| 101 | 109 | // createMessage.error('创建失败'); |
| 102 | 110 | } finally { |
| 103 | 111 | changeOkLoading(false); | ... | ... |
| ... | ... | @@ -289,6 +289,7 @@ export const dataSourceSchema = (isEdit: boolean, frontId?: FrontComponent): For |
| 289 | 289 | component: 'ApiSelect', |
| 290 | 290 | label: '命令类型', |
| 291 | 291 | defaultValue: CommandTypeEnum.CUSTOM.toString(), |
| 292 | + rules: [{ required: true, message: '请选择命令类型' }], | |
| 292 | 293 | colProps: { span: 8 }, |
| 293 | 294 | ifShow: ({ model }) => |
| 294 | 295 | isControlComponent(frontId!) && isTcpProfile(model[DataSourceField.TRANSPORT_TYPE]), |
| ... | ... | @@ -347,6 +348,7 @@ export const dataSourceSchema = (isEdit: boolean, frontId?: FrontComponent): For |
| 347 | 348 | component: 'Input', |
| 348 | 349 | label: '命令', |
| 349 | 350 | colProps: { span: 8 }, |
| 351 | + rules: [{ required: true, message: '请输入下发命令' }], | |
| 350 | 352 | // 是控制组件 && 自定义命令 && 传输协议为TCP |
| 351 | 353 | ifShow: ({ model }) => |
| 352 | 354 | isControlComponent(frontId!) && | ... | ... |