Commit 7dec96f14fc5035fafc1061815b946c8e55dc503
Merge branch 'ft_local_dev' into 'main'
fix:修改Tembition上的问题 See merge request huang/yun-teng-iot-front!405
Showing
11 changed files
with
211 additions
and
237 deletions
| @@ -18,7 +18,8 @@ enum ScreenManagerApi { | @@ -18,7 +18,8 @@ enum ScreenManagerApi { | ||
| 18 | SCREEN_ORGANIZATION_URL = '/organization/me/list', | 18 | SCREEN_ORGANIZATION_URL = '/organization/me/list', |
| 19 | SCREEN_CHANGE_STATUS = '/convert/update/scene', | 19 | SCREEN_CHANGE_STATUS = '/convert/update/scene', |
| 20 | SCREEN_GET_BY_DEPTID = '/scene_linkage/device/', | 20 | SCREEN_GET_BY_DEPTID = '/scene_linkage/device/', |
| 21 | - GET_ATTRBUTELIST = '/device/keys', | 21 | + // GET_ATTRBUTELIST = '/device/keys', |
| 22 | + GET_ATTRBUTELIST = '/device/attributes/', | ||
| 22 | ALARM_PROFILE = '/alarm/profile/', | 23 | ALARM_PROFILE = '/alarm/profile/', |
| 23 | MASTER_GET_DEVICE = '/device/list/master', | 24 | MASTER_GET_DEVICE = '/device/list/master', |
| 24 | } | 25 | } |
| @@ -101,10 +102,16 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => { | @@ -101,10 +102,16 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => { | ||
| 101 | /** | 102 | /** |
| 102 | * 获取设备属性列表 | 103 | * 获取设备属性列表 |
| 103 | */ | 104 | */ |
| 104 | -export const getAttribute = (orgId, deviceIds) => { | ||
| 105 | - const joinText = deviceIds == null ? [] : '?deviceIds=' + deviceIds; | 105 | +// export const getAttribute = (orgId, deviceIds) => { |
| 106 | +// const joinText = deviceIds == null ? [] : '?deviceIds=' + deviceIds; | ||
| 107 | +// return defHttp.get({ | ||
| 108 | +// url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText, | ||
| 109 | +// }); | ||
| 110 | +// }; | ||
| 111 | +export const getAttribute = (orgId) => { | ||
| 112 | + // const joinText = deviceIds == null ? [] : '?deviceIds=' + deviceIds; | ||
| 106 | return defHttp.get({ | 113 | return defHttp.get({ |
| 107 | - url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText, | 114 | + url: `${ScreenManagerApi.GET_ATTRBUTELIST}${orgId}`, |
| 108 | }); | 115 | }); |
| 109 | }; | 116 | }; |
| 110 | 117 |
| @@ -55,7 +55,6 @@ | @@ -55,7 +55,6 @@ | ||
| 55 | import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 55 | import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
| 56 | import { Select } from 'ant-design-vue'; | 56 | import { Select } from 'ant-design-vue'; |
| 57 | import DeviceAttrCpns from './cpns/DeviceAttrCpns.vue'; | 57 | import DeviceAttrCpns from './cpns/DeviceAttrCpns.vue'; |
| 58 | - import { SelectTypes } from 'ant-design-vue/es/select'; | ||
| 59 | import { SchemaFiled } from './config.data'; | 58 | import { SchemaFiled } from './config.data'; |
| 60 | import { QueryWay } from '../../device/localtion/cpns/TimePeriodForm/config'; | 59 | import { QueryWay } from '../../device/localtion/cpns/TimePeriodForm/config'; |
| 61 | import { AggregateDataEnum } from '../../device/localtion/cpns/TimePeriodForm/config'; | 60 | import { AggregateDataEnum } from '../../device/localtion/cpns/TimePeriodForm/config'; |
| @@ -68,6 +67,14 @@ | @@ -68,6 +67,14 @@ | ||
| 68 | device?: string; | 67 | device?: string; |
| 69 | name?: string; | 68 | name?: string; |
| 70 | attributes?: string | undefined; | 69 | attributes?: string | undefined; |
| 70 | + deviceProfileId?: string; | ||
| 71 | + id?: string; | ||
| 72 | + }; | ||
| 73 | + type TSelectOption = { | ||
| 74 | + value?: string; | ||
| 75 | + label?: string; | ||
| 76 | + deviceProfileId?: string; | ||
| 77 | + id?: string; | ||
| 71 | }; | 78 | }; |
| 72 | const emit = defineEmits(['success', 'register']); | 79 | const emit = defineEmits(['success', 'register']); |
| 73 | const bindDeviceRefObj = { | 80 | const bindDeviceRefObj = { |
| @@ -76,7 +83,7 @@ | @@ -76,7 +83,7 @@ | ||
| 76 | const isUpdate = ref(true); | 83 | const isUpdate = ref(true); |
| 77 | const editId = ref(''); | 84 | const editId = ref(''); |
| 78 | const orgId = ref(''); | 85 | const orgId = ref(''); |
| 79 | - const selectOptions: Ref<SelectTypes['options']> = ref([]); | 86 | + const selectOptions: Ref<TSelectOption[]> = ref([]); |
| 80 | const selectDevice = ref([]); | 87 | const selectDevice = ref([]); |
| 81 | const deviceList: Ref<TDeviceList[]> = ref([]); | 88 | const deviceList: Ref<TDeviceList[]> = ref([]); |
| 82 | const editDeviceList: Ref<TDeviceList[]> = ref([]); | 89 | const editDeviceList: Ref<TDeviceList[]> = ref([]); |
| @@ -126,18 +133,20 @@ | @@ -126,18 +133,20 @@ | ||
| 126 | return { | 133 | return { |
| 127 | label: item.name, | 134 | label: item.name, |
| 128 | value: item.tbDeviceId, | 135 | value: item.tbDeviceId, |
| 136 | + id: item.id, | ||
| 137 | + deviceProfileId: item.deviceProfileId, | ||
| 129 | }; | 138 | }; |
| 130 | }); | 139 | }); |
| 131 | } | 140 | } |
| 132 | } | 141 | } |
| 133 | ); | 142 | ); |
| 134 | //设备Select选中 | 143 | //设备Select选中 |
| 135 | - const handleDeviceChange = (e) => { | 144 | + const handleDeviceChange = (_, o) => { |
| 136 | if (unref(isUpdate)) { | 145 | if (unref(isUpdate)) { |
| 137 | //编辑 | 146 | //编辑 |
| 138 | let temp: any = []; | 147 | let temp: any = []; |
| 139 | editDeviceAttr.value.forEach((f) => { | 148 | editDeviceAttr.value.forEach((f) => { |
| 140 | - temp = [f, ...e]; | 149 | + temp = [f, ...o]; |
| 141 | }); | 150 | }); |
| 142 | let deWeightThree = () => { | 151 | let deWeightThree = () => { |
| 143 | let map = new Map(); | 152 | let map = new Map(); |
| @@ -150,11 +159,11 @@ | @@ -150,11 +159,11 @@ | ||
| 150 | }; | 159 | }; |
| 151 | temp = deWeightThree(); | 160 | temp = deWeightThree(); |
| 152 | deviceList.value = temp; | 161 | deviceList.value = temp; |
| 153 | - if (e.length !== 0) { | ||
| 154 | - deviceList.value = e; | 162 | + if (o.length !== 0) { |
| 163 | + deviceList.value = o; | ||
| 155 | } | 164 | } |
| 156 | } else { | 165 | } else { |
| 157 | - deviceList.value = e; | 166 | + deviceList.value = o; |
| 158 | } | 167 | } |
| 159 | }; | 168 | }; |
| 160 | //设备取消删除 | 169 | //设备取消删除 |
| @@ -284,6 +293,8 @@ | @@ -284,6 +293,8 @@ | ||
| 284 | return { | 293 | return { |
| 285 | label: item.name, | 294 | label: item.name, |
| 286 | value: item.tbDeviceId, | 295 | value: item.tbDeviceId, |
| 296 | + id: item.id, | ||
| 297 | + deviceProfileId: item.deviceProfileId, | ||
| 287 | }; | 298 | }; |
| 288 | }); | 299 | }); |
| 289 | const deviceIds = editResData.data.executeAttributes.map((m) => { | 300 | const deviceIds = editResData.data.executeAttributes.map((m) => { |
| @@ -295,7 +306,16 @@ | @@ -295,7 +306,16 @@ | ||
| 295 | selectDevice.value = deviceIds; | 306 | selectDevice.value = deviceIds; |
| 296 | //回显设备属性 | 307 | //回显设备属性 |
| 297 | editDeviceAttr.value = editResData.data.executeAttributes?.map((item) => { | 308 | editDeviceAttr.value = editResData.data.executeAttributes?.map((item) => { |
| 309 | + const T = selectOptions.value.find((o) => { | ||
| 310 | + if (item.device === o.value) { | ||
| 311 | + return { | ||
| 312 | + id: o.id, | ||
| 313 | + deviceProfileId: o.deviceProfileId, | ||
| 314 | + }; | ||
| 315 | + } | ||
| 316 | + }); | ||
| 298 | return { | 317 | return { |
| 318 | + ...T, | ||
| 299 | label: item.name, | 319 | label: item.name, |
| 300 | value: item.device, | 320 | value: item.device, |
| 301 | attributes: item.attributes, | 321 | attributes: item.attributes, |
| @@ -43,21 +43,23 @@ | @@ -43,21 +43,23 @@ | ||
| 43 | }); | 43 | }); |
| 44 | const selectOptions: any = ref([]); | 44 | const selectOptions: any = ref([]); |
| 45 | //获取对应设备属性 | 45 | //获取对应设备属性 |
| 46 | - const getAttr = async (orgId, deviceId) => { | ||
| 47 | - const res = await getAttribute(orgId, deviceId); | ||
| 48 | - selectOptions.value = res.map((o) => { | ||
| 49 | - let obj: any = {}; | ||
| 50 | - if (o !== null) { | ||
| 51 | - obj = { | ||
| 52 | - label: o, | ||
| 53 | - value: o, | ||
| 54 | - }; | ||
| 55 | - return obj; | ||
| 56 | - } | ||
| 57 | - }); | ||
| 58 | - //如果服务端返回的数组里含有null 过滤null值 | ||
| 59 | - const excludeNull = selectOptions.value.filter(Boolean); | ||
| 60 | - selectOptions.value = excludeNull; | 46 | + const getAttr = async (orgId, _) => { |
| 47 | + const res = await getAttribute(orgId); | ||
| 48 | + if (Array.isArray(res)) { | ||
| 49 | + selectOptions.value = res.map((o) => { | ||
| 50 | + let obj: any = {}; | ||
| 51 | + if (o?.identifier !== null) { | ||
| 52 | + obj = { | ||
| 53 | + label: o?.identifier, | ||
| 54 | + value: o?.identifier, | ||
| 55 | + }; | ||
| 56 | + return obj; | ||
| 57 | + } | ||
| 58 | + }); | ||
| 59 | + //如果服务端返回的数组里含有null 过滤null值 | ||
| 60 | + const excludeNull = selectOptions.value.filter(Boolean); | ||
| 61 | + selectOptions.value = excludeNull; | ||
| 62 | + } | ||
| 61 | }; | 63 | }; |
| 62 | //动态数据 | 64 | //动态数据 |
| 63 | const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); | 65 | const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); |
| @@ -69,12 +71,12 @@ | @@ -69,12 +71,12 @@ | ||
| 69 | * 初始化数值 | 71 | * 初始化数值 |
| 70 | */ | 72 | */ |
| 71 | async function initVal() { | 73 | async function initVal() { |
| 72 | - if (props.orgId && props.value.value) { | ||
| 73 | - await getAttr(props.orgId, props.value.value); | 74 | + if (props.value) { |
| 75 | + await getAttr(props.value?.deviceProfileId, props.value?.id); | ||
| 74 | dynamicInput.params.push({ | 76 | dynamicInput.params.push({ |
| 75 | name: props.value.label, | 77 | name: props.value.label, |
| 76 | device: props.value.value, | 78 | device: props.value.value, |
| 77 | - attributes: props.value.attributes == [] ? [] : props.value.attributes, | 79 | + attributes: props.value?.attributes == [] ? [] : props.value.attributes, |
| 78 | }); | 80 | }); |
| 79 | } | 81 | } |
| 80 | } | 82 | } |
| @@ -271,10 +271,10 @@ | @@ -271,10 +271,10 @@ | ||
| 271 | }; | 271 | }; |
| 272 | 272 | ||
| 273 | const validateHasData = (record: Recordable) => { | 273 | const validateHasData = (record: Recordable) => { |
| 274 | - notFoundData.value = false; | 274 | + notFoundData.value = true; |
| 275 | const { val = [], attr } = (record as unknown as ResponsData) || {}; | 275 | const { val = [], attr } = (record as unknown as ResponsData) || {}; |
| 276 | if (!attr || !val.length) { | 276 | if (!attr || !val.length) { |
| 277 | - notFoundData.value = true; | 277 | + notFoundData.value = false; |
| 278 | } | 278 | } |
| 279 | }; | 279 | }; |
| 280 | 280 |
| @@ -228,7 +228,7 @@ | @@ -228,7 +228,7 @@ | ||
| 228 | // 回显触发器数据---此处是个闭包! | 228 | // 回显触发器数据---此处是个闭包! |
| 229 | triggers.forEach((trigger, index) => { | 229 | triggers.forEach((trigger, index) => { |
| 230 | nextTick(async () => { | 230 | nextTick(async () => { |
| 231 | - const selectDeviceId = ref(''); | 231 | + const selectProductId = ref(''); |
| 232 | // 回显启用规则 | 232 | // 回显启用规则 |
| 233 | unref(skipUnwrap.triggerItemRefs)[index].currentIndex = | 233 | unref(skipUnwrap.triggerItemRefs)[index].currentIndex = |
| 234 | map[trigger.triggerCondition.schedule.type]; | 234 | map[trigger.triggerCondition.schedule.type]; |
| @@ -245,18 +245,16 @@ | @@ -245,18 +245,16 @@ | ||
| 245 | operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, | 245 | operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, |
| 246 | detail: trigger?.triggerCondition?.alarmDetails, | 246 | detail: trigger?.triggerCondition?.alarmDetails, |
| 247 | entityId: trigger?.entityId, | 247 | entityId: trigger?.entityId, |
| 248 | + deviceProfileId: trigger?.deviceProfileId, | ||
| 248 | replaceValue: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 249 | replaceValue: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
| 249 | time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 250 | time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
| 250 | timeUnit: trigger?.triggerCondition?.condition?.spec?.unit, | 251 | timeUnit: trigger?.triggerCondition?.condition?.spec?.unit, |
| 251 | }); | 252 | }); |
| 252 | - if (trigger.entityId != undefined) { | ||
| 253 | - selectDeviceId.value = trigger?.entityId; | 253 | + if (trigger.deviceProfileId != undefined) { |
| 254 | + selectProductId.value = trigger?.deviceProfileId; | ||
| 254 | } | 255 | } |
| 255 | //fengtao-把设备id回传给子组件 | 256 | //fengtao-把设备id回传给子组件 |
| 256 | - unref(skipUnwrap.triggerItemRefs)[index].updateFieldAttributeFunc( | ||
| 257 | - selectDeviceId.value, | ||
| 258 | - provideOrgid.value | ||
| 259 | - ); | 257 | + unref(skipUnwrap.triggerItemRefs)[index].updateFieldAttributeFunc(selectProductId.value); |
| 260 | //fengtao | 258 | //fengtao |
| 261 | // 设置值operationType | 259 | // 设置值operationType |
| 262 | unref(skipUnwrap.triggerItemRefs)[index].operationType = | 260 | unref(skipUnwrap.triggerItemRefs)[index].operationType = |
| @@ -309,7 +307,7 @@ | @@ -309,7 +307,7 @@ | ||
| 309 | 307 | ||
| 310 | doConditions.forEach((condition, index) => { | 308 | doConditions.forEach((condition, index) => { |
| 311 | nextTick(async () => { | 309 | nextTick(async () => { |
| 312 | - const selectDeviceId = ref(''); | 310 | + const selectProductId = ref(''); |
| 313 | // 回显启用规则 | 311 | // 回显启用规则 |
| 314 | unref(skipUnwrap.conditionItemRefs)[index].currentIndex = | 312 | unref(skipUnwrap.conditionItemRefs)[index].currentIndex = |
| 315 | map[condition.triggerCondition.schedule.type]; | 313 | map[condition.triggerCondition.schedule.type]; |
| @@ -327,17 +325,17 @@ | @@ -327,17 +325,17 @@ | ||
| 327 | operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, | 325 | operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, |
| 328 | detail: condition?.triggerCondition?.alarmDetails, | 326 | detail: condition?.triggerCondition?.alarmDetails, |
| 329 | entityId: condition?.entityId, | 327 | entityId: condition?.entityId, |
| 328 | + deviceProfileId: condition?.deviceProfileId, | ||
| 330 | replaceValue: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 329 | replaceValue: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
| 331 | time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 330 | time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
| 332 | timeUnit: condition?.triggerCondition?.condition?.spec?.unit, | 331 | timeUnit: condition?.triggerCondition?.condition?.spec?.unit, |
| 333 | }); | 332 | }); |
| 334 | - if (condition?.entityId != undefined) { | ||
| 335 | - selectDeviceId.value = condition?.entityId; | 333 | + if (condition?.deviceProfileId != undefined) { |
| 334 | + selectProductId.value = condition?.deviceProfileId; | ||
| 336 | } | 335 | } |
| 337 | //fengtao-把设备id回传给子组件 | 336 | //fengtao-把设备id回传给子组件 |
| 338 | unref(skipUnwrap.conditionItemRefs)[index].updateFieldAttributeFunc( | 337 | unref(skipUnwrap.conditionItemRefs)[index].updateFieldAttributeFunc( |
| 339 | - selectDeviceId.value, | ||
| 340 | - provideOrgid.value | 338 | + selectProductId.value |
| 341 | ); | 339 | ); |
| 342 | //fengtao | 340 | //fengtao |
| 343 | // 设置值operationType | 341 | // 设置值operationType |
| @@ -388,10 +386,9 @@ | @@ -388,10 +386,9 @@ | ||
| 388 | }); | 386 | }); |
| 389 | }); | 387 | }); |
| 390 | }); | 388 | }); |
| 391 | - | ||
| 392 | doActions.forEach((action, index) => { | 389 | doActions.forEach((action, index) => { |
| 393 | nextTick(() => { | 390 | nextTick(() => { |
| 394 | - const selectDeviceId = ref(''); | 391 | + const selectProductId = ref(''); |
| 395 | // 设置执行动作外层值 | 392 | // 设置执行动作外层值 |
| 396 | unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({ | 393 | unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({ |
| 397 | ...action, | 394 | ...action, |
| @@ -439,6 +436,7 @@ | @@ -439,6 +436,7 @@ | ||
| 439 | .valueType, | 436 | .valueType, |
| 440 | detail: action.doContext.clearRule[index].triggerCondition.alarmDetails, | 437 | detail: action.doContext.clearRule[index].triggerCondition.alarmDetails, |
| 441 | entityId: action.doContext.clearRule[index].entityId, | 438 | entityId: action.doContext.clearRule[index].entityId, |
| 439 | + deviceProfileId: action.doContext.clearRule[index]?.deviceProfileId, | ||
| 442 | replaceValue: | 440 | replaceValue: |
| 443 | action.doContext.clearRule[index].triggerCondition.condition.spec.predicate | 441 | action.doContext.clearRule[index].triggerCondition.condition.spec.predicate |
| 444 | .defaultValue, | 442 | .defaultValue, |
| @@ -447,17 +445,12 @@ | @@ -447,17 +445,12 @@ | ||
| 447 | timeUnit: | 445 | timeUnit: |
| 448 | action.doContext.clearRule[index].triggerCondition.condition.spec.unit, | 446 | action.doContext.clearRule[index].triggerCondition.condition.spec.unit, |
| 449 | }); | 447 | }); |
| 450 | - if (action.doContext.clearRule[index].entityId != undefined) { | ||
| 451 | - selectDeviceId.value = action.doContext.clearRule[index].entityId; | 448 | + if (action.doContext.clearRule[index]?.deviceProfileId != undefined) { |
| 449 | + selectProductId.value = action.doContext.clearRule[index]?.deviceProfileId; | ||
| 452 | } | 450 | } |
| 453 | //fengtao-把设备id回传给子组件 | 451 | //fengtao-把设备id回传给子组件 |
| 454 | - item.updateFieldAttributeFunc(selectDeviceId.value, provideOrgid.value); | ||
| 455 | - // item.updateFieldDeviceId( | ||
| 456 | - // deviceList.value, | ||
| 457 | - // provideOrgid.value, | ||
| 458 | - // isUpdate.value, | ||
| 459 | - // getMasterDeviceList.value | ||
| 460 | - // ); | 452 | + item.updateFieldAttributeFunc(selectProductId.value); |
| 453 | + item.updateFieldDeviceId(deviceList.value, provideOrgid.value, isUpdate.value); | ||
| 461 | //fengtao | 454 | //fengtao |
| 462 | // 单独设置operationType值 操作符类型 NUMERIC|String|Boolean|DATE_TIME | 455 | // 单独设置operationType值 操作符类型 NUMERIC|String|Boolean|DATE_TIME |
| 463 | item.operationType = | 456 | item.operationType = |
| @@ -534,12 +527,12 @@ | @@ -534,12 +527,12 @@ | ||
| 534 | }); | 527 | }); |
| 535 | 528 | ||
| 536 | // 设置设备的options | 529 | // 设置设备的options |
| 537 | - const setEditFields = (_linkAge, _deviceList) => { | ||
| 538 | - // unref(linkAge).map((item) => { | ||
| 539 | - //TODO-fengtao | ||
| 540 | - // item.updateFieldDeviceId(deviceList, orgId, isUpdate, getMasterDeviceList); | ||
| 541 | - //TODO-fengtao | ||
| 542 | - // }); | 530 | + const setEditFields = (linkAge, deviceList) => { |
| 531 | + unref(linkAge).map((item) => { | ||
| 532 | + // TODO-fengtao | ||
| 533 | + item.updateFieldDeviceId(deviceList, orgId, isUpdate); | ||
| 534 | + // TODO-fengtao | ||
| 535 | + }); | ||
| 543 | }; | 536 | }; |
| 544 | // 设置告警配置options | 537 | // 设置告警配置options |
| 545 | const setEditAlarmConfig = (linkAge, alarmConfigList) => { | 538 | const setEditAlarmConfig = (linkAge, alarmConfigList) => { |
| @@ -600,7 +593,7 @@ | @@ -600,7 +593,7 @@ | ||
| 600 | unref(linkAge).map((item) => { | 593 | unref(linkAge).map((item) => { |
| 601 | isOrganizationChange && item.resetFieldsValueFunc(); | 594 | isOrganizationChange && item.resetFieldsValueFunc(); |
| 602 | //TODO fengtao | 595 | //TODO fengtao |
| 603 | - // item.updateFieldDeviceId(deviceList, orgId, isUpdate, getMasterDeviceList); | 596 | + item.updateFieldDeviceId(deviceList, orgId, isUpdate); |
| 604 | if (isUpdate.value) { | 597 | if (isUpdate.value) { |
| 605 | item.updateEditFieldAlarmConfig(editAlarmConfigData); | 598 | item.updateEditFieldAlarmConfig(editAlarmConfigData); |
| 606 | } else { | 599 | } else { |
| @@ -3,6 +3,7 @@ import { BasicColumn, FormSchema } from '/@/components/Table'; | @@ -3,6 +3,7 @@ import { BasicColumn, FormSchema } from '/@/components/Table'; | ||
| 3 | import { | 3 | import { |
| 4 | byOrganizationIdGetMasterDevice, | 4 | byOrganizationIdGetMasterDevice, |
| 5 | screenLinkOrganizationGetApi, | 5 | screenLinkOrganizationGetApi, |
| 6 | + getAttribute, | ||
| 6 | } from '/@/api/ruleengine/ruleengineApi'; | 7 | } from '/@/api/ruleengine/ruleengineApi'; |
| 7 | import { scheduleOptions } from './formatData'; | 8 | import { scheduleOptions } from './formatData'; |
| 8 | import { copyTransFun } from '/@/utils/fnUtils'; | 9 | import { copyTransFun } from '/@/utils/fnUtils'; |
| @@ -196,6 +197,52 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -196,6 +197,52 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
| 196 | colProps: { span: 6 }, | 197 | colProps: { span: 6 }, |
| 197 | }, | 198 | }, |
| 198 | { | 199 | { |
| 200 | + field: 'deviceProfileId', | ||
| 201 | + label: '', | ||
| 202 | + component: 'ApiSelect', | ||
| 203 | + colProps: { span: 6 }, | ||
| 204 | + componentProps: ({ formActionType }) => { | ||
| 205 | + const { updateSchema, setFieldsValue } = formActionType; | ||
| 206 | + return { | ||
| 207 | + api: deviceProfile, | ||
| 208 | + placeholder: '请选择产品', | ||
| 209 | + labelField: 'name', | ||
| 210 | + valueField: 'id', | ||
| 211 | + getPopupContainer: () => document.body, | ||
| 212 | + onChange: async (e) => { | ||
| 213 | + if (e) { | ||
| 214 | + setFieldsValue({ type2: '' }); | ||
| 215 | + const res = await getAttribute(e); | ||
| 216 | + let options: any = []; | ||
| 217 | + if (Array.isArray(res)) { | ||
| 218 | + options = res.map((m) => { | ||
| 219 | + return { | ||
| 220 | + label: m?.identifier, | ||
| 221 | + value: m?.identifier, | ||
| 222 | + }; | ||
| 223 | + }); | ||
| 224 | + updateSchema({ | ||
| 225 | + field: 'type2', | ||
| 226 | + componentProps: { | ||
| 227 | + placeholder: '请选择属性', | ||
| 228 | + options, | ||
| 229 | + }, | ||
| 230 | + }); | ||
| 231 | + } else { | ||
| 232 | + updateSchema({ | ||
| 233 | + field: 'type2', | ||
| 234 | + componentProps: { | ||
| 235 | + placeholder: '请选择属性', | ||
| 236 | + options, | ||
| 237 | + }, | ||
| 238 | + }); | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | + }, | ||
| 242 | + }; | ||
| 243 | + }, | ||
| 244 | + }, | ||
| 245 | + { | ||
| 199 | field: 'device', | 246 | field: 'device', |
| 200 | label: '', | 247 | label: '', |
| 201 | component: 'Select', | 248 | component: 'Select', |
| @@ -208,6 +255,7 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -208,6 +255,7 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
| 208 | }, | 255 | }, |
| 209 | colProps: { span: 6 }, | 256 | colProps: { span: 6 }, |
| 210 | }, | 257 | }, |
| 258 | + | ||
| 211 | { | 259 | { |
| 212 | field: 'entityId', | 260 | field: 'entityId', |
| 213 | label: '', | 261 | label: '', |
| @@ -219,6 +267,7 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -219,6 +267,7 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
| 219 | ifShow: ({ values }) => isPart(values.device), | 267 | ifShow: ({ values }) => isPart(values.device), |
| 220 | colProps: { span: 6 }, | 268 | colProps: { span: 6 }, |
| 221 | }, | 269 | }, |
| 270 | + | ||
| 222 | { | 271 | { |
| 223 | field: 'time', | 272 | field: 'time', |
| 224 | label: '', | 273 | label: '', |
| @@ -370,17 +419,19 @@ export const actionSchema: FormSchema[] = [ | @@ -370,17 +419,19 @@ export const actionSchema: FormSchema[] = [ | ||
| 370 | component: 'ApiSelect', | 419 | component: 'ApiSelect', |
| 371 | componentProps: ({ formModel }) => { | 420 | componentProps: ({ formModel }) => { |
| 372 | const deviceProfileId = formModel['deviceProfileId']; | 421 | const deviceProfileId = formModel['deviceProfileId']; |
| 373 | - return { | ||
| 374 | - placeholder: '请选择设备', | ||
| 375 | - mode: 'multiple', | ||
| 376 | - api: byOrganizationIdGetMasterDevice, | ||
| 377 | - params: { | ||
| 378 | - organizationId: unref(organizationId), | ||
| 379 | - deviceProfileId, | ||
| 380 | - }, | ||
| 381 | - labelField: 'name', | ||
| 382 | - valueField: 'id', | ||
| 383 | - }; | 422 | + if (unref(organizationId)) { |
| 423 | + return { | ||
| 424 | + placeholder: '请选择设备', | ||
| 425 | + mode: 'multiple', | ||
| 426 | + api: byOrganizationIdGetMasterDevice, | ||
| 427 | + params: { | ||
| 428 | + organizationId: unref(organizationId), | ||
| 429 | + deviceProfileId, | ||
| 430 | + }, | ||
| 431 | + labelField: 'name', | ||
| 432 | + valueField: 'id', | ||
| 433 | + }; | ||
| 434 | + } | ||
| 384 | }, | 435 | }, |
| 385 | ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), | 436 | ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), |
| 386 | colProps: { span: 6 }, | 437 | colProps: { span: 6 }, |
| @@ -394,7 +445,7 @@ export const actionSchema: FormSchema[] = [ | @@ -394,7 +445,7 @@ export const actionSchema: FormSchema[] = [ | ||
| 394 | colProps: { | 445 | colProps: { |
| 395 | span: 6, | 446 | span: 6, |
| 396 | }, | 447 | }, |
| 397 | - defaultValue: '0', | 448 | + defaultValue: 0, |
| 398 | componentProps: ({ formActionType }) => { | 449 | componentProps: ({ formActionType }) => { |
| 399 | const { setFieldsValue } = formActionType; | 450 | const { setFieldsValue } = formActionType; |
| 400 | return { | 451 | return { |
| @@ -17,6 +17,7 @@ export const genTriggerOrConditionData = (triggerData) => { | @@ -17,6 +17,7 @@ export const genTriggerOrConditionData = (triggerData) => { | ||
| 17 | time, | 17 | time, |
| 18 | timeUnit, | 18 | timeUnit, |
| 19 | replaceValue, | 19 | replaceValue, |
| 20 | + deviceProfileId, | ||
| 20 | } = triggerData; | 21 | } = triggerData; |
| 21 | const mapPredicate = predicate?.map((item) => { | 22 | const mapPredicate = predicate?.map((item) => { |
| 22 | return { | 23 | return { |
| @@ -40,6 +41,7 @@ export const genTriggerOrConditionData = (triggerData) => { | @@ -40,6 +41,7 @@ export const genTriggerOrConditionData = (triggerData) => { | ||
| 40 | }; | 41 | }; |
| 41 | }); | 42 | }); |
| 42 | return { | 43 | return { |
| 44 | + deviceProfileId, | ||
| 43 | triggerType, | 45 | triggerType, |
| 44 | entityType: device, | 46 | entityType: device, |
| 45 | entityId: entityId?.length ? entityId : null, | 47 | entityId: entityId?.length ? entityId : null, |
| @@ -115,6 +117,7 @@ export const genActionData = (actionData) => { | @@ -115,6 +117,7 @@ export const genActionData = (actionData) => { | ||
| 115 | triggerType: item.triggerType, | 117 | triggerType: item.triggerType, |
| 116 | entityType: item.device, | 118 | entityType: item.device, |
| 117 | entityId: item.device === 'PART' ? item.entityId : null, | 119 | entityId: item.device === 'PART' ? item.entityId : null, |
| 120 | + deviceProfileId: item.deviceProfileId, | ||
| 118 | triggerCondition: { | 121 | triggerCondition: { |
| 119 | alarmDetails: item.detail, | 122 | alarmDetails: item.detail, |
| 120 | condition: { | 123 | condition: { |
| @@ -62,10 +62,10 @@ | @@ -62,10 +62,10 @@ | ||
| 62 | import { CollapseContainer } from '/@/components/Container/index'; | 62 | import { CollapseContainer } from '/@/components/Container/index'; |
| 63 | import { BasicForm, useForm } from '/@/components/Form/index'; | 63 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 64 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; | 64 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; |
| 65 | - import { trigger_condition_schema } from '../config/config.data.ts'; | 65 | + import { trigger_condition_schema } from '../config/config.data'; |
| 66 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 66 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; |
| 67 | import ConditionScreening from './ConditionScreening.vue'; | 67 | import ConditionScreening from './ConditionScreening.vue'; |
| 68 | - import { scheduleOptions, timeUnitOptions, options } from '../config/formatData.ts'; | 68 | + import { scheduleOptions, timeUnitOptions, options } from '../config/formatData'; |
| 69 | import { Icon } from '/@/components/Icon'; | 69 | import { Icon } from '/@/components/Icon'; |
| 70 | import AlarmSchedule from './AlarmSchedule.vue'; | 70 | import AlarmSchedule from './AlarmSchedule.vue'; |
| 71 | import { useModal } from '/@/components/Modal'; | 71 | import { useModal } from '/@/components/Modal'; |
| @@ -99,22 +99,12 @@ | @@ -99,22 +99,12 @@ | ||
| 99 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; | 99 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | - const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => { | 102 | + const updateFieldDeviceId = (deviceList: any[], _, isUpdate) => { |
| 103 | if (isUpdate) { | 103 | if (isUpdate) { |
| 104 | updateSchema({ | 104 | updateSchema({ |
| 105 | field: 'entityId', | 105 | field: 'entityId', |
| 106 | componentProps: { | 106 | componentProps: { |
| 107 | options: deviceList, | 107 | options: deviceList, |
| 108 | - onChange(e) { | ||
| 109 | - if (e) { | ||
| 110 | - if (isUpdate) { | ||
| 111 | - setFieldsValue({ type2: '' }); | ||
| 112 | - } | ||
| 113 | - //fengtao | ||
| 114 | - updateFieldAttributeFunc(e, orgId); | ||
| 115 | - //fengtao | ||
| 116 | - } | ||
| 117 | - }, | ||
| 118 | }, | 108 | }, |
| 119 | }); | 109 | }); |
| 120 | } | 110 | } |
| @@ -127,53 +117,15 @@ | @@ -127,53 +117,15 @@ | ||
| 127 | { label: '部分', value: 'PART' }, | 117 | { label: '部分', value: 'PART' }, |
| 128 | ], | 118 | ], |
| 129 | async onChange(e) { | 119 | async onChange(e) { |
| 130 | - setFieldsValue({ type2: '' }); | ||
| 131 | setFieldsValue({ entityId: [] }); | 120 | setFieldsValue({ entityId: [] }); |
| 132 | - //部分切换-清空或者重置为初始值 | ||
| 133 | - updateSchema({ | ||
| 134 | - field: 'type2', | ||
| 135 | - componentProps: { | ||
| 136 | - options: [], | ||
| 137 | - }, | ||
| 138 | - }); | ||
| 139 | if (e) { | 121 | if (e) { |
| 140 | //fengtao | 122 | //fengtao |
| 141 | if (e == 'ALL') { | 123 | if (e == 'ALL') { |
| 142 | - if (orgId) { | ||
| 143 | - const data = await getAttribute(orgId, null); | ||
| 144 | - //fengtao | ||
| 145 | - const options = data.map((m) => { | ||
| 146 | - return { | ||
| 147 | - label: m, | ||
| 148 | - value: m, | ||
| 149 | - }; | ||
| 150 | - }); | ||
| 151 | - updateSchema({ | ||
| 152 | - field: 'type2', | ||
| 153 | - componentProps: { | ||
| 154 | - placeholder: '请选择属性', | ||
| 155 | - options, | ||
| 156 | - }, | ||
| 157 | - }); | ||
| 158 | - } | ||
| 159 | } else { | 124 | } else { |
| 160 | - const getT = getFieldsValue(); | ||
| 161 | - const entityId = getT.entityId; | ||
| 162 | - if (entityId !== undefined && entityId.length > 0) { | ||
| 163 | - updateFieldAttributeFunc(entityId, orgId); | ||
| 164 | - } | ||
| 165 | updateSchema({ | 125 | updateSchema({ |
| 166 | field: 'entityId', | 126 | field: 'entityId', |
| 167 | componentProps: { | 127 | componentProps: { |
| 168 | options: deviceList, | 128 | options: deviceList, |
| 169 | - onChange(e) { | ||
| 170 | - if (e) { | ||
| 171 | - setFieldsValue({ type2: '' }); | ||
| 172 | - //fengtao | ||
| 173 | - updateFieldAttributeFunc(e, orgId); | ||
| 174 | - //fengtao | ||
| 175 | - } | ||
| 176 | - }, | ||
| 177 | }, | 129 | }, |
| 178 | }); | 130 | }); |
| 179 | } | 131 | } |
| @@ -189,30 +141,32 @@ | @@ -189,30 +141,32 @@ | ||
| 189 | const setFieldsFormValueFun = (fieldsValue) => { | 141 | const setFieldsFormValueFun = (fieldsValue) => { |
| 190 | setFieldsValue(fieldsValue); | 142 | setFieldsValue(fieldsValue); |
| 191 | }; | 143 | }; |
| 192 | - //TODO-fengtao | ||
| 193 | - const updateFieldAttributeFunc = async (deviceId, orgId) => { | ||
| 194 | - //TODO-fengtao | ||
| 195 | - let data; | ||
| 196 | - if (deviceId !== undefined && deviceId.length > 0) { | ||
| 197 | - const joinDeviceIds = deviceId.join(','); | ||
| 198 | - data = await getAttribute(orgId, joinDeviceIds); | 144 | + const updateFieldAttributeFunc = async (e) => { |
| 145 | + const res = await getAttribute(e); | ||
| 146 | + let options: any = []; | ||
| 147 | + if (Array.isArray(res)) { | ||
| 148 | + options = res.map((m) => { | ||
| 149 | + return { | ||
| 150 | + label: m?.identifier, | ||
| 151 | + value: m?.identifier, | ||
| 152 | + }; | ||
| 153 | + }); | ||
| 154 | + updateSchema({ | ||
| 155 | + field: 'type2', | ||
| 156 | + componentProps: { | ||
| 157 | + placeholder: '请选择属性', | ||
| 158 | + options, | ||
| 159 | + }, | ||
| 160 | + }); | ||
| 199 | } else { | 161 | } else { |
| 200 | - data = await getAttribute(orgId, null); | 162 | + updateSchema({ |
| 163 | + field: 'type2', | ||
| 164 | + componentProps: { | ||
| 165 | + placeholder: '请选择属性', | ||
| 166 | + options, | ||
| 167 | + }, | ||
| 168 | + }); | ||
| 201 | } | 169 | } |
| 202 | - //TODO-fengtao | ||
| 203 | - const options = data.map((m) => { | ||
| 204 | - return { | ||
| 205 | - label: m, | ||
| 206 | - value: m, | ||
| 207 | - }; | ||
| 208 | - }); | ||
| 209 | - updateSchema({ | ||
| 210 | - field: 'type2', | ||
| 211 | - componentProps: { | ||
| 212 | - placeholder: '请选择属性', | ||
| 213 | - options: options, | ||
| 214 | - }, | ||
| 215 | - }); | ||
| 216 | }; | 170 | }; |
| 217 | //TODO-fengtao | 171 | //TODO-fengtao |
| 218 | const schedule = ref('ANY_TIME'); | 172 | const schedule = ref('ANY_TIME'); |
| @@ -62,16 +62,16 @@ | @@ -62,16 +62,16 @@ | ||
| 62 | import { BasicForm, useForm } from '/@/components/Form/index'; | 62 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 63 | import { Icon } from '/@/components/Icon'; | 63 | import { Icon } from '/@/components/Icon'; |
| 64 | import { Tooltip, Card, Select, Input } from 'ant-design-vue'; | 64 | import { Tooltip, Card, Select, Input } from 'ant-design-vue'; |
| 65 | - import { trigger_condition_schema } from '../config/config.data.ts'; | 65 | + import { trigger_condition_schema } from '../config/config.data'; |
| 66 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 66 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; |
| 67 | import ConditionScreening from './ConditionScreening.vue'; | 67 | import ConditionScreening from './ConditionScreening.vue'; |
| 68 | - import { scheduleOptions, timeUnitOptions, options } from '../config/formatData.ts'; | 68 | + import { scheduleOptions, timeUnitOptions, options } from '../config/formatData'; |
| 69 | import AlarmSchedule from './AlarmSchedule.vue'; | 69 | import AlarmSchedule from './AlarmSchedule.vue'; |
| 70 | import { useModal } from '/@/components/Modal'; | 70 | import { useModal } from '/@/components/Modal'; |
| 71 | import { cloneDeep } from 'lodash-es'; | 71 | import { cloneDeep } from 'lodash-es'; |
| 72 | import { useMessage } from '/@/hooks/web/useMessage'; | 72 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 73 | 73 | ||
| 74 | - const props = defineProps({ | 74 | + defineProps({ |
| 75 | title: { | 75 | title: { |
| 76 | type: String, | 76 | type: String, |
| 77 | required: true, | 77 | required: true, |
| @@ -139,23 +139,13 @@ | @@ -139,23 +139,13 @@ | ||
| 139 | }; | 139 | }; |
| 140 | 140 | ||
| 141 | //TODO-fengtao | 141 | //TODO-fengtao |
| 142 | - const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => { | 142 | + const updateFieldDeviceId = (deviceList: any[], _, isUpdate) => { |
| 143 | //用于编辑回显 | 143 | //用于编辑回显 |
| 144 | if (isUpdate.value) { | 144 | if (isUpdate.value) { |
| 145 | updateSchema({ | 145 | updateSchema({ |
| 146 | field: 'entityId', | 146 | field: 'entityId', |
| 147 | componentProps: { | 147 | componentProps: { |
| 148 | options: deviceList, | 148 | options: deviceList, |
| 149 | - onChange(e) { | ||
| 150 | - if (e) { | ||
| 151 | - if (isUpdate.value) { | ||
| 152 | - setFieldsValue({ type2: '' }); | ||
| 153 | - } | ||
| 154 | - //fengtao | ||
| 155 | - updateFieldAttributeFunc(e, orgId.value); | ||
| 156 | - //fengtao | ||
| 157 | - } | ||
| 158 | - }, | ||
| 159 | }, | 149 | }, |
| 160 | }); | 150 | }); |
| 161 | } | 151 | } |
| @@ -168,52 +158,15 @@ | @@ -168,52 +158,15 @@ | ||
| 168 | { label: '部分', value: 'PART' }, | 158 | { label: '部分', value: 'PART' }, |
| 169 | ], | 159 | ], |
| 170 | async onChange(e) { | 160 | async onChange(e) { |
| 171 | - setFieldsValue({ type2: '' }); | ||
| 172 | setFieldsValue({ entityId: [] }); | 161 | setFieldsValue({ entityId: [] }); |
| 173 | - updateSchema({ | ||
| 174 | - field: 'type2', | ||
| 175 | - componentProps: { | ||
| 176 | - options: [], | ||
| 177 | - }, | ||
| 178 | - }); | ||
| 179 | if (e) { | 162 | if (e) { |
| 180 | //fengtao | 163 | //fengtao |
| 181 | if (e == 'ALL') { | 164 | if (e == 'ALL') { |
| 182 | - if (props.provideOrgid || orgId.value) { | ||
| 183 | - const data = await getAttribute(props.provideOrgid || orgId.value, null); | ||
| 184 | - //fengtao | ||
| 185 | - const options = data.map((m) => { | ||
| 186 | - return { | ||
| 187 | - label: m, | ||
| 188 | - value: m, | ||
| 189 | - }; | ||
| 190 | - }); | ||
| 191 | - updateSchema({ | ||
| 192 | - field: 'type2', | ||
| 193 | - componentProps: { | ||
| 194 | - placeholder: '请选择属性', | ||
| 195 | - options, | ||
| 196 | - }, | ||
| 197 | - }); | ||
| 198 | - } | ||
| 199 | } else { | 165 | } else { |
| 200 | - const getT = getFieldsValue(); | ||
| 201 | - const entityId = getT.entityId; | ||
| 202 | - if (entityId !== undefined && entityId.length > 0) { | ||
| 203 | - updateFieldAttributeFunc(entityId, orgId.value); | ||
| 204 | - } | ||
| 205 | updateSchema({ | 166 | updateSchema({ |
| 206 | field: 'entityId', | 167 | field: 'entityId', |
| 207 | componentProps: { | 168 | componentProps: { |
| 208 | options: deviceList, | 169 | options: deviceList, |
| 209 | - onChange(e) { | ||
| 210 | - if (e) { | ||
| 211 | - setFieldsValue({ type2: '' }); | ||
| 212 | - //fengtao | ||
| 213 | - updateFieldAttributeFunc(e, orgId.value); | ||
| 214 | - //fengtao | ||
| 215 | - } | ||
| 216 | - }, | ||
| 217 | }, | 170 | }, |
| 218 | }); | 171 | }); |
| 219 | } | 172 | } |
| @@ -233,29 +186,32 @@ | @@ -233,29 +186,32 @@ | ||
| 233 | setFieldsValue(fieldsValue); | 186 | setFieldsValue(fieldsValue); |
| 234 | }; | 187 | }; |
| 235 | //TODO-fengtao | 188 | //TODO-fengtao |
| 236 | - const updateFieldAttributeFunc = async (deviceId, orgId) => { | ||
| 237 | - //TODO-fengtao | ||
| 238 | - let data; | ||
| 239 | - if (deviceId !== undefined && deviceId.length > 0) { | ||
| 240 | - const joinDeviceIds = deviceId.join(','); | ||
| 241 | - data = await getAttribute(orgId || props.provideOrgid, joinDeviceIds); | 189 | + const updateFieldAttributeFunc = async (e) => { |
| 190 | + const res = await getAttribute(e); | ||
| 191 | + let options: any = []; | ||
| 192 | + if (Array.isArray(res)) { | ||
| 193 | + options = res.map((m) => { | ||
| 194 | + return { | ||
| 195 | + label: m?.identifier, | ||
| 196 | + value: m?.identifier, | ||
| 197 | + }; | ||
| 198 | + }); | ||
| 199 | + updateSchema({ | ||
| 200 | + field: 'type2', | ||
| 201 | + componentProps: { | ||
| 202 | + placeholder: '请选择属性', | ||
| 203 | + options, | ||
| 204 | + }, | ||
| 205 | + }); | ||
| 242 | } else { | 206 | } else { |
| 243 | - data = await getAttribute(orgId || props.provideOrgid, null); | 207 | + updateSchema({ |
| 208 | + field: 'type2', | ||
| 209 | + componentProps: { | ||
| 210 | + placeholder: '请选择属性', | ||
| 211 | + options, | ||
| 212 | + }, | ||
| 213 | + }); | ||
| 244 | } | 214 | } |
| 245 | - //TODO-fengtao | ||
| 246 | - const options = data.map((m) => { | ||
| 247 | - return { | ||
| 248 | - label: m, | ||
| 249 | - value: m, | ||
| 250 | - }; | ||
| 251 | - }); | ||
| 252 | - updateSchema({ | ||
| 253 | - field: 'type2', | ||
| 254 | - componentProps: { | ||
| 255 | - placeholder: '请选择属性', | ||
| 256 | - options: options, | ||
| 257 | - }, | ||
| 258 | - }); | ||
| 259 | }; | 215 | }; |
| 260 | //TODO-fengtao | 216 | //TODO-fengtao |
| 261 | const handleDelete = (params: { index: number; title: string }) => { | 217 | const handleDelete = (params: { index: number; title: string }) => { |
| @@ -170,11 +170,10 @@ | @@ -170,11 +170,10 @@ | ||
| 170 | const changeOutTarget = () => { | 170 | const changeOutTarget = () => { |
| 171 | emit('getActionFormArr'); | 171 | emit('getActionFormArr'); |
| 172 | }; | 172 | }; |
| 173 | - const [registerAction, { getFieldsValue, resetFields, updateSchema, setFieldsValue, validate }] = | ||
| 174 | - useForm({ | ||
| 175 | - schemas: actionSchema, | ||
| 176 | - showActionButtonGroup: false, | ||
| 177 | - }); | 173 | + const [registerAction, { getFieldsValue, resetFields, setFieldsValue, validate }] = useForm({ |
| 174 | + schemas: actionSchema, | ||
| 175 | + showActionButtonGroup: false, | ||
| 176 | + }); | ||
| 178 | 177 | ||
| 179 | // 获取整个执行动作表单值 | 178 | // 获取整个执行动作表单值 |
| 180 | const getFieldsValueFunc = () => { | 179 | const getFieldsValueFunc = () => { |
| @@ -274,26 +273,14 @@ | @@ -274,26 +273,14 @@ | ||
| 274 | const isUpdateItem = ref(''); | 273 | const isUpdateItem = ref(''); |
| 275 | const deviceListItem = ref([]); | 274 | const deviceListItem = ref([]); |
| 276 | 275 | ||
| 277 | - //TODO-fengtao | ||
| 278 | - const updateFieldDeviceId = (deviceList, orgId, isUpdate, getMasterDeviceList) => { | 276 | + //update 2022-11-28 |
| 277 | + const updateFieldDeviceId = (deviceList, orgId, isUpdate) => { | ||
| 279 | if (isUpdate.value) { | 278 | if (isUpdate.value) { |
| 280 | orgIdItem.value = orgId.value; | 279 | orgIdItem.value = orgId.value; |
| 281 | } | 280 | } |
| 282 | orgIdItem.value = orgId.value; | 281 | orgIdItem.value = orgId.value; |
| 283 | isUpdateItem.value = isUpdate.value; | 282 | isUpdateItem.value = isUpdate.value; |
| 284 | - const options = getMasterDeviceList.value.map((m) => { | ||
| 285 | - return { | ||
| 286 | - value: m.id, | ||
| 287 | - label: m.name, | ||
| 288 | - }; | ||
| 289 | - }); | ||
| 290 | deviceListItem.value = deviceList.value; | 283 | deviceListItem.value = deviceList.value; |
| 291 | - updateSchema({ | ||
| 292 | - field: 'deviceId', | ||
| 293 | - componentProps: { | ||
| 294 | - options, | ||
| 295 | - }, | ||
| 296 | - }); | ||
| 297 | }; | 284 | }; |
| 298 | //FT add 2022-10-27 | 285 | //FT add 2022-10-27 |
| 299 | const updateEditFieldAlarmConfig = (alarmConfigList) => { | 286 | const updateEditFieldAlarmConfig = (alarmConfigList) => { |
| @@ -125,6 +125,7 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -125,6 +125,7 @@ export const tenantFormSchema: FormSchema[] = [ | ||
| 125 | label: '租户配置', | 125 | label: '租户配置', |
| 126 | component: 'ApiSelect', | 126 | component: 'ApiSelect', |
| 127 | required: true, | 127 | required: true, |
| 128 | + defaultValue: 'Default', | ||
| 128 | componentProps: { | 129 | componentProps: { |
| 129 | api: selectTenantProfileApi, | 130 | api: selectTenantProfileApi, |
| 130 | showSearch: true, | 131 | showSearch: true, |