diff --git a/src/views/device/Instance/Detail/components/MSelect.vue b/src/views/device/Instance/Detail/components/MSelect.vue index 046d262a..2f5beda3 100644 --- a/src/views/device/Instance/Detail/components/MSelect.vue +++ b/src/views/device/Instance/Detail/components/MSelect.vue @@ -57,6 +57,7 @@ const getCollector = async (_val: string) => { return []; } else { const resp = await queryCollectorNoPaging({ + paging: false, terms: [ { terms: [ @@ -79,6 +80,7 @@ const getPoint = async (_val: string) => { return []; } else { const resp = await queryPointNoPaging({ + paging: false, terms: [ { terms: [ diff --git a/src/views/device/Instance/index.vue b/src/views/device/Instance/index.vue index 72789cfe..62e2e6c9 100644 --- a/src/views/device/Instance/index.vue +++ b/src/views/device/Instance/index.vue @@ -596,6 +596,7 @@ const handleParams = (config: Record) => { if (Object.keys(_terms).length) { const url = new URLSearchParams(); Object.keys(_terms).forEach((key) => { + console.log(_terms[key]) url.append(key, _terms[key]); }); return url.toString(); @@ -729,11 +730,24 @@ const onCheckChange = () => { _selectedRowKeys.value = []; }; +const handleGetParams = (p: any) => { + p?.terms.map((a: any) => { + return a.terms.map((b: any) => { + if (b.column.includes('$product-info')) { + b.column = 'productId' + b.termType = 'product-info' + } + return b + }) + }) + return p +} + const activeAllDevice = () => { type.value = 'active'; const activeAPI = `${BASE_API_PATH}/device-instance/deploy?:X_Access_Token=${LocalStore.get( TOKEN_KEY, - )}&${handleParams(params.value)}`; + )}&${handleParams(handleGetParams(params.value))}`; api.value = activeAPI; operationVisible.value = true; }; 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 981c7909..0c4d836d 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue @@ -36,11 +36,11 @@ const sub = ref() const rules = [{ validator(_: any, v?: ActionsType) { - console.log('validator',v) if (v?.executor === 'device') { if( !v.device?.productId || // 产品已删除 - !v.device?.selectorValues // 设备已删除 + !v.device?.selectorValues || // 设备已删除 + (v.device.source === 'upper' && !v.device?.upperKey) ) { return Promise.reject(new Error('该数据已发生变更,请重新配置')) } @@ -73,14 +73,16 @@ const checkDeviceDelete = async () => { return } } - + console.log(item!.source, props.name) if (item!.source === 'upper') { // 如果是按变量,校验上一个设备输出的产品id if (props.name === 0) { + _data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.upperKey = undefined formTouchOff() return } else { const prevItem = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name - 1].device if (prevItem?.productId !== item?.productId) { + _data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.upperKey = undefined formTouchOff() return } @@ -116,41 +118,18 @@ const check = () => { } } -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 subscribe = () => { + // 订阅上一个action const _key = EventSubscribeKeys({ branch: props.branchesName, branchGroup: props.thenName, - action: props.name - 1 + action: props.name }) - 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) + sub.value = EventEmitter.subscribe(_key, check) } -watch(() => props.name, (newName, oldName) => { - // subscribe(newName, oldName || 0) -}, { immediate: true }) +subscribe() check() diff --git a/src/views/rule-engine/Scene/Save/util.ts b/src/views/rule-engine/Scene/Save/util.ts index c35fb190..e213d944 100644 --- a/src/views/rule-engine/Scene/Save/util.ts +++ b/src/views/rule-engine/Scene/Save/util.ts @@ -76,7 +76,7 @@ export const EventSubscribeKeys = (params: Params): string[] => { keys.push(DeviceEmitterKey) } - for (let i = 0; i <= params.action; i++) { + for (let i = 0; i <= params.action - 1; i++) { let key = sceneStore.data.branches?.[params.branch].then[params.branchGroup].actions[i]?.key if (!key) { const _b = `branches_${params.branch}` // branchesName diff --git a/src/views/system/License/component/Card.vue b/src/views/system/License/component/Card.vue index 96c9abbb..6c73391c 100644 --- a/src/views/system/License/component/Card.vue +++ b/src/views/system/License/component/Card.vue @@ -5,9 +5,9 @@
- {{ info?.host }} + {{ infoData?.host }} -