Commit d43a6e0bf009e2344c92ead2b571347323c46704
Merge branch 'fix/DEFECT-2073' into 'main_dev'
fix: 修复物模型标识符验证错误 See merge request yunteng/thingskit-front!1336
Showing
1 changed file
with
4 additions
and
3 deletions
... | ... | @@ -38,15 +38,16 @@ |
38 | 38 | const handleValidateHasSameIdentifier = (formValue?: StructJSON) => { |
39 | 39 | const { identifier } = formValue || {}; |
40 | 40 | const message = '存在一致的标识符'; |
41 | - | |
42 | 41 | if (unref(currentMode) === DataActionModeEnum.CREATE) { |
43 | 42 | if (props.value.filter((item) => item.identifier === identifier).length >= 1) { |
44 | 43 | createMessage.warn(message); |
45 | 44 | return Promise.reject(message); |
46 | 45 | } |
47 | 46 | } else { |
48 | - const index = props.value.findIndex((item) => item.identifier === formValue?.identifier); | |
49 | - if (index !== unref(currentEditIndex)) { | |
47 | + const list = [...props.value]; | |
48 | + list.splice(unref(currentEditIndex), 1, formValue!); | |
49 | + const existLength = list.filter((item) => item?.identifier === formValue?.identifier).length; | |
50 | + if (existLength > 1) { | |
50 | 51 | createMessage.warn(message); |
51 | 52 | return Promise.reject(message); |
52 | 53 | } | ... | ... |