Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
eb96f5afe4
|
@ -9,13 +9,6 @@
|
|||
请对上方规则使用的属性进行赋值
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="!isBeginning && virtualRule?.type === 'window'"
|
||||
class="action"
|
||||
@click="runScriptAgain"
|
||||
>
|
||||
<a style="margin-left: 75px">发送数据</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-bottom">
|
||||
|
@ -74,9 +67,18 @@
|
|||
<div class="header">
|
||||
<div class="title">
|
||||
<div>运行结果</div>
|
||||
<div v-if="virtualRule?.script && !isBeginning">正在运行......</div>
|
||||
<div v-if="virtualRule?.script && !isBeginning">
|
||||
正在运行......
|
||||
</div>
|
||||
</div>
|
||||
<div class="action">
|
||||
<div
|
||||
v-if="!isBeginning && virtualRule?.type === 'window'"
|
||||
class="action"
|
||||
@click="runScriptAgain"
|
||||
>
|
||||
<a style="margin-left: 75px">发送数据</a>
|
||||
</div>
|
||||
<div v-if="virtualRule?.script">
|
||||
<a v-if="isBeginning" @click="beginAction">
|
||||
开始运行
|
||||
|
@ -91,11 +93,21 @@
|
|||
<div class="log">
|
||||
<j-descriptions>
|
||||
<j-descriptions-item
|
||||
v-for="item in ruleEditorStore.state.log"
|
||||
:label="moment(item.time).format('HH:mm:ss')"
|
||||
v-for="(item, index) in ruleEditorStore.state.log"
|
||||
:key="item.time"
|
||||
:span="3"
|
||||
>
|
||||
<template #label>
|
||||
<template v-if="!!runningState(index + 1, item._time)">
|
||||
{{ runningState(index + 1, item._time) }}
|
||||
</template>
|
||||
<template v-else>{{
|
||||
moment(item.time).format('HH:mm:ss')
|
||||
}}</template>
|
||||
</template>
|
||||
<div v-if="!!runningState(index + 1, item._time)">
|
||||
{{ moment(item.time).format('HH:mm:ss') }}
|
||||
</div>
|
||||
<j-tooltip placement="top" :title="item.content">
|
||||
{{ item.content }}
|
||||
</j-tooltip>
|
||||
|
@ -118,7 +130,7 @@ const props = defineProps({
|
|||
virtualRule: Object as PropType<Record<any, any>>,
|
||||
id: String,
|
||||
});
|
||||
const emits = defineEmits(['success'])
|
||||
const emits = defineEmits(['success']);
|
||||
|
||||
const isBeginning = ref(true);
|
||||
|
||||
|
@ -128,7 +140,6 @@ type propertyType = {
|
|||
last?: string;
|
||||
};
|
||||
const property = ref<propertyType[]>([]);
|
||||
// virtualRule?.rule?.windowType === 'undefined' ? moment(item.time).format('HH:mm:ss')
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -163,9 +174,13 @@ const deleteItem = (index: number) => {
|
|||
const ws = ref();
|
||||
|
||||
const virtualIdRef = ref(new Date().getTime());
|
||||
const medataSource = inject<Ref<any[]>>('_dataSource')
|
||||
const medataSource = inject<Ref<any[]>>('_dataSource');
|
||||
const productStore = useProductStore();
|
||||
const ruleEditorStore = useRuleEditorStore();
|
||||
|
||||
const time = ref<number>(0);
|
||||
const timer = ref<any>(null);
|
||||
|
||||
const runScript = () => {
|
||||
const metadata = productStore.current.metadata || '{}';
|
||||
const propertiesList = JSON.parse(metadata).properties || [];
|
||||
|
@ -198,14 +213,25 @@ const runScript = () => {
|
|||
ruleEditorStore.state.log.push({
|
||||
time: new Date().getTime(),
|
||||
content: JSON.stringify(data.payload),
|
||||
_time: unref(time.value)
|
||||
});
|
||||
emits('success', false)
|
||||
emits('success', false);
|
||||
if (props.virtualRule?.type !== 'window') {
|
||||
stopAction();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const runningState = (_index: number, _time: number) => {
|
||||
if (props.virtualRule?.windowType === 'time') {
|
||||
return `已运行${_time}秒`;
|
||||
}
|
||||
if (props.virtualRule?.windowType === 'num') {
|
||||
return `第${_index}次运行`;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const wsAgain = ref<any>();
|
||||
const runScriptAgain = async () => {
|
||||
if (wsAgain.value) {
|
||||
|
@ -233,15 +259,24 @@ const runScriptAgain = async () => {
|
|||
wsAgain.value.subscribe((data: any) => {});
|
||||
};
|
||||
|
||||
const getTime = () => {
|
||||
time.value = 0;
|
||||
timer.value = setInterval(() => {
|
||||
time.value += 1;
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const beginAction = () => {
|
||||
isBeginning.value = false;
|
||||
runScript();
|
||||
getTime();
|
||||
};
|
||||
const stopAction = () => {
|
||||
isBeginning.value = true;
|
||||
if (ws.value) {
|
||||
ws.value.unsubscribe?.();
|
||||
}
|
||||
timer.value = null
|
||||
};
|
||||
const clearAction = () => {
|
||||
ruleEditorStore.set('log', []);
|
||||
|
@ -252,6 +287,7 @@ onUnmounted(() => {
|
|||
ws.value.unsubscribe?.();
|
||||
}
|
||||
clearAction();
|
||||
timer.value = null
|
||||
});
|
||||
|
||||
const options = computed(() => {
|
||||
|
@ -261,7 +297,7 @@ const options = computed(() => {
|
|||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
})
|
||||
});
|
||||
|
||||
// const getProperty = () => {
|
||||
// // const metadata = productStore.current.metadata || '{}';
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
width="70vw"
|
||||
title="编辑规则"
|
||||
@cancel="handleCancel"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<div class="header" v-if="virtualRule?.windowType && virtualRule?.windowType !== 'undefined'">
|
||||
<div class="header-item">
|
||||
|
|
|
@ -7,6 +7,7 @@ type RuleEditorType = {
|
|||
log: {
|
||||
content: string;
|
||||
time: number;
|
||||
_time: number;
|
||||
}[];
|
||||
};
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ const getProvidersList = async () => {
|
|||
arr.includes(item.alias),
|
||||
);
|
||||
providersList.value = providers;
|
||||
if (arr.includes('OPC_UA')) {
|
||||
if (arr.includes('opc-ua')) {
|
||||
getOptionsList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
</template>
|
||||
<template #shareCluster="slotProps">
|
||||
{{
|
||||
slotProps.shareCluster === 'true'
|
||||
slotProps.shareCluster === true
|
||||
? '共享配置'
|
||||
: '独立配置'
|
||||
}}
|
||||
|
@ -378,9 +378,24 @@ const getDetails = (slotProps: Partial<Record<string, any>>) => {
|
|||
} else {
|
||||
!!cluster[0].configuration.publicHos && (head = '公网:');
|
||||
}
|
||||
if( !shareCluster && cluster.length > 1){
|
||||
const contentItem2 = (cluster[0].configuration.publicHost ||
|
||||
cluster[0].configuration.remoteHost) +
|
||||
':' +
|
||||
(cluster[0].configuration.publicPort ||
|
||||
cluster[0].configuration.remotePort)
|
||||
let headItme2 ='远程'
|
||||
!!cluster[0].configuration.publicHos && (headItme2 = '公网:');
|
||||
if(cluster.length > 2){
|
||||
return head + headers + content + " " + headItme2 + headers + contentItem2 + '。。。'
|
||||
}
|
||||
return head + headers + content + " " + headItme2 + headers + contentItem2
|
||||
}
|
||||
return head + headers + content;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const getSupports = async () => {
|
||||
const res: any = await supports();
|
||||
options.value = res.result.map((item: any) => ({
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<j-form-item
|
||||
label='说明'
|
||||
label='描述'
|
||||
name='describe'
|
||||
:rules='Max_Length_200'
|
||||
>
|
||||
|
|
|
@ -466,6 +466,7 @@ const getActions = (
|
|||
data?.state?.value !== 'disabled'
|
||||
? '请先禁用该告警,再删除'
|
||||
: '删除',
|
||||
placement:"topLeft"
|
||||
},
|
||||
popConfirm: {
|
||||
title: '确认删除?',
|
||||
|
|
|
@ -98,8 +98,8 @@
|
|||
:status="slotProps.state?.value"
|
||||
:text="slotProps.state?.text"
|
||||
:statusNames="{
|
||||
enabled: 'processing',
|
||||
disabled: 'error',
|
||||
started: 'processing',
|
||||
disable: 'error',
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue