Commit 6a601e832665913dc01ebe47306b78816378f25d
Merge branch 'fix/DEFECT-1529' into 'main_dev'
fix: 修改告警配置新增联系人成功但是显示无效参数 See merge request yunteng/thingskit-front!839
Showing
2 changed files
with
14 additions
and
3 deletions
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | mode="multiple" |
17 | 17 | v-model:value="model[field]" |
18 | 18 | :options="alarmContactOptions.map((item) => ({ value: item.value, label: item.label }))" |
19 | + @change="handleChange" | |
19 | 20 | > |
20 | 21 | <template #dropdownRender="{ menuNode: menu }"> |
21 | 22 | <v-nodes :vnodes="menu" /> |
... | ... | @@ -82,6 +83,7 @@ |
82 | 83 | const [registerAlarmContactDrawer, { openDrawer }] = useDrawer(); |
83 | 84 | async function handleSuccess() { |
84 | 85 | //获取告警联系人 |
86 | + if (!unref(orgId)) return; | |
85 | 87 | const res = await byOrgIdGetAlarmContact(orgId.value); |
86 | 88 | if (res) { |
87 | 89 | alarmContactOptions.value = res.map((m) => { |
... | ... | @@ -91,6 +93,10 @@ |
91 | 93 | alarmContactOptions.value = []; |
92 | 94 | } |
93 | 95 | } |
96 | + | |
97 | + const handleChange = () => { | |
98 | + validateFields(['alarmContactId']); | |
99 | + }; | |
94 | 100 | // 新增或编辑 |
95 | 101 | const handleOpenAlarmContact = () => { |
96 | 102 | openDrawer(true, { |
... | ... | @@ -100,7 +106,10 @@ |
100 | 106 | const isUpdate = ref(true); |
101 | 107 | let allData: any = reactive({}); |
102 | 108 | const editId = ref(''); |
103 | - const [registerForm, { validate, setFieldsValue, resetFields, updateSchema }] = useForm({ | |
109 | + const [ | |
110 | + registerForm, | |
111 | + { validate, setFieldsValue, resetFields, updateSchema, validateFields }, | |
112 | + ] = useForm({ | |
104 | 113 | labelWidth: 120, |
105 | 114 | schemas: formSchema, |
106 | 115 | showActionButtonGroup: false, |
... | ... | @@ -191,6 +200,7 @@ |
191 | 200 | handleOpenAlarmContact, |
192 | 201 | registerAlarmContactDrawer, |
193 | 202 | handleSuccess, |
203 | + handleChange, | |
194 | 204 | }; |
195 | 205 | }, |
196 | 206 | }); | ... | ... |
... | ... | @@ -86,6 +86,7 @@ |
86 | 86 | const deviceIdKeys = Object.keys(details); |
87 | 87 | const detailObject = deviceIdKeys.map((key) => ({ label: key, value: details[key] })); |
88 | 88 | const dataFormat = await handleAlarmDetailFormat(deviceIdKeys); |
89 | + console.log(detailObject, dataFormat, 'dataFormat'); | |
89 | 90 | const dataFormats = detailObject.reduce((acc: any, curr: any) => { |
90 | 91 | dataFormat.forEach((item) => { |
91 | 92 | if (item.tbDeviceId === curr.label) { |
... | ... | @@ -130,10 +131,10 @@ |
130 | 131 | const handleAlarmDetailFormat = async (keys: string[]) => { |
131 | 132 | const temp: any = []; |
132 | 133 | for (let item of keys) { |
133 | - if (item === 'key' || item === 'data') return; //旧数据则终止 | |
134 | + if (item === 'key' || item === 'data') return []; //旧数据则终止 | |
134 | 135 | const deviceDetailRes = await getDeviceDetail(item); |
135 | 136 | const { deviceProfileId } = deviceDetailRes; |
136 | - if (!deviceProfileId) return; | |
137 | + if (!deviceProfileId) return []; | |
137 | 138 | const attributeRes = await getAttribute(deviceProfileId); |
138 | 139 | const dataFormat: any = handleDataFormat(deviceDetailRes, attributeRes); |
139 | 140 | temp.push(dataFormat); | ... | ... |