Commit 2c122df004ee7a6a83aaf23253c1f0c1da4d0aaa
Merge branch 'ft-dev' into 'main'
设备配置待完善报警规则处理 See merge request huang/yun-teng-iot-front!39
Showing
14 changed files
with
564 additions
and
193 deletions
| ... | ... | @@ -76,7 +76,6 @@ export function createPermissionGuard(router: Router) { | 
| 76 | 76 | to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME) | 
| 77 | 77 | ) { | 
| 78 | 78 | // Jump to the 404 page after processing the login | 
| 79 | - console.log(router); | |
| 80 | 79 | getMenuList().then((res) => { | 
| 81 | 80 | if (res) { | 
| 82 | 81 | console.log(res); | ... | ... | 
| ... | ... | @@ -42,7 +42,7 @@ | 
| 42 | 42 | class="cursor-pointer ml-4" | 
| 43 | 43 | style="font-size: 20px" | 
| 44 | 44 | /></p> | 
| 45 | - <p class="mt-4 ml-4">dashboard:</p> | |
| 45 | + <BasicForm @register="dashboardForm" /> | |
| 46 | 46 | </div> | 
| 47 | 47 | </div> | 
| 48 | 48 | <div class="w-1/4 flex justify-center"> | 
| ... | ... | @@ -60,9 +60,47 @@ | 
| 60 | 60 | ><PlusCircleOutlined />添加创建条件</a-button | 
| 61 | 61 | > | 
| 62 | 62 | <p>清除报警规则</p> | 
| 63 | - <BasicForm @register="registerFormClearAlarm"> | |
| 64 | - <template #formHeader> </template> | |
| 65 | - </BasicForm> | |
| 63 | + <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | |
| 64 | + <div class="aic mb-4" style="border: 1px solid #bfbfbf"> | |
| 65 | + <div class="w-3/4"> | |
| 66 | + <div> | |
| 67 | + <p style="color: #f5594e" class="mt-4 ml-4" | |
| 68 | + >请添加报警规则条件 | |
| 69 | + <PlusOutlined | |
| 70 | + @click="handleOpenAlaramRuleConditions" | |
| 71 | + class="cursor-pointer ml-4" | |
| 72 | + style="font-size: 20px" | |
| 73 | + /></p> | |
| 74 | + <p class="mt-4 ml-4" | |
| 75 | + >启用规则:始终启用 | |
| 76 | + <EditOutlined | |
| 77 | + @click="handleOpenEnableRule" | |
| 78 | + class="cursor-pointer ml-4" | |
| 79 | + style="font-size: 20px" | |
| 80 | + /></p> | |
| 81 | + <p class="mt-4 ml-4" | |
| 82 | + >详情模板:<EditOutlined | |
| 83 | + @click="handleOpenDetailTemplate" | |
| 84 | + class="cursor-pointer ml-4" | |
| 85 | + style="font-size: 20px" | |
| 86 | + /></p> | |
| 87 | + <BasicForm @register="dashboardForm" /> | |
| 88 | + </div> | |
| 89 | + </div> | |
| 90 | + <div class="w-1/4 flex justify-center"> | |
| 91 | + <Tooltip title="移除"> | |
| 92 | + <MinusCircleOutlined | |
| 93 | + style="font-size: 25px; color: #305680" | |
| 94 | + class="cursor-pointer" | |
| 95 | + @click="deleteCondition(index, createIndex)" | |
| 96 | + /> | |
| 97 | + </Tooltip> | |
| 98 | + </div> | |
| 99 | + </div> | |
| 100 | + </template> | |
| 101 | + <a-button class="mt-5" @click="addCreateRole(index)" | |
| 102 | + ><PlusCircleOutlined />添加清除条件</a-button | |
| 103 | + > | |
| 66 | 104 | </CollapseContainer> | 
| 67 | 105 | </template> | 
| 68 | 106 | </div> | 
| ... | ... | @@ -94,11 +132,17 @@ | 
| 94 | 132 | </template> | 
| 95 | 133 | |
| 96 | 134 | <script lang="ts"> | 
| 97 | - import { defineComponent, ref, unref, getCurrentInstance } from 'vue'; | |
| 135 | + import { defineComponent, ref, unref, getCurrentInstance, watch, onMounted } from 'vue'; | |
| 98 | 136 | import type { alarmListItem } from '../types/index'; | 
| 99 | 137 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 100 | 138 | import { BasicForm, useForm } from '/@/components/Form'; | 
| 101 | - import { step3Schemas, step3HighSetting, step3CreateAlarm, step3ClearAlarm } from './data'; | |
| 139 | + import { | |
| 140 | + step3Schemas, | |
| 141 | + step3HighSetting, | |
| 142 | + step3CreateAlarm, | |
| 143 | + dashboardFormScheme, | |
| 144 | + isWhereType, | |
| 145 | + } from './data'; | |
| 102 | 146 | import { | 
| 103 | 147 | DeleteOutlined, | 
| 104 | 148 | MinusCircleOutlined, | 
| ... | ... | @@ -130,7 +174,6 @@ | 
| 130 | 174 | emits: ['prev', 'next'], | 
| 131 | 175 | setup(_, { emit }) { | 
| 132 | 176 | const { proxy } = getCurrentInstance(); | 
| 133 | - // const isDetailTemplateEnableRuleAlarmRuleConditions = ref(true); | |
| 134 | 177 | const getChildData1 = ref(null); | 
| 135 | 178 | const getChildData2 = ref(null); | 
| 136 | 179 | const getChildData3 = ref(null); | 
| ... | ... | @@ -138,6 +181,11 @@ | 
| 138 | 181 | const getAllFormData: any = ref({}); | 
| 139 | 182 | const alarmss: any = ref([]); | 
| 140 | 183 | const emptyObj: any = ref({}); | 
| 184 | + const detailObj: any = ref({}); | |
| 185 | + const ruleObj: any = ref({}); | |
| 186 | + const enableObj: any = ref({}); | |
| 187 | + const additionalObj: any = ref({}); | |
| 188 | + const isWhereTypeValue = ref(null); | |
| 141 | 189 | //告警列表 | 
| 142 | 190 | let profileData = ref<alarmListItem[]>([]); | 
| 143 | 191 | const log = (e) => { | 
| ... | ... | @@ -153,25 +201,11 @@ | 
| 153 | 201 | }; | 
| 154 | 202 | const addAlarmRule = () => { | 
| 155 | 203 | unref(profileData).push({ | 
| 156 | - // id: Date.now(), | |
| 157 | - // messageMode: '', | |
| 158 | - // propagate: false, | |
| 159 | - // propagateRelationTypes: [''], | |
| 160 | 204 | configuration: {}, | 
| 161 | 205 | transportConfiguration: {}, | 
| 162 | 206 | provisionConfiguration: { | 
| 163 | 207 | provisionDeviceSecret: '', | 
| 164 | 208 | }, | 
| 165 | - // alarms: [ | |
| 166 | - // { | |
| 167 | - // id: Date.now() + Math.random(), | |
| 168 | - // alarmVisible: false, | |
| 169 | - // addKeyFilterVisible: false, | |
| 170 | - // detailVisible: false, | |
| 171 | - // detail: '', | |
| 172 | - // }, | |
| 173 | - // ], | |
| 174 | - // clearRule: [], | |
| 175 | 209 | alarms: [ | 
| 176 | 210 | { | 
| 177 | 211 | id: Date.now() + Math.random(), | 
| ... | ... | @@ -184,7 +218,13 @@ | 
| 184 | 218 | ], | 
| 185 | 219 | }); | 
| 186 | 220 | }; | 
| 187 | - | |
| 221 | + //Mobile dashboard: | |
| 222 | + const [dashboardForm] = useForm({ | |
| 223 | + labelWidth: 120, | |
| 224 | + schemas: dashboardFormScheme, | |
| 225 | + showResetButton: false, | |
| 226 | + showSubmitButton: false, | |
| 227 | + }); | |
| 188 | 228 | // 表单部分 报警类型 | 
| 189 | 229 | const [registerForm, { validate: validateRegisterForm }] = useForm({ | 
| 190 | 230 | labelWidth: 120, | 
| ... | ... | @@ -215,17 +255,6 @@ | 
| 215 | 255 | }, | 
| 216 | 256 | }); | 
| 217 | 257 | |
| 218 | - // 清除条件表单 | |
| 219 | - const [registerFormClearAlarm, { validate: validateRegisterFormClearAlarm }] = useForm({ | |
| 220 | - labelWidth: 120, | |
| 221 | - schemas: step3ClearAlarm, | |
| 222 | - showResetButton: false, | |
| 223 | - showSubmitButton: false, | |
| 224 | - actionColOptions: { | |
| 225 | - span: 24, | |
| 226 | - }, | |
| 227 | - }); | |
| 228 | - | |
| 229 | 258 | // 添加‘创建条件’ | 
| 230 | 259 | const addCreateRole = (index: number) => { | 
| 231 | 260 | unref(profileData)[index].alarms.push({ | 
| ... | ... | @@ -241,49 +270,92 @@ | 
| 241 | 270 | const deleteCondition = (index: number, createIndex: number) => { | 
| 242 | 271 | profileData.value[index].alarms.splice(createIndex, 1); | 
| 243 | 272 | }; | 
| 273 | + watch(isWhereType, (nV) => { | |
| 274 | + isWhereTypeValue.value = nV; | |
| 275 | + }); | |
| 244 | 276 | const getAllFieldsFunc = (v) => { | 
| 245 | - console.log(v); | |
| 277 | + detailObj.value = v; | |
| 246 | 278 | }; | 
| 247 | 279 | const getAllFieldsEnabFunc = (v) => { | 
| 248 | - console.log(v); | |
| 280 | + enableObj.value = v; | |
| 281 | + console.log(enableObj.value); | |
| 249 | 282 | }; | 
| 250 | 283 | const getAllFieldsRuleFunc = (v) => { | 
| 251 | - console.log(v); | |
| 252 | - }; | |
| 284 | + ruleObj.value = v; | |
| 285 | + const value = { | |
| 286 | + value: ruleObj.value?.value, | |
| 287 | + }; | |
| 288 | + const predicate = { | |
| 289 | + predicate: ruleObj.value?.predicate, | |
| 290 | + }; | |
| 291 | + const getCondition = { | |
| 292 | + condition: [ | |
| 293 | + { | |
| 294 | + key: { | |
| 295 | + type: ruleObj.value?.type, | |
| 296 | + key: ruleObj.value?.type, | |
| 297 | + }, | |
| 298 | + valueType: ruleObj.value?.valueType, | |
| 299 | + value, | |
| 300 | + predicate, | |
| 301 | + }, | |
| 302 | + ], | |
| 303 | + }; | |
| 304 | + | |
| 305 | + const spec = { | |
| 306 | + spec: ruleObj.value?.spec, | |
| 307 | + }; | |
| 253 | 308 | |
| 309 | + const getValueConditon = { | |
| 310 | + spec, | |
| 311 | + condition: getCondition, | |
| 312 | + }; | |
| 313 | + Object.assign(additionalObj.value, getValueConditon); | |
| 314 | + }; | |
| 254 | 315 | const handleFormStep3toStep4Next = async () => { | 
| 255 | 316 | try { | 
| 256 | - // const values = 1; | |
| 317 | + const scheduleValue = { | |
| 318 | + type: enableObj.value.schedule, | |
| 319 | + daysOfWeek: enableObj.value.daysOfWeek, | |
| 320 | + endsOn: enableObj.value.endsOn, | |
| 321 | + startsOn: enableObj.value.startOn, | |
| 322 | + timezone: enableObj.value.timezone, | |
| 323 | + }; | |
| 324 | + const getSchedule = { | |
| 325 | + schedule: scheduleValue, | |
| 326 | + }; | |
| 327 | + const getAdditionalProp = Object.assign({}, detailObj.value, getSchedule); | |
| 328 | + const getScheduleAndAlarmDetails = Object.assign( | |
| 329 | + {}, | |
| 330 | + getAdditionalProp, | |
| 331 | + additionalObj.value | |
| 332 | + ); | |
| 333 | + const getIsWhereTypeValue: any = isWhereTypeValue.value; | |
| 334 | + const getAdditionalPropObj = { | |
| 335 | + [getIsWhereTypeValue]: getScheduleAndAlarmDetails, | |
| 336 | + }; | |
| 337 | + const getCreateRulesAllObj = { | |
| 338 | + createRules: getAdditionalPropObj, | |
| 339 | + }; | |
| 257 | 340 | const valueRegisterForm = await validateRegisterForm(); | 
| 258 | 341 | const valueRegisterFormHighSetting = await validateRegisterFormHighSetting(); | 
| 259 | 342 | const valueRegisterFormCreateAlarm = await validateRegisterFormCreateAlarm(); | 
| 260 | - const valueRegisterFormClearAlarm = await validateRegisterFormClearAlarm(); | |
| 261 | 343 | const getValueRegisterFormHighSetting = { | 
| 262 | 344 | propagate: valueRegisterFormHighSetting?.propagate, | 
| 263 | 345 | propagateRelationTypes: [valueRegisterFormHighSetting?.propagateRelationTypes], | 
| 264 | 346 | }; | 
| 265 | - // console.log(proxy.$refs.getChildData1); | |
| 266 | - // console.log(proxy.$refs.getChildData2); | |
| 267 | - // console.log(proxy.$refs.getChildData3); | |
| 268 | - // let getChildValues1 = proxy.$refs.getChildData1.getAllFields(); | |
| 269 | - // console.log('详情模板', getChildValues1); | |
| 270 | - // let getChildValues2 = proxy.$refs.getChildData2.getAllFieldsEnab(); | |
| 271 | - // console.log('启用规则', getChildValues2); | |
| 272 | - // let getChildValues3 = proxy.$refs.getChildData3.getAllFieldsRule(); | |
| 273 | - // console.log('报警规则条件', getChildValues3); | |
| 274 | 347 | |
| 275 | - Object.assign(emptyObj.value, valueRegisterForm, getValueRegisterFormHighSetting); | |
| 348 | + Object.assign( | |
| 349 | + emptyObj.value, | |
| 350 | + valueRegisterForm, | |
| 351 | + getValueRegisterFormHighSetting, | |
| 352 | + getCreateRulesAllObj | |
| 353 | + ); | |
| 276 | 354 | alarmss.value.push(emptyObj.value); | 
| 277 | 355 | const getAlarms = { | 
| 278 | 356 | alarms: alarmss.value, | 
| 279 | 357 | }; | 
| 280 | - Object.assign( | |
| 281 | - getAllFormData.value, | |
| 282 | - getAlarms | |
| 283 | - // valueRegisterFormCreateAlarm, | |
| 284 | - // valueRegisterFormClearAlarm | |
| 285 | - // profileData.value | |
| 286 | - ); | |
| 358 | + Object.assign(getAllFormData.value, getAlarms); | |
| 287 | 359 | console.log('第三步的数据', getAllFormData.value); | 
| 288 | 360 | emit('next', getAllFormData.value); | 
| 289 | 361 | } catch (error) {} | 
| ... | ... | @@ -295,18 +367,25 @@ | 
| 295 | 367 | |
| 296 | 368 | const handleOpenDetailTemplate = () => { | 
| 297 | 369 | isRuleAlarmRuleConditions.value = 1; | 
| 298 | - openModal1(true); | |
| 370 | + setTimeout(() => { | |
| 371 | + openModal1(true); | |
| 372 | + }, 10); | |
| 299 | 373 | }; | 
| 300 | 374 | const handleOpenEnableRule = () => { | 
| 301 | 375 | isRuleAlarmRuleConditions.value = 2; | 
| 302 | - openModal2(true); | |
| 376 | + setTimeout(() => { | |
| 377 | + openModal2(true); | |
| 378 | + }, 10); | |
| 303 | 379 | }; | 
| 304 | 380 | const handleOpenAlaramRuleConditions = () => { | 
| 305 | 381 | isRuleAlarmRuleConditions.value = 3; | 
| 306 | - openModal3(true); | |
| 382 | + setTimeout(() => { | |
| 383 | + openModal3(true); | |
| 384 | + }, 10); | |
| 307 | 385 | }; | 
| 308 | 386 | |
| 309 | 387 | return { | 
| 388 | + dashboardForm, | |
| 310 | 389 | getAllFieldsRuleFunc, | 
| 311 | 390 | getAllFieldsEnabFunc, | 
| 312 | 391 | getAllFieldsFunc, | 
| ... | ... | @@ -331,7 +410,6 @@ | 
| 331 | 410 | registerFormCreateAlarm, | 
| 332 | 411 | addCreateRole, | 
| 333 | 412 | deleteCondition, | 
| 334 | - registerFormClearAlarm, | |
| 335 | 413 | }; | 
| 336 | 414 | }, | 
| 337 | 415 | }); | ... | ... | 
| 1 | 1 | <template> | 
| 2 | 2 | <div> | 
| 3 | - <span>请选择告警通知联系人:</span> | |
| 4 | - <Tag v-for="(item, index) in 15" closable :key="index"> 冯涛+{{ item }}</Tag> | |
| 3 | + <!-- <span>请选择告警通知联系人:</span> --> | |
| 4 | + <!-- <Tag v-for="(item, index) in 15" closable :key="index"> 冯涛+{{ item }}</Tag> --> | |
| 5 | 5 | <BasicForm :showSubmitButton="false" @register="register" /> | 
| 6 | 6 | </div> | 
| 7 | 7 | </template> | 
| 8 | 8 | <script lang="ts"> | 
| 9 | 9 | import { defineComponent, ref } from 'vue'; | 
| 10 | - import { Tag } from 'ant-design-vue'; | |
| 10 | + // import { Tag } from 'ant-design-vue'; | |
| 11 | 11 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 12 | 12 | import { alertContactsSchemas } from '../cpns/config'; | 
| 13 | 13 | |
| 14 | 14 | export default defineComponent({ | 
| 15 | 15 | components: { | 
| 16 | - Tag, | |
| 17 | 16 | BasicForm, | 
| 18 | 17 | }, | 
| 19 | 18 | emits: ['prev'], | ... | ... | 
| ... | ... | @@ -41,6 +41,10 @@ | 
| 41 | 41 | { | 
| 42 | 42 | "id": "highTemperatureAlarmID", | 
| 43 | 43 | "alarmType": "High Temperature Alarm", | 
| 44 | + "propagate": true, | |
| 45 | + "propagateRelationTypes": [ | |
| 46 | + "string" | |
| 47 | + ], | |
| 44 | 48 | "createRules": { | 
| 45 | 49 | "additionalProp1": { | 
| 46 | 50 | "condition": { | 
| ... | ... | @@ -138,11 +142,7 @@ | 
| 138 | 142 | "id": "784f394c-42b6-435a-983c-b7beff2784f9", | 
| 139 | 143 | "entityType": "DASHBOARD" | 
| 140 | 144 | } | 
| 141 | - }, | |
| 142 | - "propagate": true, | |
| 143 | - "propagateRelationTypes": [ | |
| 144 | - "string" | |
| 145 | - ] | |
| 145 | + } | |
| 146 | 146 | } | 
| 147 | 147 | ] | 
| 148 | 148 | }, | ... | ... | 
| 1 | 1 | { | 
| 2 | - "name": "hhhhh", | |
| 2 | + "name": "设备配置1", | |
| 3 | + "description": "设备配置1", | |
| 3 | 4 | "transportType": "COAP", | 
| 4 | 5 | "profileData": { | 
| 5 | 6 | "alarms": [ | 
| 6 | 7 | { | 
| 7 | - "alarmType": "1", | |
| 8 | + "alarmType": "设备配置1", | |
| 8 | 9 | "propagate": true, | 
| 9 | 10 | "propagateRelationTypes": [ | 
| 10 | - "1" | |
| 11 | - ] | |
| 11 | + "设备配置1" | |
| 12 | + ], | |
| 13 | + "createRules": { | |
| 14 | + "WARNING": { | |
| 15 | + "alarmDetails": "设备配置1", | |
| 16 | + "schedule": { | |
| 17 | + "type": "SPECIFIC_TIME" | |
| 18 | + }, | |
| 19 | + "spec": { | |
| 20 | + "spec": "HOURS" | |
| 21 | + }, | |
| 22 | + "condition": { | |
| 23 | + "condition": [ | |
| 24 | + { | |
| 25 | + "key": { | |
| 26 | + "type": "TIME_SERIES", | |
| 27 | + "key": "TIME_SERIES" | |
| 28 | + }, | |
| 29 | + "valueType": "CURRENT_DEVICE", | |
| 30 | + "value": { | |
| 31 | + "value": "设备配置1" | |
| 32 | + }, | |
| 33 | + "predicate": { | |
| 34 | + "predicate": "设备配置1" | |
| 35 | + } | |
| 36 | + } | |
| 37 | + ] | |
| 38 | + } | |
| 39 | + } | |
| 40 | + } | |
| 12 | 41 | } | 
| 13 | 42 | ] | 
| 14 | 43 | }, | 
| 15 | 44 | "alarmProfile": { | 
| 16 | 45 | "alarmContactId": "ce350734-9504-48c2-82d2-277e3fe5583f", | 
| 17 | - "messageMode": "DING_TALK_MESSAGE" | |
| 46 | + "messageMode": "PHONE_MESSAGE" | |
| 18 | 47 | } | 
| 19 | 48 | } | ... | ... | 
src/views/device/profile/step/cpns/3.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "设备配置", | |
| 3 | + "description": "设备配置", | |
| 4 | + "transportType": "COAP", | |
| 5 | + "profileData": { | |
| 6 | + "alarms": [ | |
| 7 | + { | |
| 8 | + "alarmType": "设备配置", | |
| 9 | + "propagate": true, | |
| 10 | + "propagateRelationTypes": [ | |
| 11 | + "设备配置" | |
| 12 | + ], | |
| 13 | + "createRules": { | |
| 14 | + "MINOR": { | |
| 15 | + "schedule": { | |
| 16 | + "type": "SPECIFIC_TIME" | |
| 17 | + } | |
| 18 | + } | |
| 19 | + } | |
| 20 | + } | |
| 21 | + ] | |
| 22 | + }, | |
| 23 | + "alarmProfile": { | |
| 24 | + "alarmContactId": "ce350734-9504-48c2-82d2-277e3fe5583f", | |
| 25 | + "messageMode": "DING_TALK_MESSAGE" | |
| 26 | + } | |
| 27 | +} | ... | ... | 
| 1 | -import { FormSchema } from '/@/components/Table'; | |
| 1 | +import { FormSchema, BasicColumn } from '/@/components/Table'; | |
| 2 | 2 | |
| 3 | 3 | /** | 
| 4 | 4 | * 所使用的枚举值 | 
| 5 | 5 | */ | 
| 6 | 6 | |
| 7 | 7 | export enum TriggerEnum { | 
| 8 | - IS_DEVICE_ACT = 'DEVICE_ACT', | |
| 9 | - IS_TIME_ACT = 'TIME_ACT', | |
| 10 | - IS_SCENE_ACT = 'SCENE_ACT', | |
| 8 | + IS_DEVICE_ACT = '', | |
| 9 | + IS_TIME_ACT = 'TIME_SERIES', | |
| 10 | + IS_SCENE_ACT = 'CONSTANT', | |
| 11 | 11 | } | 
| 12 | 12 | |
| 13 | 13 | export const isShiDu = (type: string) => { | 
| ... | ... | @@ -21,101 +21,114 @@ export const isTimeAll = (type: string) => { | 
| 21 | 21 | return type === TriggerEnum.IS_SCENE_ACT; | 
| 22 | 22 | }; | 
| 23 | 23 | |
| 24 | +export const columns: BasicColumn[] = [ | |
| 25 | + { | |
| 26 | + title: '键名', | |
| 27 | + dataIndex: 'key', | |
| 28 | + width: 200, | |
| 29 | + }, | |
| 30 | + { | |
| 31 | + title: '键类型', | |
| 32 | + dataIndex: 'value', | |
| 33 | + width: 200, | |
| 34 | + }, | |
| 35 | +]; | |
| 36 | + | |
| 24 | 37 | export const formSchema: FormSchema[] = [ | 
| 25 | 38 | { | 
| 26 | - field: 'detail', | |
| 39 | + field: 'type', | |
| 27 | 40 | label: '条件类型', | 
| 28 | 41 | colProps: { span: 24 }, | 
| 29 | 42 | component: 'Select', | 
| 30 | 43 | componentProps: { | 
| 31 | 44 | placeholder: '请选择报警日程表', | 
| 32 | 45 | options: [ | 
| 33 | - { label: '简单', value: 'DEVICE_ACT' }, | |
| 34 | - { label: '持续时间', value: 'TIME_ACT' }, | |
| 35 | - { label: '重复', value: 'SCENE_ACT' }, | |
| 46 | + { label: '简单', value: '' }, | |
| 47 | + { label: '持续时间', value: 'TIME_SERIES' }, | |
| 48 | + { label: '重复', value: 'CONSTANT' }, | |
| 36 | 49 | ], | 
| 37 | 50 | }, | 
| 38 | 51 | }, | 
| 39 | 52 | { | 
| 40 | - field: 'type1', | |
| 53 | + field: 'valueType', | |
| 41 | 54 | label: '动态源类型', | 
| 42 | 55 | colProps: { span: 24 }, | 
| 43 | 56 | component: 'Select', | 
| 44 | 57 | componentProps: { | 
| 45 | 58 | placeholder: '请选择动态源类型', | 
| 46 | 59 | options: [ | 
| 47 | - { label: '无动态值', value: 'second' }, | |
| 48 | - { label: '当前租户', value: 'minute' }, | |
| 49 | - { label: '当前客户', value: 'hour' }, | |
| 50 | - { label: '当前设备', value: 'day' }, | |
| 60 | + { label: '无动态值', value: '' }, | |
| 61 | + { label: '当前租户', value: 'CURRENT_CUSTOMER' }, | |
| 62 | + { label: '当前客户', value: 'CURRENT_CUSTOMER' }, | |
| 63 | + { label: '当前设备', value: 'CURRENT_DEVICE' }, | |
| 51 | 64 | ], | 
| 52 | 65 | }, | 
| 53 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 66 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | |
| 54 | 67 | }, | 
| 55 | 68 | { | 
| 56 | - field: 'time1', | |
| 69 | + field: 'value', | |
| 57 | 70 | label: '源属性', | 
| 58 | 71 | colProps: { span: 24 }, | 
| 59 | 72 | component: 'Input', | 
| 60 | 73 | componentProps: { | 
| 61 | 74 | placeholder: '源属性', | 
| 62 | 75 | }, | 
| 63 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 76 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | |
| 64 | 77 | }, | 
| 65 | 78 | { | 
| 66 | - field: 'type1', | |
| 79 | + field: 'valueType', | |
| 67 | 80 | label: '动态源类型', | 
| 68 | 81 | colProps: { span: 24 }, | 
| 69 | 82 | component: 'Select', | 
| 70 | 83 | componentProps: { | 
| 71 | 84 | placeholder: '请选择动态源类型', | 
| 72 | 85 | options: [ | 
| 73 | - { label: '无动态值', value: 'second' }, | |
| 74 | - { label: '当前租户', value: 'minute' }, | |
| 75 | - { label: '当前客户', value: 'hour' }, | |
| 76 | - { label: '当前设备', value: 'day' }, | |
| 86 | + { label: '无动态值', value: '' }, | |
| 87 | + { label: '当前租户', value: 'CURRENT_TENANT' }, | |
| 88 | + { label: '当前客户', value: 'CURRENT_CUSTOMER' }, | |
| 89 | + { label: '当前设备', value: 'CURRENT_DEVICE' }, | |
| 77 | 90 | ], | 
| 78 | 91 | }, | 
| 79 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 92 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | |
| 80 | 93 | }, | 
| 81 | 94 | { | 
| 82 | - field: 'time1', | |
| 95 | + field: 'value', | |
| 83 | 96 | label: '源属性', | 
| 84 | 97 | colProps: { span: 24 }, | 
| 85 | 98 | component: 'Input', | 
| 86 | 99 | componentProps: { | 
| 87 | 100 | placeholder: '源属性', | 
| 88 | 101 | }, | 
| 89 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 102 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | |
| 90 | 103 | }, | 
| 91 | 104 | { | 
| 92 | - field: 'time', | |
| 105 | + field: 'predicate', | |
| 93 | 106 | label: '持续时间值', | 
| 94 | 107 | colProps: { span: 24 }, | 
| 95 | 108 | component: 'Input', | 
| 96 | 109 | componentProps: { | 
| 97 | 110 | placeholder: '请输入持续时间值', | 
| 98 | 111 | }, | 
| 99 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 112 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | |
| 100 | 113 | }, | 
| 101 | 114 | { | 
| 102 | - field: 'r', | |
| 115 | + field: 'spec', | |
| 103 | 116 | label: '时间单位', | 
| 104 | 117 | colProps: { span: 24 }, | 
| 105 | 118 | component: 'Select', | 
| 106 | 119 | componentProps: { | 
| 107 | 120 | placeholder: '请选择报警日程表', | 
| 108 | 121 | options: [ | 
| 109 | - { label: '秒', value: 'second' }, | |
| 110 | - { label: '分钟', value: 'minute' }, | |
| 111 | - { label: '小时', value: 'hour' }, | |
| 112 | - { label: '天', value: 'day' }, | |
| 122 | + { label: '秒', value: 'SECONDS' }, | |
| 123 | + { label: '分钟', value: 'MINUTES' }, | |
| 124 | + { label: '小时', value: 'HOURS' }, | |
| 125 | + { label: '天', value: 'DAYS' }, | |
| 113 | 126 | ], | 
| 114 | 127 | }, | 
| 115 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 128 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | |
| 116 | 129 | }, | 
| 117 | 130 | { | 
| 118 | - field: 'time', | |
| 131 | + field: '', | |
| 119 | 132 | label: '事件计数值必填', | 
| 120 | 133 | colProps: { span: 24 }, | 
| 121 | 134 | component: 'Input', | 
| ... | ... | @@ -123,6 +136,6 @@ export const formSchema: FormSchema[] = [ | 
| 123 | 136 | placeholder: '请输入事件计数值必填', | 
| 124 | 137 | }, | 
| 125 | 138 | rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }], | 
| 126 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 139 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | |
| 127 | 140 | }, | 
| 128 | 141 | ]; | ... | ... | 
| 1 | +import { FormSchema } from '/@/components/Table'; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 所使用的枚举值 | |
| 5 | + */ | |
| 6 | + | |
| 7 | +export enum TriggerEnum { | |
| 8 | + IS_DEVICE_ACT = '1', | |
| 9 | + IS_TIME_ACT = '2', | |
| 10 | + IS_SCENE_ACT = '3', | |
| 11 | +} | |
| 12 | + | |
| 13 | +export const isShiDu = (type: string) => { | |
| 14 | + return type === TriggerEnum.IS_DEVICE_ACT; | |
| 15 | +}; | |
| 16 | +export const isWenDu = (type: string) => { | |
| 17 | + return type === TriggerEnum.IS_TIME_ACT; | |
| 18 | +}; | |
| 19 | + | |
| 20 | +export const isTimeAll = (type: string) => { | |
| 21 | + return type === TriggerEnum.IS_SCENE_ACT; | |
| 22 | +}; | |
| 23 | + | |
| 24 | +export const formSchema: FormSchema[] = [ | |
| 25 | + { | |
| 26 | + field: 'default', | |
| 27 | + label: '键类型', | |
| 28 | + colProps: { span: 24 }, | |
| 29 | + component: 'Select', | |
| 30 | + componentProps: { | |
| 31 | + placeholder: '请选择键类型', | |
| 32 | + options: [ | |
| 33 | + { label: '属性', value: '1' }, | |
| 34 | + { label: 'Timeseries', value: '2' }, | |
| 35 | + { label: '常量', value: '3' }, | |
| 36 | + ], | |
| 37 | + }, | |
| 38 | + }, | |
| 39 | + { | |
| 40 | + field: '2', | |
| 41 | + label: '键名', | |
| 42 | + colProps: { span: 24 }, | |
| 43 | + component: 'Select', | |
| 44 | + componentProps: { | |
| 45 | + placeholder: '请选择键名', | |
| 46 | + options: [ | |
| 47 | + { label: 'active', value: '' }, | |
| 48 | + { label: 'inactivityAlarmTime', value: '' }, | |
| 49 | + { label: 'lastActivityTime', value: '' }, | |
| 50 | + { label: 'lastConnectTime', value: '' }, | |
| 51 | + { label: 'lastDisconnectTime', value: '' }, | |
| 52 | + ], | |
| 53 | + }, | |
| 54 | + ifShow: ({ values }) => isShiDu(Reflect.get(values, 'default')), | |
| 55 | + }, | |
| 56 | + { | |
| 57 | + field: '21', | |
| 58 | + label: '键名', | |
| 59 | + colProps: { span: 24 }, | |
| 60 | + component: 'Select', | |
| 61 | + componentProps: { | |
| 62 | + placeholder: '请选择键名', | |
| 63 | + options: [ | |
| 64 | + { label: 'CO2', value: '' }, | |
| 65 | + { label: 'temp', value: '' }, | |
| 66 | + { label: 'temp', value: '' }, | |
| 67 | + ], | |
| 68 | + }, | |
| 69 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'default')), | |
| 70 | + }, | |
| 71 | + { | |
| 72 | + field: '22', | |
| 73 | + label: '键名', | |
| 74 | + colProps: { span: 24 }, | |
| 75 | + component: 'Input', | |
| 76 | + componentProps: { | |
| 77 | + placeholder: '请输入键名', | |
| 78 | + }, | |
| 79 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'default')), | |
| 80 | + }, | |
| 81 | + { | |
| 82 | + field: '3', | |
| 83 | + label: '值类型', | |
| 84 | + colProps: { span: 24 }, | |
| 85 | + component: 'Select', | |
| 86 | + componentProps: { | |
| 87 | + placeholder: '请选择值类型', | |
| 88 | + options: [ | |
| 89 | + { label: '字符串', value: '' }, | |
| 90 | + { label: '数字', value: '' }, | |
| 91 | + { label: '布尔值', value: '' }, | |
| 92 | + { label: '日期时间', value: '' }, | |
| 93 | + ], | |
| 94 | + }, | |
| 95 | + }, | |
| 96 | +]; | ... | ... | 
| 1 | +<template> | |
| 2 | + <BasicModal | |
| 3 | + v-bind="$attrs" | |
| 4 | + width="55rem" | |
| 5 | + @register="register" | |
| 6 | + :title="getTitle" | |
| 7 | + @ok="handleSubmit" | |
| 8 | + @cancel="handleCancel" | |
| 9 | + > | |
| 10 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | |
| 11 | + </BasicModal> | |
| 12 | +</template> | |
| 13 | +<script lang="ts"> | |
| 14 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
| 15 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
| 16 | + import { BasicForm, useForm } from '/@/components/Form'; | |
| 17 | + import { formSchema } from './config'; | |
| 18 | + // import { useMessage } from '/@/hooks/web/useMessage'; | |
| 19 | + | |
| 20 | + export default defineComponent({ | |
| 21 | + name: 'index', | |
| 22 | + components: { BasicModal, BasicForm }, | |
| 23 | + emits: ['success', 'register'], | |
| 24 | + setup() { | |
| 25 | + // const { createMessage } = useMessage(); | |
| 26 | + const isUpdate = ref(true); | |
| 27 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增键名筛选器' : '编辑键名筛选器')); | |
| 28 | + const [register] = useModalInner((data) => { | |
| 29 | + isUpdate.value = !!data?.isUpdate; | |
| 30 | + }); | |
| 31 | + const [registerForm] = useForm({ | |
| 32 | + labelWidth: 120, | |
| 33 | + schemas: formSchema, | |
| 34 | + }); | |
| 35 | + const handleSubmit = () => { | |
| 36 | + console.log(1); | |
| 37 | + }; | |
| 38 | + const handleCancel = () => { | |
| 39 | + console.log(1); | |
| 40 | + }; | |
| 41 | + return { | |
| 42 | + registerForm, | |
| 43 | + handleCancel, | |
| 44 | + handleSubmit, | |
| 45 | + register, | |
| 46 | + getTitle, | |
| 47 | + }; | |
| 48 | + }, | |
| 49 | + }); | |
| 50 | +</script> | ... | ... | 
| ... | ... | @@ -6,50 +6,107 @@ | 
| 6 | 6 | :title="getTitle" | 
| 7 | 7 | @ok="handleSubmit" | 
| 8 | 8 | > | 
| 9 | + <CollapseContainer title="键名筛选器" class="border mb-8"> | |
| 10 | + <BasicTable @register="registerTable"> | |
| 11 | + <template #toolbar> | |
| 12 | + <a-button type="primary" @click="handleAddKey"> 新增键名筛选器 </a-button> | |
| 13 | + </template> | |
| 14 | + <template #action="{ record }"> | |
| 15 | + <TableAction | |
| 16 | + :actions="[ | |
| 17 | + { | |
| 18 | + label: '编辑', | |
| 19 | + icon: 'clarity:note-edit-line', | |
| 20 | + onClick: handleEdit.bind(null, record), | |
| 21 | + }, | |
| 22 | + { | |
| 23 | + label: '删除', | |
| 24 | + icon: 'ant-design:delete-outlined', | |
| 25 | + color: 'error', | |
| 26 | + popConfirm: { | |
| 27 | + title: '是否确认删除', | |
| 28 | + confirm: handleDelete.bind(null, record), | |
| 29 | + }, | |
| 30 | + }, | |
| 31 | + ]" | |
| 32 | + /> | |
| 33 | + </template> | |
| 34 | + </BasicTable> | |
| 35 | + </CollapseContainer> | |
| 36 | + <CollapseContainer title="筛选器预览" class="border mb-8"><div>1</div> </CollapseContainer> | |
| 9 | 37 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | 
| 10 | 38 | </BasicModal> | 
| 39 | + <KeyValueModal @register="registerModal" /> | |
| 11 | 40 | </template> | 
| 12 | 41 | <script lang="ts"> | 
| 13 | 42 | import { defineComponent, ref, computed, unref } from 'vue'; | 
| 14 | 43 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 
| 15 | 44 | import { BasicForm, useForm } from '/@/components/Form'; | 
| 16 | - import { formSchema } from './config'; | |
| 45 | + import { formSchema, columns } from './config'; | |
| 46 | + import { CollapseContainer } from '/@/components/Container/index'; | |
| 47 | + import { BasicTable, useTable } from '/@/components/Table'; | |
| 48 | + import { useModal } from '/@/components/Modal'; | |
| 49 | + import KeyValueModal from './cpns/index.vue'; | |
| 17 | 50 | |
| 18 | 51 | export default defineComponent({ | 
| 19 | 52 | name: 'DetailTemplate', | 
| 20 | 53 | components: { | 
| 54 | + KeyValueModal, | |
| 21 | 55 | BasicModal, | 
| 22 | 56 | BasicForm, | 
| 57 | + CollapseContainer, | |
| 58 | + BasicTable, | |
| 23 | 59 | }, | 
| 24 | 60 | emits: ['success', 'register', 'getAllFieldsRule'], | 
| 25 | 61 | setup(_, { emit }) { | 
| 26 | - // const getValueData: any = ref({}); | |
| 27 | - | |
| 28 | 62 | const isUpdate = ref(true); | 
| 29 | 63 | const [registerForm, { getFieldsValue }] = useForm({ | 
| 30 | 64 | labelWidth: 120, | 
| 31 | 65 | schemas: formSchema, | 
| 32 | 66 | }); | 
| 67 | + const [registerModal, { openModal }] = useModal(); | |
| 68 | + | |
| 33 | 69 | const getTitle = computed(() => (!unref(isUpdate) ? '添加报警规则条件' : '编辑报警规则条件')); | 
| 34 | 70 | const [register, { closeModal }] = useModalInner((data) => { | 
| 35 | 71 | isUpdate.value = !!data?.isUpdate; | 
| 36 | 72 | }); | 
| 73 | + const [registerTable] = useTable({ | |
| 74 | + title: '键名筛选器', | |
| 75 | + // api: deviceConfigGetQuery, | |
| 76 | + columns, | |
| 77 | + bordered: true, | |
| 78 | + showIndexColumn: false, | |
| 79 | + actionColumn: { | |
| 80 | + width: 180, | |
| 81 | + title: '操作', | |
| 82 | + dataIndex: 'action', | |
| 83 | + slots: { customRender: 'action' }, | |
| 84 | + }, | |
| 85 | + }); | |
| 37 | 86 | const handleSubmit = () => { | 
| 38 | 87 | const values = getFieldsValue(); | 
| 39 | 88 | emit('getAllFieldsRule', values); | 
| 40 | - // console.log(1); | |
| 41 | - // let getV = {}; | |
| 42 | - // getAllFieldsRule(getV); | |
| 43 | 89 | closeModal(); | 
| 44 | 90 | }; | 
| 45 | - // function getAllFieldsRule(getV) { | |
| 46 | - // const values = getFieldsValue(); | |
| 47 | - // getValueData.value = values; | |
| 48 | - // getV = getValueData.value; | |
| 49 | - // return getV; | |
| 50 | - // } | |
| 91 | + const handleAddKey = () => { | |
| 92 | + openModal(true, { | |
| 93 | + isUpdate: false, | |
| 94 | + }); | |
| 95 | + }; | |
| 96 | + const handleEdit = () => { | |
| 97 | + openModal(true, { | |
| 98 | + isUpdate: true, | |
| 99 | + }); | |
| 100 | + }; | |
| 101 | + const handleDelete = () => { | |
| 102 | + console.log(1); | |
| 103 | + }; | |
| 51 | 104 | return { | 
| 52 | - // getAllFieldsRule, | |
| 105 | + handleEdit, | |
| 106 | + handleDelete, | |
| 107 | + registerModal, | |
| 108 | + registerTable, | |
| 109 | + handleAddKey, | |
| 53 | 110 | registerForm, | 
| 54 | 111 | handleSubmit, | 
| 55 | 112 | register, | ... | ... | 
| ... | ... | @@ -5,9 +5,9 @@ import { FormSchema } from '/@/components/Table'; | 
| 5 | 5 | */ | 
| 6 | 6 | |
| 7 | 7 | export enum TriggerEnum { | 
| 8 | - IS_DEVICE_ACT = 'DEVICE_ACT', | |
| 9 | - IS_TIME_ACT = 'TIME_ACT', | |
| 10 | - IS_SCENE_ACT = 'SCENE_ACT', | |
| 8 | + IS_DEVICE_ACT = 'ANY_TIME', | |
| 9 | + IS_TIME_ACT = 'SPECIFIC_TIME', | |
| 10 | + IS_SCENE_ACT = 'CUSTOM', | |
| 11 | 11 | } | 
| 12 | 12 | |
| 13 | 13 | export const isShiDu = (type: string) => { | 
| ... | ... | @@ -23,7 +23,7 @@ export const isTimeAll = (type: string) => { | 
| 23 | 23 | |
| 24 | 24 | export const formSchema: FormSchema[] = [ | 
| 25 | 25 | { | 
| 26 | - field: 'detail', | |
| 26 | + field: 'schedule', | |
| 27 | 27 | label: '报警日程表', | 
| 28 | 28 | colProps: { span: 24 }, | 
| 29 | 29 | required: true, | 
| ... | ... | @@ -31,225 +31,231 @@ export const formSchema: FormSchema[] = [ | 
| 31 | 31 | componentProps: { | 
| 32 | 32 | placeholder: '请选择报警日程表', | 
| 33 | 33 | options: [ | 
| 34 | - { label: '始终启用', value: 'DEVICE_ACT' }, | |
| 35 | - { label: '定时启用', value: 'TIME_ACT' }, | |
| 36 | - { label: '自定义启用', value: 'SCENE_ACT' }, | |
| 34 | + { label: '始终启用', value: 'ANY_TIME' }, | |
| 35 | + { label: '定时启用', value: 'SPECIFIC_TIME' }, | |
| 36 | + { label: '自定义启用', value: 'CUSTOM' }, | |
| 37 | 37 | ], | 
| 38 | 38 | }, | 
| 39 | 39 | }, | 
| 40 | 40 | { | 
| 41 | - field: 'time', | |
| 41 | + field: 'timezone', | |
| 42 | 42 | label: '时区', | 
| 43 | 43 | colProps: { span: 24 }, | 
| 44 | 44 | required: true, | 
| 45 | - component: 'Input', | |
| 45 | + component: 'Select', | |
| 46 | 46 | componentProps: { | 
| 47 | - placeholder: 'Asia/Shanghai (UTC+08:00)', | |
| 47 | + placeholder: '请选择时区', | |
| 48 | + options: [ | |
| 49 | + { label: 'Africa/Abidjan (UTC+00:00)', value: 'Africa/Abidjan (UTC+00:00)' }, | |
| 50 | + { label: 'Africa/Accra (UTC+00:00)', value: 'Africa/Accra (UTC+00:00)' }, | |
| 51 | + { label: 'Africa/Addis Ababa (UTC+03:00)', value: 'Africa/Addis Ababa (UTC+03:00)' }, | |
| 52 | + { label: 'Africa/Asmara (UTC+03:00)', value: 'Africa/Asmara (UTC+03:00)' }, | |
| 53 | + ], | |
| 48 | 54 | }, | 
| 49 | 55 | ifShow: ({ values }) => | 
| 50 | - isWenDu(Reflect.get(values, 'detail')) || isTimeAll(Reflect.get(values, 'detail')), | |
| 56 | + isWenDu(Reflect.get(values, 'schedule')) || isTimeAll(Reflect.get(values, 'schedule')), | |
| 51 | 57 | }, | 
| 52 | 58 | |
| 53 | 59 | { | 
| 54 | - field: 'data1', | |
| 60 | + field: 'daysOfWeek', | |
| 55 | 61 | component: 'Checkbox', | 
| 56 | 62 | label: '星期一', | 
| 57 | 63 | colProps: { | 
| 58 | 64 | span: 8, | 
| 59 | 65 | }, | 
| 60 | 66 | renderComponentContent: '', | 
| 61 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 67 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 62 | 68 | }, | 
| 63 | 69 | { | 
| 64 | - field: 'time1', | |
| 70 | + field: 'startsOn', | |
| 65 | 71 | component: 'TimePicker', | 
| 66 | 72 | label: '时间选择', | 
| 67 | 73 | colProps: { | 
| 68 | 74 | span: 8, | 
| 69 | 75 | }, | 
| 70 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 76 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 71 | 77 | }, | 
| 72 | 78 | { | 
| 73 | - field: 'time2', | |
| 79 | + field: 'endsOn', | |
| 74 | 80 | component: 'TimePicker', | 
| 75 | 81 | label: '时间选择', | 
| 76 | 82 | colProps: { | 
| 77 | 83 | span: 8, | 
| 78 | 84 | }, | 
| 79 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 85 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 80 | 86 | }, | 
| 81 | 87 | |
| 82 | 88 | { | 
| 83 | - field: 'data2', | |
| 89 | + field: 'daysOfWeek', | |
| 84 | 90 | component: 'Checkbox', | 
| 85 | 91 | label: '星期二', | 
| 86 | 92 | colProps: { | 
| 87 | 93 | span: 8, | 
| 88 | 94 | }, | 
| 89 | 95 | renderComponentContent: '', | 
| 90 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 96 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 91 | 97 | }, | 
| 92 | 98 | { | 
| 93 | - field: 'time3', | |
| 99 | + field: 'startsOn', | |
| 94 | 100 | component: 'TimePicker', | 
| 95 | 101 | label: '时间选择', | 
| 96 | 102 | colProps: { | 
| 97 | 103 | span: 8, | 
| 98 | 104 | }, | 
| 99 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 105 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 100 | 106 | }, | 
| 101 | 107 | { | 
| 102 | - field: 'time4', | |
| 108 | + field: 'endsOn', | |
| 103 | 109 | component: 'TimePicker', | 
| 104 | 110 | label: '时间选择', | 
| 105 | 111 | colProps: { | 
| 106 | 112 | span: 8, | 
| 107 | 113 | }, | 
| 108 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 114 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 109 | 115 | }, | 
| 110 | 116 | { | 
| 111 | - field: 'data3', | |
| 117 | + field: 'daysOfWeek', | |
| 112 | 118 | component: 'Checkbox', | 
| 113 | 119 | label: '星期三', | 
| 114 | 120 | colProps: { | 
| 115 | 121 | span: 8, | 
| 116 | 122 | }, | 
| 117 | 123 | renderComponentContent: '', | 
| 118 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 124 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 119 | 125 | }, | 
| 120 | 126 | { | 
| 121 | - field: 'time5', | |
| 127 | + field: 'startsOn', | |
| 122 | 128 | component: 'TimePicker', | 
| 123 | 129 | label: '时间选择', | 
| 124 | 130 | colProps: { | 
| 125 | 131 | span: 8, | 
| 126 | 132 | }, | 
| 127 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 133 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 128 | 134 | }, | 
| 129 | 135 | { | 
| 130 | - field: 'time6', | |
| 136 | + field: 'endsOn', | |
| 131 | 137 | component: 'TimePicker', | 
| 132 | 138 | label: '时间选择', | 
| 133 | 139 | colProps: { | 
| 134 | 140 | span: 8, | 
| 135 | 141 | }, | 
| 136 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 142 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 137 | 143 | }, | 
| 138 | 144 | { | 
| 139 | - field: 'data4', | |
| 145 | + field: 'daysOfWeek', | |
| 140 | 146 | component: 'Checkbox', | 
| 141 | 147 | label: '星期四', | 
| 142 | 148 | colProps: { | 
| 143 | 149 | span: 8, | 
| 144 | 150 | }, | 
| 145 | 151 | renderComponentContent: '', | 
| 146 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 152 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 147 | 153 | }, | 
| 148 | 154 | { | 
| 149 | - field: 'time7', | |
| 155 | + field: 'startsOn', | |
| 150 | 156 | component: 'TimePicker', | 
| 151 | 157 | label: '时间选择', | 
| 152 | 158 | colProps: { | 
| 153 | 159 | span: 8, | 
| 154 | 160 | }, | 
| 155 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 161 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 156 | 162 | }, | 
| 157 | 163 | { | 
| 158 | - field: 'time8', | |
| 164 | + field: 'endsOn', | |
| 159 | 165 | component: 'TimePicker', | 
| 160 | 166 | label: '时间选择', | 
| 161 | 167 | colProps: { | 
| 162 | 168 | span: 8, | 
| 163 | 169 | }, | 
| 164 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 170 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 165 | 171 | }, | 
| 166 | 172 | { | 
| 167 | - field: 'data5', | |
| 173 | + field: 'daysOfWeek', | |
| 168 | 174 | component: 'Checkbox', | 
| 169 | 175 | label: '星期五', | 
| 170 | 176 | colProps: { | 
| 171 | 177 | span: 8, | 
| 172 | 178 | }, | 
| 173 | 179 | renderComponentContent: '', | 
| 174 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 180 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 175 | 181 | }, | 
| 176 | 182 | { | 
| 177 | - field: 'time9', | |
| 183 | + field: 'startsOn', | |
| 178 | 184 | component: 'TimePicker', | 
| 179 | 185 | label: '时间选择', | 
| 180 | 186 | colProps: { | 
| 181 | 187 | span: 8, | 
| 182 | 188 | }, | 
| 183 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 189 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 184 | 190 | }, | 
| 185 | 191 | { | 
| 186 | - field: 'time33', | |
| 192 | + field: 'endsOn', | |
| 187 | 193 | component: 'TimePicker', | 
| 188 | 194 | label: '时间选择', | 
| 189 | 195 | colProps: { | 
| 190 | 196 | span: 8, | 
| 191 | 197 | }, | 
| 192 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 198 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 193 | 199 | }, | 
| 194 | 200 | { | 
| 195 | - field: 'data6', | |
| 201 | + field: 'daysOfWeek', | |
| 196 | 202 | component: 'Checkbox', | 
| 197 | 203 | label: '星期六', | 
| 198 | 204 | colProps: { | 
| 199 | 205 | span: 8, | 
| 200 | 206 | }, | 
| 201 | 207 | renderComponentContent: '', | 
| 202 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 208 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 203 | 209 | }, | 
| 204 | 210 | { | 
| 205 | - field: 'time333', | |
| 211 | + field: 'startsOn', | |
| 206 | 212 | component: 'TimePicker', | 
| 207 | 213 | label: '时间选择', | 
| 208 | 214 | colProps: { | 
| 209 | 215 | span: 8, | 
| 210 | 216 | }, | 
| 211 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 217 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 212 | 218 | }, | 
| 213 | 219 | { | 
| 214 | - field: 'time131', | |
| 220 | + field: 'endsOn', | |
| 215 | 221 | component: 'TimePicker', | 
| 216 | 222 | label: '时间选择', | 
| 217 | 223 | colProps: { | 
| 218 | 224 | span: 8, | 
| 219 | 225 | }, | 
| 220 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 226 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 221 | 227 | }, | 
| 222 | 228 | { | 
| 223 | - field: 'data7', | |
| 229 | + field: 'daysOfWeek', | |
| 224 | 230 | component: 'Checkbox', | 
| 225 | 231 | label: '星期七', | 
| 226 | 232 | colProps: { | 
| 227 | 233 | span: 8, | 
| 228 | 234 | }, | 
| 229 | 235 | renderComponentContent: '', | 
| 230 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 236 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 231 | 237 | }, | 
| 232 | 238 | { | 
| 233 | - field: 'time3423', | |
| 239 | + field: 'startsOn', | |
| 234 | 240 | component: 'TimePicker', | 
| 235 | 241 | label: '时间选择', | 
| 236 | 242 | colProps: { | 
| 237 | 243 | span: 8, | 
| 238 | 244 | }, | 
| 239 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 245 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 240 | 246 | }, | 
| 241 | 247 | { | 
| 242 | - field: 'time3431', | |
| 248 | + field: 'endsOn', | |
| 243 | 249 | component: 'TimePicker', | 
| 244 | 250 | label: '时间选择', | 
| 245 | 251 | colProps: { | 
| 246 | 252 | span: 8, | 
| 247 | 253 | }, | 
| 248 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 254 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | |
| 249 | 255 | }, | 
| 250 | 256 | |
| 251 | 257 | { | 
| 252 | - field: 'weekday', | |
| 258 | + field: 'daysOfWeek', | |
| 253 | 259 | component: 'CheckboxGroup', | 
| 254 | 260 | label: '天', | 
| 255 | 261 | colProps: { | 
| ... | ... | @@ -293,24 +299,24 @@ export const formSchema: FormSchema[] = [ | 
| 293 | 299 | }, | 
| 294 | 300 | ], | 
| 295 | 301 | }, | 
| 296 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 302 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | |
| 297 | 303 | }, | 
| 298 | 304 | { | 
| 299 | - field: 'timerrw', | |
| 305 | + field: 'startsOn', | |
| 300 | 306 | component: 'TimePicker', | 
| 301 | 307 | label: '时间选择', | 
| 302 | 308 | colProps: { | 
| 303 | 309 | span: 8, | 
| 304 | 310 | }, | 
| 305 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 311 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | |
| 306 | 312 | }, | 
| 307 | 313 | { | 
| 308 | - field: 'timewwq', | |
| 314 | + field: 'endsOn', | |
| 309 | 315 | component: 'TimePicker', | 
| 310 | 316 | label: '时间选择', | 
| 311 | 317 | colProps: { | 
| 312 | 318 | span: 8, | 
| 313 | 319 | }, | 
| 314 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 320 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | |
| 315 | 321 | }, | 
| 316 | 322 | ]; | ... | ... | 
| ... | ... | @@ -3,6 +3,7 @@ import { findDictItemByCode } from '/@/api/system/dict'; | 
| 3 | 3 | // import { getOrganizationList } from '/@/api/system/system'; | 
| 4 | 4 | // import { copyTransFun } from '/@/utils/fnUtils'; | 
| 5 | 5 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | 
| 6 | +import { ref } from 'vue'; | |
| 6 | 7 | |
| 7 | 8 | export const step1Schemas: FormSchema[] = [ | 
| 8 | 9 | { | 
| ... | ... | @@ -108,35 +109,40 @@ export const step3HighSetting: FormSchema[] = [ | 
| 108 | 109 | }, | 
| 109 | 110 | ]; | 
| 110 | 111 | |
| 112 | +export const isWhereType = ref(null); | |
| 113 | + | |
| 111 | 114 | export const step3CreateAlarm: FormSchema[] = [ | 
| 112 | 115 | { | 
| 113 | - field: 'alarmType', | |
| 116 | + field: '', | |
| 114 | 117 | component: 'Select', | 
| 115 | 118 | label: '严重程度', | 
| 116 | 119 | componentProps: { | 
| 117 | 120 | placeholder: '请选择严重程度', | 
| 118 | 121 | options: [ | 
| 119 | 122 | { | 
| 120 | - value: '1', | |
| 123 | + value: 'CRITICAL', | |
| 121 | 124 | label: '危险', | 
| 122 | 125 | }, | 
| 123 | 126 | { | 
| 124 | - value: '2', | |
| 127 | + value: 'MAJOR', | |
| 125 | 128 | label: '重要', | 
| 126 | 129 | }, | 
| 127 | 130 | { | 
| 128 | - value: '3', | |
| 131 | + value: 'MINOR', | |
| 129 | 132 | label: '次要', | 
| 130 | 133 | }, | 
| 131 | 134 | { | 
| 132 | - value: '4', | |
| 135 | + value: 'WARNING', | |
| 133 | 136 | label: '警告', | 
| 134 | 137 | }, | 
| 135 | 138 | { | 
| 136 | - value: '5', | |
| 139 | + value: 'INDETERMINATE', | |
| 137 | 140 | label: '不确定', | 
| 138 | 141 | }, | 
| 139 | 142 | ], | 
| 143 | + onChange: (v) => { | |
| 144 | + isWhereType.value = v ? v : 'INDETERMINATE'; | |
| 145 | + }, | |
| 140 | 146 | }, | 
| 141 | 147 | }, | 
| 142 | 148 | ]; | 
| ... | ... | @@ -151,3 +157,19 @@ export const step3ClearAlarm: FormSchema[] = [ | 
| 151 | 157 | // }, | 
| 152 | 158 | // }, | 
| 153 | 159 | ]; | 
| 160 | + | |
| 161 | +export const dashboardFormScheme: FormSchema[] = [ | |
| 162 | + { | |
| 163 | + field: 'dashboardId', | |
| 164 | + component: 'Select', | |
| 165 | + label: 'Mobile dashboard:', | |
| 166 | + componentProps: { | |
| 167 | + placeholder: '请选择Mobile dashboard', | |
| 168 | + options: [ | |
| 169 | + { label: 'DASHBOARD', value: 'DASHBOARD' }, | |
| 170 | + { label: 'DASHBOARD1', value: 'DASHBOARD' }, | |
| 171 | + { label: 'DASHBOARD2', value: 'DASHBOARD' }, | |
| 172 | + ], | |
| 173 | + }, | |
| 174 | + }, | |
| 175 | +]; | ... | ... |