修改组态化

master
夜笙歌 2 months ago
parent 8ac8b45fd5
commit eeeedfae2a

@ -263,8 +263,9 @@ const findTier = () => {
params: constructionDataForm.value.method === 'get' ? params : '',
data: constructionDataForm.value.method === 'post' ? params : ''
}).then(res => {
let data = res.data;
if (data.data) {
let data = (options.isD ? res : res.data);
console.log(data);
if (data?.data) {
Object.keys(data.data?.[0]).forEach(key => {
constructionDataForm.value.outputData.push({
name: key,
@ -272,7 +273,8 @@ const findTier = () => {
tier: `data,map%${key}`
});
});
} else if (data.rows) {
} else if (data?.rows) {
console.log(data?.rows);
Object.keys(data.rows?.[0]).forEach(key => {
constructionDataForm.value.outputData.push({
name: key,

@ -310,6 +310,14 @@
<el-form-item label="数据名称" v-if="Object.keys(nodeAttrForm).includes('yNames')">
<el-input-tag v-model="nodeAttrForm.yNames" placeholder="回车确认" />
</el-form-item>
<el-form-item label="超时时间" v-if="Object.keys(nodeAttrForm).includes('timeout')">
<el-input-number
v-model="nodeAttrForm.timeout"
:min="1000"
:step="1000"
controls-position="right"
/>
</el-form-item>
</el-form>
</div>
<el-dialog v-model="pageSettingVisible" title="页面设置" width="500">
@ -659,3 +667,10 @@ const setPageData = () => {
height: 216px
}
</style>
<style>
.el-notification {
display: none !important;
}
</style>

@ -5,7 +5,8 @@
<div class="custom-node"
:style="{width:props.dimensions.width+'px',height:props.dimensions.height+'px',pointerEvents:props.isView?'auto': 'none'}">
<el-button type="primary" :style="{width:props.dimensions.width +'px',height:props.dimensions.height+'px'}"
<el-button :type="isErr ? 'danger':'primary'"
:style="{width:props.dimensions.width +'px',height:props.dimensions.height+'px'}"
:icon="Connection">{{ props.data.customData.name }}
</el-button>
<span style="color:#fff">
@ -24,6 +25,7 @@ import request from '@/utils/request';
import axios from 'axios';
import { options } from '../../tool.js';
const isErr = ref(false);
const props = defineProps({
isView: {
type: Boolean,
@ -90,11 +92,16 @@ const getOutputData = () => {
params: props.data.customData.method === 'get' ? params : '',
data: props.data.customData.method === 'post' ? params : ''
}).then(res => {
isErr.value = false;
let data = (options.isD ? res : res.data);
let output = {};
props.data.customData.outputData.forEach(item => {
output[item.name] = parseData(res.data, item.tier);
output[item.name] = parseData(data, item.tier);
});
props.data.outputData = output;
}).catch(e => {
isErr.value = true;
console.log(e);
});
};
@ -104,7 +111,7 @@ onMounted(() => {
let interval = setInterval(() => {
getOutputData();
}, 1000);
}, props.data.options?.timeout || 5 * 1000);
onBeforeUnmount(() => {
clearInterval(interval);

@ -5,7 +5,8 @@
<div class="custom-node"
:style="{width:props.dimensions.width+'px',height:props.dimensions.height+'px',pointerEvents:props.isView?'auto': 'none'}">
<el-button type="primary" :style="{width:props.dimensions.width +'px',height:props.dimensions.height+'px'}"
<el-button :type="isErr ? 'danger':'primary'"
:style="{width:props.dimensions.width +'px',height:props.dimensions.height+'px'}"
:icon="Connection">设备运行数量
</el-button>
<span style="color:#fff">
@ -24,6 +25,8 @@ import axios from 'axios';
import request from '@/utils/request';
import { options } from '../../tool.js';
const isErr = ref(false);
const props = defineProps({
isView: {
type: Boolean,
@ -64,10 +67,15 @@ const getOutputData = () => {
url: '/test/getDevice',
data: props.inputData
}).then(res => {
isErr.value = false;
let data = (options.isD ? res : res.data);
props.data.outputData = {
time: res.data?.data?.map(e => e.time),
value: res.data?.data?.map(e => e.value)
time: data?.data?.map(e => e.time),
value: data?.data?.map(e => e.value)
};
}).catch(e => {
isErr.value = true;
console.log(e);
});
};

@ -15,12 +15,14 @@ const getOption = (e) => {
return { title: '', yNames: [] };
} else if (e === 'curve' || e === 'multiCurves') {
return { title: '', yNames: [] };
} else if (e === 'pie' ) {
} else if (e === 'pie') {
return { title: '', yNames: [] };
} else if (e === 'customBoard') {
return { title: '', yNames: [] };
} else if (e === 'data') {
return {};
return { timeout: 5000 };
} else if (e === 'customData') {
return { timeout: 5000 };
} else if (e === 'map') {
return { dataMap: [] };
} else if (e === 'inputNode') {
@ -36,7 +38,7 @@ const getOption = (e) => {
}
};
const getNodeSize = (e) => {
if (e === 'line' || e === 'multiLines' || e === 'bar' || e === 'multiBars' || e === 'curve' || e === 'multiCurves' || e === 'customBoard'|| e === 'pie') {
if (e === 'line' || e === 'multiLines' || e === 'bar' || e === 'multiBars' || e === 'curve' || e === 'multiCurves' || e === 'customBoard' || e === 'pie') {
return { width: 300, height: 150 };
} else if (e === 'data' || e === 'customData') {
return { width: 150, height: 50 };

@ -1,6 +1,6 @@
<template>
<div class="content"
:style='`width:${area.width || "1920px"};height:${area.height || "1080px"};background-image:url(${area.bg})`'>
:style='`width:${area.width || "100%"};height:${area.height || "100%"};background-image:url(${area.bg})`'>
<div v-for="i in nodes" class="node" :style="{left:i.position?.x+'px',top: i.position?.y+'px'}">
<template v-if="i.type === 'customBoard'">
<CustomBoardNode :isView="true" :inputData=getInputData(i.id) v-bind="i"></CustomBoardNode>
@ -110,4 +110,12 @@ onMounted(() => {
.node {
position: absolute;
}
</style>
<style>
.el-notification {
display: none !important;
}
</style>

@ -190,7 +190,7 @@ const aaDel = () => {
const aaAddSubmit = async () => {
let formData = aaOperationForm.value;
let localData = pageData.value;
console.log(formData);
aaOperationFormVisible.value = false;
};

@ -28,7 +28,7 @@ const exportConfig = (e) => {
let codeStr = template + script;
console.log(codeStr);
const blob = new Blob([codeStr], { type: 'text/plain;charset=utf-8' });
// Download.saveAs(blob, Date.now() + '.vue');
Download.saveAs(blob, Date.now() + '.vue');
};

Loading…
Cancel
Save