fix: 修改调试
This commit is contained in:
parent
75098a4388
commit
a8c1bfb0ff
|
@ -33,7 +33,7 @@
|
|||
:options="options"
|
||||
v-model:value="record.id"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
style="width: 100%; z-index: 1400 !important"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'current'">
|
||||
|
@ -75,7 +75,7 @@
|
|||
<div>运行结果</div>
|
||||
</div>
|
||||
<div class="action">
|
||||
<div>
|
||||
<div v-if="virtualRule?.script">
|
||||
<a v-if="isBeginning" @click="beginAction">
|
||||
开始运行
|
||||
</a>
|
||||
|
@ -116,6 +116,7 @@ const props = defineProps({
|
|||
virtualRule: Object as PropType<Record<any, any>>,
|
||||
id: String,
|
||||
});
|
||||
const emits = defineEmits(['success'])
|
||||
|
||||
const isBeginning = ref(true);
|
||||
|
||||
|
@ -195,6 +196,7 @@ const runScript = () => {
|
|||
time: new Date().getTime(),
|
||||
content: JSON.stringify(data.payload),
|
||||
});
|
||||
emits('success', false)
|
||||
if (props.virtualRule?.type !== 'window') {
|
||||
stopAction();
|
||||
}
|
||||
|
@ -249,14 +251,15 @@ onUnmounted(() => {
|
|||
clearAction();
|
||||
});
|
||||
|
||||
const options = ref<{ label: string; value: string }[]>();
|
||||
const options = ref<{ text: string; value: string }[]>([]);
|
||||
|
||||
const getProperty = () => {
|
||||
const metadata = productStore.current.metadata || '{}';
|
||||
const _p: PropertyMetadata[] = JSON.parse(metadata).properties || [];
|
||||
options.value = _p
|
||||
.filter((p) => p.id !== props.id)
|
||||
.map((item) => ({
|
||||
label: item.name,
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
};
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<template>
|
||||
<j-modal
|
||||
:zIndex="1200"
|
||||
:zIndex="1030"
|
||||
:mask-closable="false"
|
||||
visible
|
||||
width="70vw"
|
||||
title="编辑规则"
|
||||
@cancel="handleCancel"
|
||||
@ok="handleOk"
|
||||
>
|
||||
<div class="header" v-if="virtualRule?.windowType && virtualRule?.windowType !== 'undefined'">
|
||||
<div class="header-item">
|
||||
|
@ -41,9 +40,16 @@
|
|||
script: _value,
|
||||
}"
|
||||
:id="id"
|
||||
@success="onSuccess"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<j-space>
|
||||
<j-button @click="handleCancel">取消</j-button>
|
||||
<j-button :disabled="_disabled" @click="handleOk" type="primary">确定</j-button>
|
||||
</j-space>
|
||||
</template>
|
||||
</j-modal>
|
||||
</template>
|
||||
<script setup lang="ts" name="FRuleEditor">
|
||||
|
@ -65,10 +71,12 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const _value = ref<string | undefined>(props.value);
|
||||
const _disabled = ref<boolean>(true);
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('close');
|
||||
};
|
||||
|
||||
const handleOk = () => {
|
||||
emit('save', _value.value);
|
||||
};
|
||||
|
@ -82,9 +90,20 @@ const aggType = computed(() => {
|
|||
|
||||
const editor = ref();
|
||||
const addOperatorValue = (val: string) => {
|
||||
console.log(val)
|
||||
editor.value.addOperatorValue(val);
|
||||
};
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(props.value, _value.value, 'hhhhh')
|
||||
})
|
||||
|
||||
watch(() => _value.value, () => {
|
||||
_disabled.value = true
|
||||
})
|
||||
|
||||
const onSuccess = (bool: boolean) => {
|
||||
_disabled.value = bool;
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.header {
|
||||
|
|
|
@ -134,6 +134,9 @@ export const postStream = function(url: string, data = {}, params = {}) {
|
|||
const showNotification = (message: string, description: string, key?: string, show: boolean = true) => {
|
||||
if (show) {
|
||||
Notification.error({
|
||||
style: {
|
||||
zIndex: 1040
|
||||
},
|
||||
key,
|
||||
message: '',
|
||||
description
|
||||
|
|
|
@ -43,7 +43,9 @@ export const initWebSocket = () => {
|
|||
const data = JSON.parse(msg.data)
|
||||
|
||||
if (data.type === 'error') {
|
||||
notification.error({ key: 'wserr', message: data.message })
|
||||
notification.error({ key: 'wserr', message: data.message, style: {
|
||||
zIndex: 1040
|
||||
} })
|
||||
}
|
||||
|
||||
if (subs[data.requestId]) {
|
||||
|
|
|
@ -97,12 +97,16 @@ const getLevel = () => {
|
|||
if (resp.status === 200) levelList.value = resp.result.levels;
|
||||
});
|
||||
};
|
||||
getLevel();
|
||||
const getLevelLabel = (id: number) => {
|
||||
if (levelList.value.length < 1 || !id) return '';
|
||||
const obj = levelList.value.find((item) => item.level === id);
|
||||
return obj?.title;
|
||||
};
|
||||
onMounted(() => {
|
||||
if(!['device-transparent-codec', 'system-event'].includes(props?.data?.topicProvider)){
|
||||
getLevel();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -131,7 +131,6 @@ const confirm = async () => {
|
|||
reject();
|
||||
});
|
||||
if (data) {
|
||||
console.log(data)
|
||||
updateValue({
|
||||
source: myValue.value,
|
||||
...data
|
||||
|
|
|
@ -29,6 +29,10 @@ const onChange = (val: string | undefined) => {
|
|||
onClose()
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(props.virtualRule, props.value, '123')
|
||||
})
|
||||
|
||||
const onClose = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
>
|
||||
<Rule
|
||||
v-model:value="formData.virtualRule.rule.script"
|
||||
:virtualRule="formData.virtualRule.rule"
|
||||
:virtualRule="_virtualRule.virtualRule.rule"
|
||||
:id="value.id"
|
||||
:aggList="aggList"
|
||||
/>
|
||||
|
@ -310,6 +310,24 @@ watch(
|
|||
},
|
||||
);
|
||||
|
||||
const _virtualRule = computed(() => {
|
||||
const flag = formData?.virtualRule?.rule?.windowType !== 'undefined';
|
||||
return {
|
||||
type: formData?.type,
|
||||
virtualRule: {
|
||||
type: flag ? 'window' : 'script',
|
||||
rule: {
|
||||
...formData?.virtualRule?.rule,
|
||||
isVirtualRule: flag,
|
||||
type: flag ? 'window' : 'script',
|
||||
},
|
||||
triggerProperties: formData?.virtualRule?.triggerProperties.includes('*')
|
||||
? []
|
||||
: formData?.virtualRule?.triggerProperties,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const onSave = () => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const data = await formRef.value!.validate().catch(() => {
|
||||
|
@ -317,22 +335,7 @@ const onSave = () => {
|
|||
});
|
||||
if (data) {
|
||||
if (data.virtualRule) {
|
||||
const flag = data.virtualRule.rule.windowType !== 'undefined'
|
||||
resolve({
|
||||
type: data.type,
|
||||
virtualRule: {
|
||||
type: flag ? 'window' : 'script',
|
||||
rule: {
|
||||
...data.virtualRule.rule,
|
||||
isVirtualRule: flag,
|
||||
type: flag ? 'window' : 'script',
|
||||
},
|
||||
triggerProperties:
|
||||
data.virtualRule?.triggerProperties.includes('*')
|
||||
? []
|
||||
: data.virtualRule?.triggerProperties,
|
||||
},
|
||||
});
|
||||
resolve(_virtualRule.value);
|
||||
} else {
|
||||
resolve({
|
||||
type: data.type,
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
collapsible="header"
|
||||
>
|
||||
<j-collapse-panel
|
||||
:key="cluster.id"
|
||||
:key="(cluster.serverId || '') + index"
|
||||
:show-arrow="!formData.shareCluster"
|
||||
>
|
||||
<template #header v-if="!shareCluster">
|
||||
|
|
Loading…
Reference in New Issue