fix: bug#13455

* fix: 修复license页面无法访问问题

* fix: 优化设备批量启动请求参数处理

* fix: 优化license页面

* fix: 优化场景联动-执行动作删除校验

* fix: bug#13455
This commit is contained in:
XieYongHong 2023-05-09 09:55:09 +08:00 committed by GitHub
parent 4392dda0c2
commit 32279a81e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 46 deletions

View File

@ -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: [

View File

@ -596,6 +596,7 @@ const handleParams = (config: Record<string, any>) => {
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;
};

View File

@ -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, check)
}
sub.value = EventEmitter.subscribe(_key, checkPrevData)
}
watch(() => props.name, (newName, oldName) => {
// subscribe(newName, oldName || 0)
}, { immediate: true })
subscribe()
check()

View File

@ -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

View File

@ -5,9 +5,9 @@
<div>
<j-descriptions bordered :column="4">
<j-descriptions-item label="Host" :span="4">
{{ info?.host }}
{{ infoData?.host }}
</j-descriptions-item>
<template v-for="i in info?.modules" :key="i">
<template v-for="i in infoData?.modules" :key="i">
<j-descriptions-item label="IP" :span="2">
{{ i.ip }}
</j-descriptions-item>
@ -43,7 +43,7 @@
<script lang="ts" setup>
const props = defineProps({
data: {
infoData: {
type: Object,
default: {},
},
@ -52,16 +52,8 @@ const props = defineProps({
default: '',
},
});
let info = ref();
let license = ref();
watch(
() => {
props.data;
},
() => {
info.value = props.data;
},
);
watch(
() => props.licenseData,
() => {

View File

@ -92,7 +92,7 @@ export default defineConfig(({ mode}) => {
proxy: {
[env.VITE_APP_BASE_API]: {
// target: 'http://192.168.32.70:8844',
// target: 'http://192.168.32.226:8844',
// target: 'http://192.168.32.244:8881',
target: 'http://120.77.179.54:8844', // 120测试
// target: 'http://192.168.33.46:8844', // 本地开发环境