Commit c6920454ee664461c8a93dada63629c6fd7f5a0d
Merge branch 'ft-dev' into 'main'
feat:新增设备配置设为默认配置,新增表格两个字段,type和default,fix:修改设备配置第三步页面调整 See merge request huang/yun-teng-iot-front!149
Showing
17 changed files
with
351 additions
and
257 deletions
... | ... | @@ -11,7 +11,8 @@ VITE_PUBLIC_PATH = / |
11 | 11 | # VITE_PROXY = [["/api","http://192.168.10.108:8080/api"]] |
12 | 12 | |
13 | 13 | # 线上 |
14 | -VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | |
14 | +# VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | |
15 | +VITE_PROXY = [["/api","http://47.99.141.212:8080/api"]] | |
15 | 16 | |
16 | 17 | # 实时数据的ws地址 |
17 | 18 | VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | ... | ... |
... | ... | @@ -16,6 +16,7 @@ enum EDeviceConfigApi { |
16 | 16 | ALARM_CONTACT_GET_PAGE = '/alarmContact', |
17 | 17 | DEVICE_CONFIG_EXPORT = '/deviceProfile/export', |
18 | 18 | DEVICE_CONFIG_IMPORT = '/deviceProfile/import', |
19 | + SET_DEVICE_ISDEFAULT = '/deviceProfile', | |
19 | 20 | } |
20 | 21 | |
21 | 22 | /** |
... | ... | @@ -97,3 +98,19 @@ export const deviceConfigImport = (params: IDeviceConfigAddOrEditModel) => { |
97 | 98 | params, |
98 | 99 | }); |
99 | 100 | }; |
101 | + | |
102 | +/** | |
103 | + * | |
104 | + * 设置该设备配置为默认 | |
105 | + */ | |
106 | +export const setDeviceProfileIsDefaultApi = (id: string, v, params?: {}) => { | |
107 | + return defHttp.post( | |
108 | + { | |
109 | + url: EDeviceConfigApi.SET_DEVICE_ISDEFAULT + '/' + id + '/' + v, | |
110 | + params, | |
111 | + }, | |
112 | + { | |
113 | + joinPrefix: false, | |
114 | + } | |
115 | + ); | |
116 | +}; | ... | ... |
... | ... | @@ -46,20 +46,6 @@ export async function deleteTenantProfileApi(ids: string) { |
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
49 | -// export async function deleteTenantProfileApi(ids: string[]) { | |
50 | -// await defHttp.delete( | |
51 | -// { | |
52 | -// url: Api.deleteTenantProfile, | |
53 | -// data: { | |
54 | -// ids: ids, | |
55 | -// }, | |
56 | -// }, | |
57 | -// { | |
58 | -// joinPrefix: false, | |
59 | -// } | |
60 | -// ); | |
61 | -// } | |
62 | - | |
63 | 49 | export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { |
64 | 50 | return defHttp.get({ |
65 | 51 | url: Api.getTenantProfile, | ... | ... |
... | ... | @@ -18,17 +18,20 @@ |
18 | 18 | </a-steps> |
19 | 19 | </div> |
20 | 20 | <div class="mt-5"> |
21 | + <!-- 设备配置 --> | |
21 | 22 | <div v-show="current === 0"> |
22 | 23 | <DeviceProfileStep1 ref="DeviceProfileStep1Ref" @next="handleStepNext1" |
23 | 24 | /></div> |
24 | - | |
25 | + <!-- 设备配置 --> | |
26 | + <!-- 传输配置 --> | |
25 | 27 | <div v-show="current === 1"> |
26 | 28 | <DeviceProfileStep2 |
27 | 29 | ref="DeviceProfileStep2Ref" |
28 | 30 | @prev="handleStepPrev" |
29 | 31 | @next="handleStep2Next" |
30 | 32 | /></div> |
31 | - | |
33 | + <!-- 传输配置 --> | |
34 | + <!-- 告警配置 --> | |
32 | 35 | <div v-show="current === 2"> |
33 | 36 | <DeviceProfileStep3 |
34 | 37 | ref="DeviceProfileStep3Ref" |
... | ... | @@ -39,9 +42,12 @@ |
39 | 42 | :isAddOrEdit="isStatus" |
40 | 43 | :isShowAddRule="isShowRule" |
41 | 44 | /></div> |
45 | + <!-- 告警配置 --> | |
46 | + <!-- 告警通知 --> | |
42 | 47 | <div v-show="current === 3"> |
43 | 48 | <DeviceProfileStep4 ref="DeviceProfileStep4Ref" @prev="handleStepPrev" /> |
44 | 49 | </div> |
50 | + <!-- 告警通知 --> | |
45 | 51 | </div> |
46 | 52 | </BasicModal> |
47 | 53 | </div> |
... | ... | @@ -113,7 +119,6 @@ |
113 | 119 | const isShowOkBtnFalse = ref(true); |
114 | 120 | const isShowRule = ref(true); |
115 | 121 | const isEditAndChange = ref(true); |
116 | - | |
117 | 122 | const getTitle = computed(() => |
118 | 123 | isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情' |
119 | 124 | ); |
... | ... | @@ -127,18 +132,19 @@ |
127 | 132 | current.value = 0; |
128 | 133 | isStatus.value = !data.isUpdate; |
129 | 134 | //清空第一步数据 |
130 | - proxy.$refs.DeviceProfileStep1Ref.resetIconFunc(); | |
131 | - proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); | |
132 | - proxy.$refs.DeviceProfileStep3Ref.clearAllRegisterFormFunc(); | |
135 | + proxy.$refs.DeviceProfileStep1Ref?.resetIconFunc(); | |
136 | + proxy.$refs.DeviceProfileStep1Ref?.customResetStepOneFunc(); | |
137 | + proxy.$refs.DeviceProfileStep3Ref?.clearProfileDataFunc1(); | |
138 | + proxy.$refs.DeviceProfileStep3Ref?.deleteClearCondition(); | |
133 | 139 | //报警详细信息 |
134 | - proxy.$refs.DeviceProfileStep3Ref.setRegisterFormChangeDetailFunc({ | |
140 | + proxy.$refs.DeviceProfileStep3Ref?.setRegisterFormChangeDetailFunc({ | |
135 | 141 | isEditStatus: false, |
136 | 142 | stepThreeData: {}, |
137 | 143 | }); |
138 | 144 | } else if (isUpdate.value == 2) { |
139 | 145 | isGetStepThreeData.profileData.alarms.length = 0; |
140 | 146 | try { |
141 | - proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc(); | |
147 | + proxy.$refs.DeviceProfileStep3Ref?.clearEditAllRegisterFormFunc(); | |
142 | 148 | } catch (e) { |
143 | 149 | return e; |
144 | 150 | } |
... | ... | @@ -161,7 +167,6 @@ |
161 | 167 | }); |
162 | 168 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); |
163 | 169 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); |
164 | - // emit('success'); | |
165 | 170 | } else if (isUpdate.value == 3) { |
166 | 171 | postEditId.value = data.record.id; |
167 | 172 | getBackendData = await deviceConfigGetDetail(postEditId.value); |
... | ... | @@ -182,36 +187,32 @@ |
182 | 187 | }); |
183 | 188 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); |
184 | 189 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); |
185 | - // emit('success'); | |
186 | 190 | } |
187 | 191 | }); |
188 | 192 | function handleStepPrev() { |
189 | 193 | current.value--; |
190 | 194 | } |
195 | + //第一步 | |
191 | 196 | function handleStepNext1(v, v1) { |
192 | 197 | current.value++; |
193 | 198 | getStepOneData.value = v; |
194 | 199 | getStepOneData.value.icon = v1; |
195 | 200 | if (isUpdate.value == 1) { |
196 | 201 | } else if (isUpdate.value == 2) { |
197 | - return proxy.$refs.DeviceProfileStep2Ref.setStepTwoFieldsValueFunc({ | |
202 | + proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc({ | |
198 | 203 | transportType: editData.value?.profileData.transportConfiguration.type, |
199 | 204 | }); |
200 | 205 | } else if (isUpdate.value == 3) { |
201 | - return proxy.$refs.DeviceProfileStep2Ref.setStepTwoFieldsValueFunc({ | |
206 | + proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc({ | |
202 | 207 | transportType: editData.value?.profileData.transportConfiguration.type, |
203 | 208 | }); |
204 | 209 | } |
205 | 210 | } |
211 | + //第二步 | |
206 | 212 | function handleStep2Next(v) { |
207 | 213 | current.value++; |
208 | 214 | getStepTwoData.value = v; |
209 | 215 | if (isUpdate.value == 1) { |
210 | - try { | |
211 | - proxy.$refs.DeviceProfileStep3Ref.initAddAlarmRuleFunc(); | |
212 | - proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); | |
213 | - proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc(); | |
214 | - } catch {} | |
215 | 216 | } else if (isUpdate.value == 2) { |
216 | 217 | try { |
217 | 218 | proxy.$refs.DeviceProfileStep3Ref.setAlaramTypeFormFunc({ |
... | ... | @@ -265,6 +266,7 @@ |
265 | 266 | } catch {} |
266 | 267 | } |
267 | 268 | } |
269 | + //第三步 | |
268 | 270 | function handleStep3Next(v, v1) { |
269 | 271 | isEditAndChange.value = v1; |
270 | 272 | current.value++; |
... | ... | @@ -285,7 +287,6 @@ |
285 | 287 | function handleRedo() { |
286 | 288 | current.value = 0; |
287 | 289 | } |
288 | - | |
289 | 290 | const handleSubmit = async () => { |
290 | 291 | if (isUpdate.value == 1) { |
291 | 292 | isGetStepThreeData.profileData.alarms = getStepThreeData.value; |
... | ... | @@ -333,18 +334,19 @@ |
333 | 334 | emit('success'); |
334 | 335 | } |
335 | 336 | }; |
336 | - | |
337 | 337 | const handleCancel = () => { |
338 | 338 | closeModal(); |
339 | 339 | try { |
340 | - proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); | |
341 | - proxy.$refs.DeviceProfileStep3Ref.clearDetailTemplateFunc(); | |
342 | - proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc(); | |
343 | - proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc(); | |
344 | - emit('success'); | |
345 | - } catch (e) { | |
346 | - return e; | |
347 | - } | |
340 | + proxy.$refs.DeviceProfileStep1Ref?.customResetStepOneFunc(); | |
341 | + proxy.$refs.DeviceProfileStep2Ref?.customClearStepTwoValueFunc(); | |
342 | + proxy.$refs.DeviceProfileStep3Ref?.resetAlarmSeverityRefFunc(); | |
343 | + proxy.$refs.DeviceProfileStep3Ref?.resetRegisterFormCreateAlarmFunc(); | |
344 | + proxy.$refs.DeviceProfileStep3Ref?.clearDetailTemplateFunc(); | |
345 | + proxy.$refs.DeviceProfileStep3Ref?.clearEditAllRegisterFormFunc(); | |
346 | + proxy.$refs.DeviceProfileStep3Ref?.clearAllRegisterFormFunc(); | |
347 | + proxy.$refs.DeviceProfileStep4Ref?.clearAlaramContactAndNoticeMethodFunc(); | |
348 | + proxy.$refs.DeviceProfileStep3Ref?.clearProfileDataFunc1(); | |
349 | + } catch {} | |
348 | 350 | }; |
349 | 351 | return { |
350 | 352 | isShowRule, | ... | ... |
... | ... | @@ -6,24 +6,29 @@ import { numberRule } from '/@/utils/rules'; |
6 | 6 | |
7 | 7 | export const columns: BasicColumn[] = [ |
8 | 8 | { |
9 | - title: '配置名称', | |
9 | + title: '创建时间', | |
10 | + dataIndex: 'createTime', | |
11 | + width: 150, | |
12 | + }, | |
13 | + { | |
14 | + title: '名称', | |
10 | 15 | dataIndex: 'name', |
11 | - width: 200, | |
16 | + width: 150, | |
12 | 17 | }, |
13 | 18 | { |
14 | - title: '传输协议', | |
15 | - dataIndex: 'transportType', | |
16 | - width: 200, | |
19 | + title: '配置类型', | |
20 | + dataIndex: 'type', | |
21 | + width: 100, | |
17 | 22 | }, |
18 | 23 | { |
19 | - title: '创建时间', | |
20 | - dataIndex: 'createTime', | |
21 | - width: 180, | |
24 | + title: '传输方式', | |
25 | + dataIndex: 'transportType', | |
26 | + width: 100, | |
22 | 27 | }, |
23 | 28 | { |
24 | 29 | title: '描述', |
25 | 30 | dataIndex: 'description', |
26 | - width: 180, | |
31 | + width: 150, | |
27 | 32 | }, |
28 | 33 | ]; |
29 | 34 | ... | ... |
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <template #toolbar> |
10 | 10 | <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> |
11 | 11 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
12 | - <a-button @click="handleImport"> 导入设备配置 </a-button> | |
12 | + <a-button disabled @click="handleImport"> 导入设备配置 </a-button> | |
13 | 13 | </ImpExcel> |
14 | 14 | <a-button danger color="error" @click="handleTableDel" :disabled="disabled"> |
15 | 15 | 批量删除 |
... | ... | @@ -19,6 +19,11 @@ |
19 | 19 | <TableAction |
20 | 20 | :actions="[ |
21 | 21 | { |
22 | + label: '设置为默认', | |
23 | + icon: 'ant-design:profile-outlined', | |
24 | + onClick: handleSetDefault.bind(null, record), | |
25 | + }, | |
26 | + { | |
22 | 27 | label: '详情', |
23 | 28 | icon: 'ant-design:eye-outlined', |
24 | 29 | onClick: handleDetailView.bind(null, record), |
... | ... | @@ -41,6 +46,9 @@ |
41 | 46 | title: '是否确认删除', |
42 | 47 | confirm: handleDelete.bind(null, record), |
43 | 48 | }, |
49 | + ifShow: () => { | |
50 | + return record.default === false; | |
51 | + }, | |
44 | 52 | }, |
45 | 53 | ]" |
46 | 54 | /> |
... | ... | @@ -55,7 +63,11 @@ |
55 | 63 | import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table'; |
56 | 64 | import { columns, searchFormSchema } from './device.profile.data'; |
57 | 65 | import { useMessage } from '/@/hooks/web/useMessage'; |
58 | - import { deviceConfigGetQuery, deviceConfigDelete } from '/@/api/device/deviceConfigApi'; | |
66 | + import { | |
67 | + deviceConfigGetQuery, | |
68 | + deviceConfigDelete, | |
69 | + setDeviceProfileIsDefaultApi, | |
70 | + } from '/@/api/device/deviceConfigApi'; | |
59 | 71 | import { useModal } from '/@/components/Modal'; |
60 | 72 | import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue'; |
61 | 73 | import { ImpExcel, ExcelData } from '/@/components/Excel'; |
... | ... | @@ -220,7 +232,32 @@ |
220 | 232 | function handleSuccess() { |
221 | 233 | reload(); |
222 | 234 | } |
235 | + const handleSetDefault = async (record: Recordable) => { | |
236 | + let id = record.id; | |
237 | + const obj = { | |
238 | + headers: { | |
239 | + normalizedNames: {}, | |
240 | + lazyUpdate: null, | |
241 | + }, | |
242 | + params: { | |
243 | + updates: null, | |
244 | + cloneFrom: null, | |
245 | + encoder: {}, | |
246 | + map: null, | |
247 | + interceptorConfig: { | |
248 | + ignoreLoading: false, | |
249 | + ignoreErrors: false, | |
250 | + resendRequest: false, | |
251 | + }, | |
252 | + }, | |
253 | + }; | |
254 | + const data = await setDeviceProfileIsDefaultApi(id, 'default', obj); | |
255 | + if (!data) return createMessage.error('设置该设备配置为默认失败'); | |
256 | + createMessage.success('设置该设备配置为默认成功'); | |
257 | + reload(); | |
258 | + }; | |
223 | 259 | return { |
260 | + handleSetDefault, | |
224 | 261 | disabled, |
225 | 262 | deviceDetailRef, |
226 | 263 | // setRowClassName, | ... | ... |
1 | 1 | <template> |
2 | 2 | <div class="step2"> |
3 | - <BasicForm @register="register" /> | |
3 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" /> | |
4 | + <div | |
5 | + style=" | |
6 | + display: flex; | |
7 | + width: 11vw; | |
8 | + height: 4vh; | |
9 | + flex-direction: row; | |
10 | + justify-content: space-between; | |
11 | + margin-left: 8vw; | |
12 | + margin-top: -4vh; | |
13 | + " | |
14 | + > | |
15 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
16 | + <Button type="default" style="border-radius: 2px" class="mt-5" @click="customResetFunc" | |
17 | + >上一步</Button | |
18 | + > | |
19 | + </div> | |
20 | + <div style="display: flex; width: 4vw; height: 4vh"> | |
21 | + <Button type="default" class="mt-5" @click="customSubmitFunc"> 下一步</Button> | |
22 | + </div> | |
23 | + </div> | |
4 | 24 | </div> |
5 | 25 | </template> |
6 | 26 | <script lang="ts"> |
... | ... | @@ -8,6 +28,7 @@ |
8 | 28 | import { BasicForm, useForm } from '/@/components/Form'; |
9 | 29 | import { step2Schemas } from './data'; |
10 | 30 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
31 | + import { Button } from '/@/components/Button'; | |
11 | 32 | |
12 | 33 | export default defineComponent({ |
13 | 34 | components: { |
... | ... | @@ -16,6 +37,7 @@ |
16 | 37 | [Divider.name]: Divider, |
17 | 38 | [Descriptions.name]: Descriptions, |
18 | 39 | [Descriptions.Item.name]: Descriptions.Item, |
40 | + Button, | |
19 | 41 | }, |
20 | 42 | emits: ['next', 'prev', 'register'], |
21 | 43 | setup(_, { emit }) { |
... | ... | @@ -25,14 +47,6 @@ |
25 | 47 | actionColOptions: { |
26 | 48 | span: 14, |
27 | 49 | }, |
28 | - resetButtonOptions: { | |
29 | - text: '上一步', | |
30 | - }, | |
31 | - submitButtonOptions: { | |
32 | - text: '下一步', | |
33 | - }, | |
34 | - resetFunc: customResetFunc, | |
35 | - submitFunc: customSubmitFunc, | |
36 | 50 | }); |
37 | 51 | const setStepTwoFieldsValueFunc = (v) => { |
38 | 52 | setFieldsValue(v); |
... | ... | @@ -52,7 +66,13 @@ |
52 | 66 | } finally { |
53 | 67 | } |
54 | 68 | } |
55 | - return { register, setStepTwoFieldsValueFunc, customClearStepTwoValueFunc }; | |
69 | + return { | |
70 | + customResetFunc, | |
71 | + customSubmitFunc, | |
72 | + register, | |
73 | + setStepTwoFieldsValueFunc, | |
74 | + customClearStepTwoValueFunc, | |
75 | + }; | |
56 | 76 | }, |
57 | 77 | }); |
58 | 78 | </script> | ... | ... |
... | ... | @@ -181,7 +181,7 @@ |
181 | 181 | v-if="isAddRuleStatus" |
182 | 182 | style="border-radius: 10px" |
183 | 183 | class="mt-5" |
184 | - @click="addCreateRole(index)" | |
184 | + @click="addCreateRule(index)" | |
185 | 185 | ><PlusCircleOutlined />添加创建条件</a-button |
186 | 186 | > |
187 | 187 | </div> |
... | ... | @@ -189,8 +189,8 @@ |
189 | 189 | <!-- 创建报警规则 --> |
190 | 190 | <div style="height: 20px"></div> |
191 | 191 | <!-- 清除报警规则 --> |
192 | - <div> | |
193 | - <p style="margin-left: 10px; font-size: medium">清除报警规则</p> | |
192 | + <div v-if="clearRuleStatus || getStepThreeEditStatus"> | |
193 | + <p style="margin-left: 10px; font-size: medium; position: relative">清除报警规则</p> | |
194 | 194 | <template |
195 | 195 | v-for="(childClearItem, clearIndexItem) in item.clearRule" |
196 | 196 | :key="childClearItem.id" |
... | ... | @@ -294,6 +294,29 @@ |
294 | 294 | </div> |
295 | 295 | </div> |
296 | 296 | </template> |
297 | + <!-- 移除按钮 --> | |
298 | + <div | |
299 | + class="remove-type" | |
300 | + style="display: inline-block; position: relative; top: -21.2vh; left: 41.4vw" | |
301 | + > | |
302 | + <img | |
303 | + v-if="isAddRuleStatus" | |
304 | + style="cursor: pointer" | |
305 | + @click="deleteClearCondition" | |
306 | + alt="移除" | |
307 | + src="../../../../assets/images/close.png" | |
308 | + /> | |
309 | + </div> | |
310 | + <!-- 移除按钮 --> | |
311 | + </div> | |
312 | + <div> | |
313 | + <a-button | |
314 | + v-if="isAddRuleStatus" | |
315 | + style="border-radius: 10px; margin-top: -2vh" | |
316 | + class="mt-5" | |
317 | + @click="addClearRuleStatus" | |
318 | + ><PlusCircleOutlined />清除报警规则</a-button | |
319 | + > | |
297 | 320 | </div> |
298 | 321 | <!-- 清除报警规则 --> |
299 | 322 | </CollapseContainer> |
... | ... | @@ -470,8 +493,9 @@ |
470 | 493 | const createAlarmArray = ref<[]>([]); |
471 | 494 | const isLostFocuxStatus = ref(true); |
472 | 495 | const editIndex = ref(-1); |
473 | - const allAlarmsData = ref<[]>([]); | |
474 | - let allAlarmsSingleObj = reactive({}); | |
496 | + // const allAlarmsData = ref<[]>([]); | |
497 | + // let allAlarmsSingleObj = reactive({}); | |
498 | + const clearRuleStatus = ref(false); | |
475 | 499 | |
476 | 500 | setTimeout(() => { |
477 | 501 | getIsShowAddRule = props.isShowAddRule; |
... | ... | @@ -483,6 +507,9 @@ |
483 | 507 | const clearProfileDataFunc = () => { |
484 | 508 | profileData.value.splice(0, 1); |
485 | 509 | }; |
510 | + const clearProfileDataFunc1 = () => { | |
511 | + profileData.value.length = 0; | |
512 | + }; | |
486 | 513 | //删除告警配置 |
487 | 514 | const deleteAlarmRule = (index: number) => { |
488 | 515 | profileData.value.splice(index, 1); |
... | ... | @@ -552,33 +579,45 @@ |
552 | 579 | const clearEditAllRegisterFormFunc = () => { |
553 | 580 | getFilterStepThreeEditArr.value.length = 0; |
554 | 581 | getFilterStepThreeEditArr.value = []; |
555 | - try { | |
556 | - proxy.$refs.alarmSeverityRef.resetFieldsFunc(); | |
557 | - } catch {} | |
558 | 582 | }; |
559 | 583 | |
560 | 584 | //重置表单数据 |
561 | 585 | const clearAllRegisterFormFunc = () => { |
562 | 586 | try { |
563 | 587 | setTimeout(() => { |
588 | + //报警类型 | |
564 | 589 | clearAlaramTypeValueFunc(); |
590 | + //传递报警 | |
565 | 591 | clearTransmitAlarmFunc(); |
566 | - resetRegisterFormClearChangeDetailFunc(); | |
592 | + //报警严重程度 | |
593 | + addChangeSeverity.value = {}; | |
594 | + proxy.$refs.alarmSeverityRef?.resetFieldsFunc(); | |
595 | + //报警详情模板 | |
596 | + proxy.$refs.detailTemplateRef?.resetFieldsFunc(); | |
597 | + //清除报警详情模板 | |
598 | + resetRegisterFormClearChangeDetail(); | |
599 | + //重置报警规则条件 | |
600 | + fliterTempRuleConditionTempArr.value = []; | |
601 | + fliterTempRuleConditionTempArr.value.length = 0; | |
602 | + //重置报警启用规则 | |
603 | + fliterTempOpenRuleTempArr.value = []; | |
604 | + fliterTempOpenRuleTempArr.value.length = 0; | |
605 | + //重置清除报警规则条件 | |
606 | + fliterClearTempRuleConditionTempArr.value = []; | |
607 | + fliterClearTempRuleConditionTempArr.value.length = 0; | |
608 | + //重置清除报警启用规则 | |
609 | + fliterClearTempOpenRuleTempArr.value = []; | |
610 | + fliterClearTempOpenRuleTempArr.value.length = 0; | |
567 | 611 | resetAllTemplateFunc(); |
568 | - }, 5000); | |
612 | + }, 10); | |
569 | 613 | } catch {} |
570 | 614 | }; |
615 | + | |
571 | 616 | //重置报警启用规则-报警规则条件 |
572 | 617 | const resetAllTemplateFunc = () => { |
573 | - fliterTempOpenRuleTempArr.value = []; | |
574 | - fliterTempRuleConditionTempArr.value = []; | |
575 | - fliterClearTempRuleConditionTempArr.value = []; | |
576 | - fliterClearTempOpenRuleTempArr.value = []; | |
577 | 618 | allAlarms.value = []; |
578 | 619 | tempDetailTempArr.value = []; |
579 | 620 | addCreateRulesObj.createRules = {}; |
580 | - profileData.value = []; | |
581 | - profileData.value.push(initProfileData); | |
582 | 621 | initClearCreateRuleFunc(); |
583 | 622 | getFilterStepThreeEditArr.value = []; |
584 | 623 | getFilterStepThreeEditClearArr.value = []; |
... | ... | @@ -595,11 +634,6 @@ |
595 | 634 | }); |
596 | 635 | }; |
597 | 636 | |
598 | - //清除修改详情模板 | |
599 | - const resetRegisterFormClearChangeDetailFunc = () => { | |
600 | - resetRegisterFormClearChangeDetail(); | |
601 | - }; | |
602 | - | |
603 | 637 | //回显报警类型和传递报警数据 |
604 | 638 | const setAlaramTypeFormFunc = (v) => { |
605 | 639 | setAlaramTypeValueFunc(v); |
... | ... | @@ -735,13 +769,6 @@ |
735 | 769 | return e; |
736 | 770 | } |
737 | 771 | }; |
738 | - const clearDetailTemplateFunc = () => { | |
739 | - try { | |
740 | - proxy.$refs.detailTemplateRef.resetFieldsFunc(); | |
741 | - } catch (e) { | |
742 | - return e; | |
743 | - } | |
744 | - }; | |
745 | 772 | const getRegisterClearFormChangeDetailFunc = () => { |
746 | 773 | changeGetClearDetailValue.value = getRegisterFormClearChangeDetail(); |
747 | 774 | }; |
... | ... | @@ -768,10 +795,12 @@ |
768 | 795 | //传递报警数据 |
769 | 796 | const validateRegisterFormHighSettingFunc = () => { |
770 | 797 | const val = getTransmitAlarmFunc(); |
771 | - propagateAndpropagateRelationTypes.propagate = val.propagate; | |
772 | - propagateAndpropagateRelationTypes.propagateRelationTypes.push( | |
773 | - val.propagateRelationTypes as never | |
774 | - ); | |
798 | + try { | |
799 | + propagateAndpropagateRelationTypes.propagate = val.propagate; | |
800 | + propagateAndpropagateRelationTypes.propagateRelationTypes.push( | |
801 | + val.propagateRelationTypes as never | |
802 | + ); | |
803 | + } catch {} | |
775 | 804 | }; |
776 | 805 | //报警类型数据 |
777 | 806 | const validateRegisterFormFunc = () => { |
... | ... | @@ -782,33 +811,34 @@ |
782 | 811 | const addAlarmRule = () => { |
783 | 812 | profileData.value.push(initProfileData); |
784 | 813 | addAlarmRuleFunc(); |
814 | + clearAllRegisterFormFunc(); | |
785 | 815 | }; |
786 | 816 | //添加报警规则方法 |
787 | 817 | const addAlarmRuleFunc = () => { |
788 | - validateRegisterFormFunc(); | |
789 | - validateRegisterFormHighSettingFunc(); | |
790 | - addCreateRuleFunc(); | |
791 | - tempDetailTempArr.value.push(changeGetDetailValue.value as never); | |
792 | - tempDetailTempArr.value.forEach((f1) => { | |
793 | - kongDetail.value = f1; | |
794 | - }); | |
795 | - addChangeSeverity.value = proxy.$refs.alarmSeverityRef.getFieldsValueFunc(); | |
796 | - emptyCreateRoleFunc(); | |
797 | - getOpenRuleAndRuleCondition(); | |
798 | - tempOpenRuleTempArr.value.forEach((f2) => { | |
799 | - kongOpenRuleObj.schedule = f2; | |
800 | - }); | |
801 | - tempRuleConditionTempArr.value.forEach((f3) => { | |
802 | - kongRuleConditionObj.condition = f3; | |
803 | - }); | |
804 | - createRulesObj.value[addChangeSeverity.value?.default] = { | |
805 | - ...kongDetail.value, | |
806 | - ...addNewOpenRule, | |
807 | - ...addNewRuleTem, | |
808 | - ...kongOpenRuleObj, | |
809 | - ...kongRuleConditionObj, | |
810 | - }; | |
811 | - console.log(createRulesObj); | |
818 | + // validateRegisterFormFunc(); | |
819 | + // validateRegisterFormHighSettingFunc(); | |
820 | + // addCreateRuleFunc(); | |
821 | + // tempDetailTempArr.value.push(changeGetDetailValue.value as never); | |
822 | + // tempDetailTempArr.value.forEach((f1) => { | |
823 | + // kongDetail.value = f1; | |
824 | + // }); | |
825 | + // addChangeSeverity.value = proxy.$refs.alarmSeverityRef.getFieldsValueFunc(); | |
826 | + // emptyCreateRoleFunc(); | |
827 | + // getOpenRuleAndRuleCondition(); | |
828 | + // tempOpenRuleTempArr.value.forEach((f2) => { | |
829 | + // kongOpenRuleObj.schedule = f2; | |
830 | + // }); | |
831 | + // tempRuleConditionTempArr.value.forEach((f3) => { | |
832 | + // kongRuleConditionObj.condition = f3; | |
833 | + // }); | |
834 | + // createRulesObj.value[addChangeSeverity.value?.default] = { | |
835 | + // ...kongDetail.value, | |
836 | + // ...addNewOpenRule, | |
837 | + // ...addNewRuleTem, | |
838 | + // ...kongOpenRuleObj, | |
839 | + // ...kongRuleConditionObj, | |
840 | + // }; | |
841 | + // console.log(createRulesObj); | |
812 | 842 | // const sigleAlarmTypeGetVal = []; |
813 | 843 | // let sigleAlarmTypeGetObj = {}; |
814 | 844 | // sigleAlarmTypeGetVal.push(alarmTypeGet.value as never); |
... | ... | @@ -823,11 +853,11 @@ |
823 | 853 | }; |
824 | 854 | |
825 | 855 | //初始化添加一个报警规则 |
826 | - const initAddAlarmRuleFunc = () => { | |
827 | - if (profileData.value.length === 0) { | |
828 | - profileData.value.push(initProfileData); | |
829 | - } | |
830 | - }; | |
856 | + // const initAddAlarmRuleFunc = () => { | |
857 | + // if (profileData.value.length === 0) { | |
858 | + // profileData.value.push(initProfileData); | |
859 | + // } | |
860 | + // }; | |
831 | 861 | // 添加创建条件方法 |
832 | 862 | const addCreateRuleFunc = async () => { |
833 | 863 | try { |
... | ... | @@ -876,11 +906,12 @@ |
876 | 906 | }; |
877 | 907 | |
878 | 908 | // 添加创建条件 |
879 | - const addCreateRole = async (index: number) => { | |
909 | + const addCreateRule = async (index: number) => { | |
880 | 910 | profileData.value[index]?.alarms.push(initCreateRules); |
881 | 911 | addCreateRuleFunc(); |
882 | - proxy.$refs.alarmSeverityRef.updateSchemaSelectDisableFunc(); | |
912 | + proxy.$refs.alarmSeverityRef?.updateSchemaSelectDisableFunc(); | |
883 | 913 | }; |
914 | + | |
884 | 915 | // 删除创建条件 |
885 | 916 | const deleteCondition = (index: number, createIndex: number) => { |
886 | 917 | profileData.value[index].alarms.splice(createIndex, 1); |
... | ... | @@ -888,6 +919,13 @@ |
888 | 919 | getFilterStepThreeEditArr.value.pop(); |
889 | 920 | } |
890 | 921 | }; |
922 | + | |
923 | + const addClearRuleStatus = () => { | |
924 | + clearRuleStatus.value = true; | |
925 | + }; | |
926 | + const deleteClearCondition = () => { | |
927 | + clearRuleStatus.value = false; | |
928 | + }; | |
891 | 929 | //报警规则 |
892 | 930 | //启用规则 |
893 | 931 | const getAllFieldsEnabFunc = (v) => { |
... | ... | @@ -1018,13 +1056,11 @@ |
1018 | 1056 | getStepThreeEditStatus.value = false; |
1019 | 1057 | setTimeout(() => { |
1020 | 1058 | openModal3(true); |
1021 | - if (true) { | |
1022 | - try { | |
1023 | - setTimeout(() => { | |
1024 | - proxy.$refs.getChildData3.resetDataFunc(); | |
1025 | - }, 100); | |
1026 | - } catch {} | |
1027 | - } | |
1059 | + try { | |
1060 | + setTimeout(() => { | |
1061 | + proxy.$refs.getChildData3.resetDataFunc(); | |
1062 | + }, 100); | |
1063 | + } catch {} | |
1028 | 1064 | }, 10); |
1029 | 1065 | }; |
1030 | 1066 | const handleOpenClearDetailTemplate = () => { |
... | ... | @@ -1074,6 +1110,10 @@ |
1074 | 1110 | }; |
1075 | 1111 | |
1076 | 1112 | return { |
1113 | + deleteClearCondition, | |
1114 | + clearRuleStatus, | |
1115 | + addClearRuleStatus, | |
1116 | + clearProfileDataFunc1, | |
1077 | 1117 | clearEditAllRegisterFormFunc, |
1078 | 1118 | returnChildItem, |
1079 | 1119 | editIndex, |
... | ... | @@ -1100,7 +1140,7 @@ |
1100 | 1140 | tempOpenRuleTempArr, |
1101 | 1141 | kongOpenRuleObj, |
1102 | 1142 | allAlarms, |
1103 | - initAddAlarmRuleFunc, | |
1143 | + // initAddAlarmRuleFunc, | |
1104 | 1144 | getChildData5, |
1105 | 1145 | getChildData6, |
1106 | 1146 | refAlarmDetailTemplate, |
... | ... | @@ -1139,7 +1179,7 @@ |
1139 | 1179 | addAlarmRule, |
1140 | 1180 | registerForm, |
1141 | 1181 | registerFormHighSetting, |
1142 | - addCreateRole, | |
1182 | + addCreateRule, | |
1143 | 1183 | deleteCondition, |
1144 | 1184 | setCreateRegisterFormChangeDetailFunc, |
1145 | 1185 | detailDetailModelArray, |
... | ... | @@ -1147,7 +1187,6 @@ |
1147 | 1187 | handleClickHidenEdit, |
1148 | 1188 | alarmSeverityRef, |
1149 | 1189 | detailTemplateRef, |
1150 | - clearDetailTemplateFunc, | |
1151 | 1190 | }; |
1152 | 1191 | }, |
1153 | 1192 | }); | ... | ... |
... | ... | @@ -175,7 +175,8 @@ export const formSchema: FormSchema[] = [ |
175 | 175 | field: 'value1', |
176 | 176 | label: '默认值', |
177 | 177 | colProps: { span: 13 }, |
178 | - component: 'Input', | |
178 | + component: 'InputNumber', | |
179 | + defaultValue: 0, | |
179 | 180 | componentProps: { |
180 | 181 | maxLength: 16, |
181 | 182 | placeholder: '请输入值(数字)', |
... | ... | @@ -266,7 +267,8 @@ export const formSchema: FormSchema[] = [ |
266 | 267 | field: 'value1', |
267 | 268 | label: '值', |
268 | 269 | colProps: { span: 13 }, |
269 | - component: 'Input', | |
270 | + component: 'InputNumber', | |
271 | + defaultValue: 0, | |
270 | 272 | componentProps: { |
271 | 273 | placeholder: '请输入值(数字)', |
272 | 274 | }, |
... | ... | @@ -317,7 +319,7 @@ export const formSchema: FormSchema[] = [ |
317 | 319 | ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), |
318 | 320 | }, |
319 | 321 | { |
320 | - field: '', | |
322 | + field: 'no', | |
321 | 323 | label: '默认值', |
322 | 324 | colProps: { span: 13 }, |
323 | 325 | component: 'Checkbox', | ... | ... |
1 | 1 | import { FormSchema } from '/@/components/Form'; |
2 | +import { ref } from 'vue'; | |
3 | + | |
4 | +const isWhereType = ref(''); | |
2 | 5 | |
3 | 6 | export const formSchema: FormSchema[] = [ |
4 | 7 | { |
5 | 8 | field: 'default', |
9 | + component: 'Select', | |
6 | 10 | label: '报警严重程度:', |
11 | + defaultValue: 'CRITICAL', | |
7 | 12 | colProps: { |
8 | 13 | span: 17, |
9 | 14 | }, |
10 | - component: 'Select', | |
11 | - componentProps: { | |
12 | - placeholder: '请选择报警严重程度', | |
13 | - options: [ | |
14 | - { | |
15 | - value: 'CRITICAL', | |
16 | - label: '危险', | |
17 | - disabled: false, | |
18 | - }, | |
19 | - { | |
20 | - value: 'MAJOR', | |
21 | - label: '重要', | |
22 | - disabled: false, | |
23 | - }, | |
24 | - { | |
25 | - value: 'MINOR', | |
26 | - label: '次要', | |
27 | - disabled: false, | |
28 | - }, | |
29 | - { | |
30 | - value: 'WARNING', | |
31 | - label: '警告', | |
32 | - disabled: false, | |
33 | - }, | |
34 | - { | |
35 | - value: 'INDETERMINATE', | |
36 | - label: '不确定', | |
37 | - disabled: false, | |
15 | + componentProps() { | |
16 | + return { | |
17 | + placeholder: '请选择严重程度', | |
18 | + options: [ | |
19 | + { | |
20 | + value: 'CRITICAL', | |
21 | + label: '危险', | |
22 | + }, | |
23 | + { | |
24 | + value: 'MAJOR', | |
25 | + label: '重要', | |
26 | + }, | |
27 | + { | |
28 | + value: 'MINOR', | |
29 | + label: '次要', | |
30 | + }, | |
31 | + { | |
32 | + value: 'WARNING', | |
33 | + label: '警告', | |
34 | + }, | |
35 | + { | |
36 | + value: 'INDETERMINATE', | |
37 | + label: '不确定', | |
38 | + }, | |
39 | + ], | |
40 | + onChange: (v) => { | |
41 | + isWhereType.value = v ? v : 'INDETERMINATE'; | |
38 | 42 | }, |
39 | - ], | |
43 | + }; | |
40 | 44 | }, |
41 | 45 | }, |
42 | 46 | ]; | ... | ... |
... | ... | @@ -31,38 +31,34 @@ |
31 | 31 | fieldValue.value = getFieldsValue(); |
32 | 32 | return fieldValue.value; |
33 | 33 | }; |
34 | + | |
34 | 35 | const item = [ |
35 | 36 | { |
36 | 37 | value: 'CRITICAL', |
37 | 38 | label: '危险', |
38 | - disabled: false, | |
39 | 39 | }, |
40 | 40 | { |
41 | 41 | value: 'MAJOR', |
42 | 42 | label: '重要', |
43 | - disabled: false, | |
44 | 43 | }, |
45 | 44 | { |
46 | 45 | value: 'MINOR', |
47 | 46 | label: '次要', |
48 | - disabled: false, | |
49 | 47 | }, |
50 | 48 | { |
51 | 49 | value: 'WARNING', |
52 | 50 | label: '警告', |
53 | - disabled: false, | |
54 | 51 | }, |
55 | 52 | { |
56 | 53 | value: 'INDETERMINATE', |
57 | 54 | label: '不确定', |
58 | - disabled: false, | |
59 | 55 | }, |
60 | 56 | ]; |
61 | 57 | const updateSchemaSelectDisableFunc = () => { |
62 | 58 | updateSchema({ |
63 | 59 | field: 'default', |
64 | 60 | componentProps: ({ formModel }) => { |
65 | - item.forEach((f) => { | |
61 | + item.forEach((f: any) => { | |
66 | 62 | if (f.value == formModel.default) { |
67 | 63 | f.disabled = true; |
68 | 64 | } | ... | ... |
... | ... | @@ -74,14 +74,7 @@ export const step2Schemas: FormSchema[] = [ |
74 | 74 | label: '传输方式', |
75 | 75 | defaultValue: 'DEFAULT', |
76 | 76 | componentProps: { |
77 | - options: [ | |
78 | - { label: 'DEFAULT', value: 'DEFAULT' }, | |
79 | - { label: 'MQTT', value: 'MQTT' }, | |
80 | - { label: 'TCP', value: 'TCP' }, | |
81 | - { label: 'CoAP', value: 'CoAP' }, | |
82 | - { label: 'LWM2M', value: 'LWM2M' }, | |
83 | - { label: 'SNMP', value: 'SNMP' }, | |
84 | - ], | |
77 | + options: [{ label: '默认', value: 'DEFAULT' }], | |
85 | 78 | }, |
86 | 79 | }, |
87 | 80 | ]; | ... | ... |
... | ... | @@ -38,6 +38,7 @@ |
38 | 38 | }; |
39 | 39 | const updateFieldDeviceId = (v) => { |
40 | 40 | const option = v; |
41 | + console.log(option); | |
41 | 42 | setTimeout(() => { |
42 | 43 | updateSchema({ |
43 | 44 | field: 'entityId', |
... | ... | @@ -98,6 +99,19 @@ |
98 | 99 | }); |
99 | 100 | }, 10); |
100 | 101 | }; |
102 | + const updateOperatorAndValue = () => { | |
103 | + updateSchema([ | |
104 | + { | |
105 | + field: 'operation', | |
106 | + ifShow: false, | |
107 | + }, | |
108 | + { | |
109 | + field: 'value', | |
110 | + ifShow: false, | |
111 | + }, | |
112 | + ]); | |
113 | + }; | |
114 | + | |
101 | 115 | const resetFieldsValueFunc = () => { |
102 | 116 | resetFields(); |
103 | 117 | }; |
... | ... | @@ -130,7 +144,7 @@ |
130 | 144 | }, |
131 | 145 | ]); |
132 | 146 | } |
133 | - }, 10); | |
147 | + }, 1); | |
134 | 148 | } |
135 | 149 | }; |
136 | 150 | |
... | ... | @@ -183,6 +197,7 @@ |
183 | 197 | }); |
184 | 198 | }; |
185 | 199 | return { |
200 | + updateOperatorAndValue, | |
186 | 201 | clearSelectAttribute, |
187 | 202 | updateFieldType2Func, |
188 | 203 | updateFieldDeviceId, | ... | ... |
... | ... | @@ -34,7 +34,12 @@ export enum AttrAndWenDuEnum { |
34 | 34 | IS_SHIDU = 'NUMERIC', |
35 | 35 | IS_CONDITION_WENDU = 'NUMERIC2', |
36 | 36 | IS_CONDITION_SHIDU = 'NUMERIC1', |
37 | + IS_TYPE2 = 'type2', | |
37 | 38 | } |
39 | +export const isType2 = (type: string) => { | |
40 | + return type === AttrAndWenDuEnum.IS_TYPE2; | |
41 | +}; | |
42 | + | |
38 | 43 | export const isConditionShiDu = (type: string) => { |
39 | 44 | return type === AttrAndWenDuEnum.IS_CONDITION_SHIDU; |
40 | 45 | }; |
... | ... | @@ -80,6 +85,11 @@ export const isHand = (type: string) => { |
80 | 85 | |
81 | 86 | export const columns: BasicColumn[] = [ |
82 | 87 | { |
88 | + title: '创建时间', | |
89 | + dataIndex: 'createTime', | |
90 | + width: 180, | |
91 | + }, | |
92 | + { | |
83 | 93 | title: '场景联动名称', |
84 | 94 | dataIndex: 'name', |
85 | 95 | width: 200, |
... | ... | @@ -139,11 +149,6 @@ export const columns: BasicColumn[] = [ |
139 | 149 | dataIndex: 'description', |
140 | 150 | width: 200, |
141 | 151 | }, |
142 | - { | |
143 | - title: '创建时间', | |
144 | - dataIndex: 'createTime', | |
145 | - width: 180, | |
146 | - }, | |
147 | 152 | ]; |
148 | 153 | |
149 | 154 | export const getData = ref(null); |
... | ... | @@ -294,10 +299,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
294 | 299 | component: 'Select', |
295 | 300 | componentProps: { |
296 | 301 | placeholder: '属性触发', |
297 | - options: [ | |
298 | - { label: '属性触发', value: 'TIME_SERIES' }, | |
299 | - // { label: '上下线触发', value: 'ATTRIBUTE' }, | |
300 | - ], | |
302 | + options: [{ label: '属性触发', value: 'TIME_SERIES' }], | |
301 | 303 | }, |
302 | 304 | ifShow: ({ values }) => |
303 | 305 | !isTime(Reflect.get(values, 'triggerType')) && |
... | ... | @@ -305,25 +307,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
305 | 307 | !isHand(Reflect.get(values, 'triggerType')), |
306 | 308 | colProps: { span: 12 }, |
307 | 309 | }, |
308 | - // { | |
309 | - // field: 'key1', | |
310 | - // label: '', | |
311 | - // component: 'Select', | |
312 | - // componentProps: { | |
313 | - // placeholder: '请选择上下线', | |
314 | - // options: [ | |
315 | - // { label: '上下线', value: '1' }, | |
316 | - // { label: '上线', value: '2' }, | |
317 | - // { label: '下线', value: '3' }, | |
318 | - // ], | |
319 | - // }, | |
320 | - // colProps: { span: 12 }, | |
321 | - // ifShow: ({ values }) => | |
322 | - // isUpAndDown(Reflect.get(values, 'type1')) && | |
323 | - // !isTime(Reflect.get(values, 'triggerType')) && | |
324 | - // !isScene(Reflect.get(values, 'triggerType')) && | |
325 | - // !isHand(Reflect.get(values, 'triggerType')), | |
326 | - // }, | |
327 | 310 | { |
328 | 311 | field: 'type2', |
329 | 312 | label: '', |
... | ... | @@ -340,7 +323,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
340 | 323 | !isTime(Reflect.get(values, 'triggerType')) && |
341 | 324 | !isScene(Reflect.get(values, 'triggerType')) && |
342 | 325 | !isHand(Reflect.get(values, 'triggerType')) && |
343 | - !isUpAndDown(Reflect.get(values, 'type1')), | |
326 | + isUpAndDown(Reflect.get(values, 'type1')), | |
344 | 327 | colProps: { span: 12 }, |
345 | 328 | }, |
346 | 329 | { |
... | ... | @@ -357,23 +340,23 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
357 | 340 | { label: '>=', value: 'GREATER_OR_EQUAL' }, |
358 | 341 | ], |
359 | 342 | }, |
360 | - ifShow: false, | |
343 | + ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')), | |
361 | 344 | colProps: { span: 12 }, |
362 | 345 | }, |
363 | 346 | { |
364 | 347 | field: 'value', |
365 | 348 | component: 'Input', |
366 | 349 | label: '', |
350 | + defaultValue: 0, | |
367 | 351 | componentProps: { |
368 | 352 | maxLength: 16, |
369 | 353 | placeholder: '请输入比较值', |
370 | 354 | }, |
371 | - ifShow: false, | |
355 | + ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')), | |
372 | 356 | colProps: { |
373 | 357 | span: 12, |
374 | 358 | }, |
375 | 359 | }, |
376 | - | |
377 | 360 | { |
378 | 361 | field: 'sceneLinkageId', |
379 | 362 | label: '', |
... | ... | @@ -390,19 +373,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
390 | 373 | }, |
391 | 374 | ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), |
392 | 375 | }, |
393 | - | |
394 | - // { | |
395 | - // field: 'no3', | |
396 | - // label: '', | |
397 | - // component: 'ApiSelect', | |
398 | - // colProps: { | |
399 | - // span: 12, | |
400 | - // }, | |
401 | - // componentProps: { | |
402 | - // placeholder: '暂不实现', | |
403 | - // }, | |
404 | - // ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), | |
405 | - // }, | |
406 | 376 | ]; |
407 | 377 | |
408 | 378 | export const useConditionDrawerSchema: FormSchema[] = [ |
... | ... | @@ -536,12 +506,11 @@ export const useActionDrawerSchema: FormSchema[] = [ |
536 | 506 | { |
537 | 507 | field: 'doContext', |
538 | 508 | component: 'InputTextArea', |
539 | - defaultValue: | |
540 | - '{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1,"DO2": 1,"DO3": 1,"DO4": 1}}}', | |
541 | 509 | label: '', |
542 | 510 | componentProps: { |
543 | 511 | maxLength: 255, |
544 | - placeholder: '请输入下发指定', | |
512 | + placeholder: | |
513 | + '请输入下发指定(JSON格式:{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1}})', | |
545 | 514 | }, |
546 | 515 | ifShow: ({ values }) => |
547 | 516 | !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), | ... | ... |
... | ... | @@ -374,17 +374,15 @@ |
374 | 374 | }); |
375 | 375 | }); |
376 | 376 | |
377 | - options.items.forEach((v) => { | |
378 | - return (v.value = v.tbDeviceId), (v.label = v.name); | |
377 | + optionsItemArray.value = options.items.map((v) => { | |
378 | + return { | |
379 | + value: v.tbDeviceId, | |
380 | + label: v.name, | |
381 | + }; | |
379 | 382 | }); |
380 | - optionsItemArray.value = options.items; | |
381 | - try { | |
382 | - proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); | |
383 | - proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); | |
384 | - proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | |
385 | - } catch (e) { | |
386 | - return e; | |
387 | - } | |
383 | + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value); | |
384 | + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value); | |
385 | + proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value); | |
388 | 386 | } catch (e) { |
389 | 387 | return e; |
390 | 388 | } |
... | ... | @@ -392,6 +390,7 @@ |
392 | 390 | }); |
393 | 391 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
394 | 392 | const handleClose = () => { |
393 | + editTriggerPushData.value.length = 0; | |
395 | 394 | pushEditArray.value.length = 0; |
396 | 395 | pushEditConditionArray.value.length = 0; |
397 | 396 | pushEditActionArray.value.length = 0; |
... | ... | @@ -403,6 +402,13 @@ |
403 | 402 | filterArrayTrigger.length = 0; |
404 | 403 | filterArrayCondition.value.length = 0; |
405 | 404 | filterArrayAction.value.length = 0; |
405 | + proxy.$refs.refTriggerChild?.resetFieldsValueFunc(); | |
406 | + proxy.$refs.refTriggerChild?.clearSelectDevice(); | |
407 | + proxy.$refs.refTriggerChild?.clearSelectAttribute(); | |
408 | + proxy.$refs.refConditionChild?.resetFieldsValueFunc(); | |
409 | + proxy.$refs.refConditionChild?.clearSelectDevice(); | |
410 | + proxy.$refs.refActionChild?.resetFieldsValueFunc(); | |
411 | + proxy.$refs.refActionChild?.clearSelectDevice(); | |
406 | 412 | }; |
407 | 413 | |
408 | 414 | const clearAllArrayFunc = () => { |
... | ... | @@ -430,23 +436,24 @@ |
430 | 436 | }; |
431 | 437 | watch(getData, async (newV: string) => { |
432 | 438 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); |
433 | - options.items.forEach((v) => { | |
434 | - return (v.value = v.tbDeviceId), (v.label = v.name); | |
439 | + optionsItemArray.value = options.items.map((v) => { | |
440 | + return { | |
441 | + value: v.tbDeviceId, | |
442 | + label: v.name, | |
443 | + }; | |
435 | 444 | }); |
436 | - optionsItemArray.value = options.items; | |
445 | + // optionsItemArray.value = options.items; | |
437 | 446 | updateDeviceIdFunc(optionsItemArray.value); |
438 | - try { | |
439 | - proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | |
440 | - } catch (e) { | |
441 | - return e; | |
442 | - } | |
447 | + proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value); | |
448 | + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value); | |
449 | + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value); | |
443 | 450 | }); |
444 | 451 | |
445 | 452 | const updateDeviceIdFunc = (v) => { |
446 | 453 | try { |
447 | - proxy.$refs.refTriggerChild.updateFieldDeviceId(v); | |
448 | - proxy.$refs.refConditionChild.updateFieldDeviceId(v); | |
449 | - proxy.$refs.refActionChild.updateFieldDeviceId(v); | |
454 | + proxy.$refs.refTriggerChild?.updateFieldDeviceId(v); | |
455 | + proxy.$refs.refConditionChild?.updateFieldDeviceId(v); | |
456 | + proxy.$refs.refActionChild?.updateFieldDeviceId(v); | |
450 | 457 | } catch (e) { |
451 | 458 | return e; |
452 | 459 | } |
... | ... | @@ -503,7 +510,7 @@ |
503 | 510 | // type: m.type2 == null ? 'NUMERIC' : m.type2, |
504 | 511 | type: 'NUMERIC', |
505 | 512 | value: { |
506 | - defaultValue: Number(m.value) == null ? 0 : Number(m.value), | |
513 | + defaultValue: Number(m.value), | |
507 | 514 | }, |
508 | 515 | operation: m.operation == null ? 'EQUAL' : m.operation, |
509 | 516 | }, |
... | ... | @@ -654,7 +661,7 @@ |
654 | 661 | // type: m.type2 == null ? 'NUMERIC' : m.type2, |
655 | 662 | type: 'NUMERIC', |
656 | 663 | value: { |
657 | - defaultValue: Number(m.value) == null ? 0 : Number(m.value), | |
664 | + defaultValue: Number(m.value), | |
658 | 665 | }, |
659 | 666 | operation: m.operation == null ? 'EQUAL' : m.operation, |
660 | 667 | }, |
... | ... | @@ -668,8 +675,8 @@ |
668 | 675 | }); |
669 | 676 | try { |
670 | 677 | setTimeout(() => { |
671 | - proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); | |
672 | - }, 50); | |
678 | + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value); | |
679 | + }, 10); | |
673 | 680 | } catch (e) { |
674 | 681 | return e; |
675 | 682 | } | ... | ... |
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | let selectedRowKeys: Array<string> = []; |
67 | 67 | const [registerDrawer, { openDrawer }] = useDrawer(); |
68 | 68 | const { createMessage } = useMessage(); |
69 | - const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
69 | + const [registerTable, { reload, getSelectRows }] = useTable({ | |
70 | 70 | title: '租户配置列表', |
71 | 71 | clickToRowSelect: false, |
72 | 72 | api: getTableTenantProfileApi, | ... | ... |