修改组态化

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

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

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

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

@ -5,7 +5,8 @@
<div class="custom-node" <div class="custom-node"
:style="{width:props.dimensions.width+'px',height:props.dimensions.height+'px',pointerEvents:props.isView?'auto': 'none'}"> :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">设备运行数量 :icon="Connection">设备运行数量
</el-button> </el-button>
<span style="color:#fff"> <span style="color:#fff">
@ -24,6 +25,8 @@ import axios from 'axios';
import request from '@/utils/request'; import request from '@/utils/request';
import { options } from '../../tool.js'; import { options } from '../../tool.js';
const isErr = ref(false);
const props = defineProps({ const props = defineProps({
isView: { isView: {
type: Boolean, type: Boolean,
@ -64,10 +67,15 @@ const getOutputData = () => {
url: '/test/getDevice', url: '/test/getDevice',
data: props.inputData data: props.inputData
}).then(res => { }).then(res => {
isErr.value = false;
let data = (options.isD ? res : res.data);
props.data.outputData = { props.data.outputData = {
time: res.data?.data?.map(e => e.time), time: data?.data?.map(e => e.time),
value: res.data?.data?.map(e => e.value) 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: [] }; return { title: '', yNames: [] };
} else if (e === 'curve' || e === 'multiCurves') { } else if (e === 'curve' || e === 'multiCurves') {
return { title: '', yNames: [] }; return { title: '', yNames: [] };
} else if (e === 'pie' ) { } else if (e === 'pie') {
return { title: '', yNames: [] }; return { title: '', yNames: [] };
} else if (e === 'customBoard') { } else if (e === 'customBoard') {
return { title: '', yNames: [] }; return { title: '', yNames: [] };
} else if (e === 'data') { } else if (e === 'data') {
return {}; return { timeout: 5000 };
} else if (e === 'customData') {
return { timeout: 5000 };
} else if (e === 'map') { } else if (e === 'map') {
return { dataMap: [] }; return { dataMap: [] };
} else if (e === 'inputNode') { } else if (e === 'inputNode') {
@ -36,7 +38,7 @@ const getOption = (e) => {
} }
}; };
const getNodeSize = (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 }; return { width: 300, height: 150 };
} else if (e === 'data' || e === 'customData') { } else if (e === 'data' || e === 'customData') {
return { width: 150, height: 50 }; return { width: 150, height: 50 };

@ -1,6 +1,6 @@
<template> <template>
<div class="content" <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'}"> <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'"> <template v-if="i.type === 'customBoard'">
<CustomBoardNode :isView="true" :inputData=getInputData(i.id) v-bind="i"></CustomBoardNode> <CustomBoardNode :isView="true" :inputData=getInputData(i.id) v-bind="i"></CustomBoardNode>
@ -110,4 +110,12 @@ onMounted(() => {
.node { .node {
position: absolute; position: absolute;
} }
</style>
<style>
.el-notification {
display: none !important;
}
</style> </style>

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

@ -28,7 +28,7 @@ const exportConfig = (e) => {
let codeStr = template + script; let codeStr = template + script;
console.log(codeStr); console.log(codeStr);
const blob = new Blob([codeStr], { type: 'text/plain;charset=utf-8' }); 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