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 []; return [];
} else { } else {
const resp = await queryCollectorNoPaging({ const resp = await queryCollectorNoPaging({
paging: false,
terms: [ terms: [
{ {
terms: [ terms: [
@ -79,6 +80,7 @@ const getPoint = async (_val: string) => {
return []; return [];
} else { } else {
const resp = await queryPointNoPaging({ const resp = await queryPointNoPaging({
paging: false,
terms: [ terms: [
{ {
terms: [ terms: [

View File

@ -596,6 +596,7 @@ const handleParams = (config: Record<string, any>) => {
if (Object.keys(_terms).length) { if (Object.keys(_terms).length) {
const url = new URLSearchParams(); const url = new URLSearchParams();
Object.keys(_terms).forEach((key) => { Object.keys(_terms).forEach((key) => {
console.log(_terms[key])
url.append(key, _terms[key]); url.append(key, _terms[key]);
}); });
return url.toString(); return url.toString();
@ -729,11 +730,24 @@ const onCheckChange = () => {
_selectedRowKeys.value = []; _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 = () => { const activeAllDevice = () => {
type.value = 'active'; type.value = 'active';
const activeAPI = `${BASE_API_PATH}/device-instance/deploy?:X_Access_Token=${LocalStore.get( const activeAPI = `${BASE_API_PATH}/device-instance/deploy?:X_Access_Token=${LocalStore.get(
TOKEN_KEY, TOKEN_KEY,
)}&${handleParams(params.value)}`; )}&${handleParams(handleGetParams(params.value))}`;
api.value = activeAPI; api.value = activeAPI;
operationVisible.value = true; operationVisible.value = true;
}; };

View File

@ -36,11 +36,11 @@ const sub = ref()
const rules = [{ const rules = [{
validator(_: any, v?: ActionsType) { validator(_: any, v?: ActionsType) {
console.log('validator',v)
if (v?.executor === 'device') { if (v?.executor === 'device') {
if( if(
!v.device?.productId || // !v.device?.productId || //
!v.device?.selectorValues // !v.device?.selectorValues || //
(v.device.source === 'upper' && !v.device?.upperKey)
) { ) {
return Promise.reject(new Error('该数据已发生变更,请重新配置')) return Promise.reject(new Error('该数据已发生变更,请重新配置'))
} }
@ -73,14 +73,16 @@ const checkDeviceDelete = async () => {
return return
} }
} }
console.log(item!.source, props.name)
if (item!.source === 'upper') { // id if (item!.source === 'upper') { // id
if (props.name === 0) { if (props.name === 0) {
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.upperKey = undefined
formTouchOff() formTouchOff()
return return
} else { } else {
const prevItem = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name - 1].device const prevItem = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name - 1].device
if (prevItem?.productId !== item?.productId) { if (prevItem?.productId !== item?.productId) {
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.upperKey = undefined
formTouchOff() formTouchOff()
return return
} }
@ -116,41 +118,18 @@ const check = () => {
} }
} }
const checkPrevData = (data: any) => { const subscribe = () => {
console.log(data) // action
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({ const _key = EventSubscribeKeys({
branch: props.branchesName, branch: props.branchesName,
branchGroup: props.thenName, branchGroup: props.thenName,
action: props.name - 1 action: props.name
}) })
if (sub.value) { sub.value = EventEmitter.subscribe(_key, check)
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()
// subscribe(newName, oldName || 0)
}, { immediate: true })
check() check()

View File

@ -76,7 +76,7 @@ export const EventSubscribeKeys = (params: Params): string[] => {
keys.push(DeviceEmitterKey) 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 let key = sceneStore.data.branches?.[params.branch].then[params.branchGroup].actions[i]?.key
if (!key) { if (!key) {
const _b = `branches_${params.branch}` // branchesName const _b = `branches_${params.branch}` // branchesName

View File

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

View File

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