diff --git a/build.sh b/build.sh index bf6d3418..818598a0 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1 . -docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1 +docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1.0-SNAPSHOT . +docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1.0-SNAPSHOT diff --git a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue index 1480064b..a3047b19 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue @@ -84,7 +84,7 @@ @@ -46,4 +46,13 @@ const saveBtn = () => { instanceStore.refresh(instanceStore.current.id); } }; + +const findName = (item: any) => { + let name = undefined + if (item.dataType) { + const _element = item.dataType.elements?.find((a: any) => a.value === item.value) + name = _element?.text + } + return name +} diff --git a/src/views/device/Product/Detail/DeviceAccess/index.vue b/src/views/device/Product/Detail/DeviceAccess/index.vue index 6f4ebf47..99762247 100644 --- a/src/views/device/Product/Detail/DeviceAccess/index.vue +++ b/src/views/device/Product/Detail/DeviceAccess/index.vue @@ -523,6 +523,9 @@ const queryAccessDetail = async (id: string) => { }).then((res: any) => { if (res.status === 200) { access.value = res.result.data[0]; + if (access.value?.transportDetail?.metadata) { + productData.metadata = JSON.parse(access.value?.transportDetail?.metadata) + } } }); }; diff --git a/src/views/home/components/ComprehensiveHome/index.vue b/src/views/home/components/ComprehensiveHome/index.vue index 9084ccc1..0cf23b9c 100644 --- a/src/views/home/components/ComprehensiveHome/index.vue +++ b/src/views/home/components/ComprehensiveHome/index.vue @@ -14,7 +14,7 @@ - + diff --git a/src/views/home/components/PlatformPicCard.vue b/src/views/home/components/PlatformPicCard.vue index 4d59b4e4..085a764e 100644 --- a/src/views/home/components/PlatformPicCard.vue +++ b/src/views/home/components/PlatformPicCard.vue @@ -45,7 +45,7 @@ const props = defineProps({ width: 100%; height: calc(100% - 50px); margin-top: 40px; - background-size: contain; + background-size: 95%; background-position: center; background-repeat: no-repeat; } diff --git a/src/views/oauth/index.vue b/src/views/oauth/index.vue index 6fc36ac6..53b71bb6 100644 --- a/src/views/oauth/index.vue +++ b/src/views/oauth/index.vue @@ -154,8 +154,8 @@ const getLoginUser = async (data?: any) => { if (res.success) { userName.value = res.result?.user.name isLogin.value = true - getApplication(data.client_id || params.value.client_id) - if (data.internal === 'true' || internal.value === 'true') { // 是否走oauth2 + getApplication(data?.client_id || params.value.client_id) + if (data?.internal === 'true' || internal.value === 'true') { // 是否走oauth2 goOAuth2Fn(data) } } else if (res.status === 401) { @@ -163,14 +163,14 @@ const getLoginUser = async (data?: any) => { spinning.value = false }) getCode() - getApplication(data.client_id || params.value.client_id) + getApplication(data?.client_id || params.value.client_id) } else { setTimeout(() => { spinning.value = false }) } } else { - getApplication(data.client_id || params.value.client_id) + getApplication(data?.client_id || params.value.client_id) setTimeout(() => { spinning.value = false }) diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue b/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue index 2ea815b5..981c7909 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue @@ -11,6 +11,7 @@ import { query as deviceQuery } from '@/api/device/instance' import noticeConfig from '@/api/notice/config' import noticeTemplate from '@/api/notice/template' import { Form } from 'jetlinks-ui-components' +import { EventEmitter, EventSubscribeKeys } from '@/views/rule-engine/Scene/Save/util' const sceneStore = useSceneStore(); const { data: _data } = storeToRefs(sceneStore); @@ -31,6 +32,8 @@ const props = defineProps({ }, }); +const sub = ref() + const rules = [{ validator(_: any, v?: ActionsType) { console.log('validator',v) @@ -62,7 +65,6 @@ const checkDeviceDelete = async () => { return } if (item?.selector === 'fixed') { - console.log(item) const deviceList = item!.selectorValues?.map(item => item.value) || [] const deviceResp = await deviceQuery({ terms: [{ terms: [{ column: 'id', termType: 'in', value: deviceList.toString() }]}]}) if (deviceResp.success && (deviceResp.result as any)?.total < (item!.selectorValues?.length || 0)) { // 某一个设备被删除 @@ -71,6 +73,19 @@ const checkDeviceDelete = async () => { return } } + + if (item!.source === 'upper') { // 如果是按变量,校验上一个设备输出的产品id + if (props.name === 0) { + formTouchOff() + return + } else { + const prevItem = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name - 1].device + if (prevItem?.productId !== item?.productId) { + formTouchOff() + return + } + } + } } /** @@ -92,14 +107,52 @@ const checkNoticeDelete = async () => { } } -nextTick(() => { +const check = () => { const _executor = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.executor - if (_executor === 'device' && _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.device) { + if (_executor === 'device' && _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.device) { // 设备输出,并且有值 checkDeviceDelete() } else if (_executor === 'notify' && _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.notify) { - checkNoticeDelete + checkNoticeDelete() } -}) +} + +const checkPrevData = (data: any) => { + console.log(data) + const _executor = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.executor + if (_executor === 'device' && _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.device) { // 设备输出,并且有值 + // 校验内置参数 + // 按变量时,需校验产品id是否一致 + + } else if (_executor === 'notify' && _data.value.branches![props.branchesName].then[props.thenName].actions[props.name]?.notify) { + // 校验内置参数 + } +} + +const subscribe = (newName: number, oldName: number) => { + const _key = EventSubscribeKeys({ + branch: props.branchesName, + branchGroup: props.thenName, + action: props.name - 1 + }) + + if (sub.value) { + const oldKey = EventSubscribeKeys({ + branch: props.branchesName, + branchGroup: props.thenName, + action: oldName - 1 + }) + + sub.value.unSubscribe(oldKey, checkPrevData) + } + + sub.value = EventEmitter.subscribe(_key, checkPrevData) +} + +watch(() => props.name, (newName, oldName) => { + // subscribe(newName, oldName || 0) +}, { immediate: true }) + +check() diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue b/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue index 133e2256..f3464456 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue @@ -445,11 +445,11 @@ const emit = defineEmits(['delete', 'update']); const visible = ref(false); const triggerVisible = ref(false); const actionType = ref(''); -const eventEmitterKey = EventEmitterKeys({ +const eventEmitterKey = ref(EventEmitterKeys({ branch: props.branchesName, branchGroup: props.thenName, action: props.name -}) +})) const formItemContext = Form.useInjectFormItemContext() const termsOptions = computed(() => { if (!props.parallel) { @@ -464,7 +464,7 @@ const termsOptions = computed(() => { const onDelete = () => { const key = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name].key - EventEmitter.emit(key!, { isDelete: true }) + EventEmitter.emit(key!, { isDelete: true }) // 发布消息 if (props.name !== 0 && !props.parallel) { // 清空上一个串行执行动作中的options.termsColumns和terms _data.value.branches![props.branchesName].then[props.thenName].actions[props.name - 1].options!.termsColumns = [] _data.value.branches![props.branchesName].then[props.thenName].actions[props.name - 1].options!.terms = [] @@ -524,7 +524,6 @@ const onType = (_type: string) => { */ const onSave = (data: ActionsType, options: any) => { const { key, terms } = _data.value.branches![props.branchesName].then?.[props.thenName].actions?.[props.name] - console.log({...props.options, ...options}) const columns = new Set([...(props.options?.termsColumns || []), ...(options.otherColumns.filter((item?: string) => item))]) @@ -535,14 +534,11 @@ const onSave = (data: ActionsType, options: any) => { terms } - console.log(actionItem) _data.value.branches![props.branchesName].then[props.thenName].actions.splice(props.name, 1, actionItem) visible.value = false; - if (props.parallel === false) { // 串行 - EventEmitter.emit(eventEmitterKey, data) - } + EventEmitter.emit(eventEmitterKey.value, data) // 发布消息 }; /** diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/List.vue b/src/views/rule-engine/Scene/Save/action/ListItem/List.vue index 923d1cdc..c923dba6 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/List.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/List.vue @@ -84,7 +84,7 @@ const onSave = (data: any, options?: any) => { key: data.key, options: { ...options, - columns: options.otherColumns.filter((item?: string) => item) + columns: options.otherColumns?.filter((item?: string) => item) || [] }, }; emit('add', item) diff --git a/src/views/rule-engine/Scene/Save/action/Notify/variableItem/User.vue b/src/views/rule-engine/Scene/Save/action/Notify/variableItem/User.vue index d2bc13b6..27b809b2 100644 --- a/src/views/rule-engine/Scene/Save/action/Notify/variableItem/User.vue +++ b/src/views/rule-engine/Scene/Save/action/Notify/variableItem/User.vue @@ -344,7 +344,7 @@ const onChange = ( } } else { const item = treeDataMap.get(_value) - const _isRelation = item.isRelation + const _isRelation = item?.isRelation _values = getObj(_source, _value, _isRelation); } emit('update:value', _values); diff --git a/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue b/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue index a4e76bda..0b2c811d 100644 --- a/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue +++ b/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue @@ -1,6 +1,6 @@