浙江蓝卓supos低代码开发
前言
一、蓝卓supos低代码开发?
是中控的一个子公司研发的一个项目
二、使用步骤
1.引入库
// 客户端为IE11浏览器时不支持ES6脚本
// 客户端为IE11浏览器时不支持ES6脚本
import React, { PureComponent } from 'react';
import * as echarts from '../extensions/echarts.v5.3.1.min';
import { Button, DatePicker, version } from "antd";
import { Table } from 'antd';
const table = [];
const titleList = [
'能源类型',
'平均日消耗量',
'平均月消耗量',
'年消耗量',
'高消耗工厂数目',
'低消耗工厂数目',
'消耗异常工厂数目',
'运行状态'
];
const itemIndex = [
'level',
'loopsNumber',
'otherloopsNumber',
'Self_control_rate',
'automatic_state_loopsNUmber',
'Plateau_rate',
'steady_state_loopsNumber',
'state'
];
const dataParam = [
{
level: '原碳消耗量',
loopsNumber: '1t',
otherloopsNumber: '50.3t',
Self_control_rate: '600.56t',
automatic_state_loopsNUmber: 28,
Plateau_rate: 97,
steady_state_loopsNumber:0,
state: '正常运行'
},
{
level: '水能消耗量',
loopsNumber: '9t',
otherloopsNumber: '280t',
Self_control_rate: '3600.56t',
automatic_state_loopsNUmber: 8,
Plateau_rate: 197,
steady_state_loopsNumber:0,
state: '正常运行'
},
{
level: '电能消耗量',
loopsNumber: '100度',
otherloopsNumber: '1500.3度',
Self_control_rate: '40000度',
automatic_state_loopsNUmber: 56,
Plateau_rate: 25,
steady_state_loopsNumber:5,
state: '异常'
},
{
level: '天然气',
loopsNumber: '90t',
otherloopsNumber: '1200.3t',
Self_control_rate: '30000t',
automatic_state_loopsNUmber: 77,
Plateau_rate: 2,
steady_state_loopsNumber:0,
state: '正常运行'
},
{
level: '电能消耗量',
loopsNumber: '100度',
otherloopsNumber: '1500.3度',
Self_control_rate: '40000度',
automatic_state_loopsNUmber: 56,
Plateau_rate: 25,
steady_state_loopsNumber:5,
state: '异常'
},
{
level: '乙二醇消耗量',
loopsNumber: '50t',
otherloopsNumber: '150t',
Self_control_rate: '3642t',
automatic_state_loopsNUmber: 14,
Plateau_rate: 2,
steady_state_loopsNumber:1,
state: '异常'
},
{
level: '乙烯消耗量',
loopsNumber: '50t',
otherloopsNumber: '150t',
Self_control_rate: '3642t',
automatic_state_loopsNUmber: 14,
Plateau_rate: 2,
steady_state_loopsNumber:1,
state: '异常'
},
]
export default class PIDComponent extends PureComponent {
constructor(props) {
super(props),
this.tableInit()
};
tableInit = () => {
titleList.forEach((item, index) => {
table.push({
title: item,
dataIndex: itemIndex[index],//已经定义过的itemIndex
key: itemIndex[index],
})
})
};
componentDidMount = () => {
this.ChartInit()
};
ChartInit = () => {
var chartDom1 = document.getElementById('b1');
var myChart1 = echarts.init(chartDom1);
var option1;
var chartDom2 = document.getElementById('b2');
var myChart2 = echarts.init(chartDom2);
var option2;
// this.box1 = echarts.init(document.getElementById('b1'));
// this.box2 = echarts.init(document.getElementById('b2'));
option1=({
title: {
text: '节能指标',
textStyle: {
color: '#00CCFF',
fontSize: 24
}
},
series: [
{
type: 'gauge',
axisLine: {
lineStyle: {
width: 30,
color: [
[0.2, '#fd666d'],
[0.8, '#37a2da'],
[1, '#67e0e3']
]
}
},
pointer: {
itemStyle: {
color: 'auto'
}
},
axisTick: {
distance: -30,
length: 8,
lineStyle: {
color: '#fff',
width: 2
}
},
splitLine: {
distance: -30,
length: 10,
lineStyle: {
color: '#fff',
width: 4
}
},
axisLabel: {
color: 'auto',
distance: 60,
fontSize: 13
},
detail: {
valueAnimation: true,
formatter: '{value} %',
color: 'auto',
fontSize: 24,
offsetCenter: [0, "60%"]
},
data: [
{
value: 91.21
}
]
}
]
});
setInterval(function () {
const random = +(Math.random() * 60).toFixed(2);
myChart1.setOption({
series: [
{
data: [
{
value: random
}
]
}
]
});
}, 1000);
option1 && myChart1.setOption(option1);
option2=({
title: {
text: '能源审计',
textStyle: {
color: '#00CCFF',
fontSize: 24
}
},
series: [
{
type: 'gauge',
axisLine: {
lineStyle: {
width: 30,
color: [
[0.2, '#fd666d'],
[0.8, '#37a2da'],
[1, '#67e0e3']
]
}
},
pointer: {
itemStyle: {
color: 'auto'
}
},
axisTick: {
distance: -30,
length: 8,
lineStyle: {
color: '#fff',
width: 2
}
},
splitLine: {
distance: -30,
length: 10,
lineStyle: {
color: '#fff',
width: 4
}
},
axisLabel: {
color: 'auto',
distance: 60,
fontSize: 13
},
detail: {
valueAnimation: true,
formatter: '{value} %',
color: 'auto',
fontSize: 24,
offsetCenter: [0, "60%"]
},
data: [
{
value: 91.21
}
]
}
]
});
setInterval(function () {
const random = +(Math.random() * 60).toFixed(2);
myChart2.setOption({
series: [
{
data: [
{
value: random
}
]
}
]
});
}, 1200);
option2 && myChart2.setOption(option2);
// let chartDom = document.getElementById('app');
// let myChart = echarts.init(chartDom);
// let option;
// setTimeout(function () {
// option = {
// legend: {},
// tooltip: {
// trigger: 'axis',
// showContent: false
// },
// dataset: {
// source: [
// ['产品', '2022.1', '2022.2', '2022.3', '2022.4', '2022.5', '2022.6'],
// ['碳排放总量', 56.5, 82.1, 88.7, 70.1, 53.4, 85.1],
// ['碳排放强度', 51.1, 51.4, 55.1, 53.3, 73.8, 68.7],
// ['化石能源节省量', 40.1, 62.2, 69.5, 36.4, 45.2, 32.5],
// ]
// },
// xAxis: { type: 'category' },
// yAxis: { gridIndex: 0 },
// grid: { top: '55%' },
// series: [
// {
// type: 'line',
// smooth: true,
// seriesLayoutBy: 'row',
// emphasis: { focus: 'series' }
// },
// {
// type: 'line',
// smooth: true,
// seriesLayoutBy: 'row',
// emphasis: { focus: 'series' }
// },
// {
// type: 'line',
// smooth: true,
// seriesLayoutBy: 'row',
// emphasis: { focus: 'series' }
// },
// {
// type: 'line',
// smooth: true,
// seriesLayoutBy: 'row',
// emphasis: { focus: 'series' }
// },
// {
// type: 'pie',
// id: 'pie',
// radius: '30%',
// center: ['50%', '25%'],
// emphasis: {
// focus: 'self'
// },
// label: {
// formatter: '{b}: {@2012} ({d}%)'
// },
// encode: {
// itemName: 'product',
// value: '2022',
// tooltip: '2022'
// }
// }
// ]
// };
// myChart.on('updateAxisPointer', function (event) {
// const xAxisInfo = event.axesInfo[0];
// if (xAxisInfo) {
// const dimension = xAxisInfo.value + 1;
// myChart.setOption({
// series: {
// id: 'pie',
// label: {
// formatter: '{b}: {@[' + dimension + ']} ({d}%)'
// },
// encode: {
// value: dimension,
// tooltip: dimension
// }
// }
// });
// }
// });
// myChart.setOption(option);
// });
// option && myChart.setOption(option);
};
render() {
return (
<div className='bg0'>
<div className="bg1" >
<div id="aa">
<div className="topleftbox" />
<div className="toprightbox" />
<div className="bottomleftbox" />
<div className="bottomrightbox" />
<div id="b1" style={{ width: '90%', height: '90%' }} />
</div>
<div id="bb" >
<div className="topleftbox" />
<div className="toprightbox" />
<div className="bottomleftbox" />
<div className="bottomrightbox" />
<div id="b2" style={{ width: '90%', height: '90%' }} />
</div>
<div className="data">
<Table columns={table} dataSource={dataParam} rowKey={record => record.num}></Table>
</div>
</div>
<div className="bg2" >
<div id="app" style={{ width: '100%', height: '90%',backgroundColor:' rgb(157,190,255)'}} />
</div>
</div>
)
}
}
let css = document.createElement('style');
css.innerHTML = `
.bg0 {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
background-color: rgb(15,32,64);
}
.bg0 .bg1 {
height: 50%;
width: 100%;
display: flex;
align-items: center;
justify-content: space-around;
background-color: rgb(24,68,110);
// background-color: aqua;
}
.bg0 .bg1 #aa {
height: 90%;
width: 20%;
border-radius: 20px;
background-color: rgb(15,32,62);
}
.bg0 .bg1 #bb {
height: 90%;
width: 20%;
border-radius: 20px;
background-color: rgb(15,32,62);
}
.bg0 .bg1 .data {
height: 90%;
width: 55%;
border-radius: 20px;
background-color: rgb(216,216,216);;
}
.bg0 .data .ant-table .ant-table-tbody > tr {
color: black;
}
.bg0 .data .ant-table,
.bg0 .data .ant-input,
.bg0 .data .ant-form,
.bg0 .data .ant-form label,
.bg0 .data .ant-form-item,
.bg0 .data .ant-select,
.bg0 .data .ant-upload,
.bg0 .data .ant-radio-wrapper,
.bg0 .data .ant-checkbox-wrapper,
.bg0 .data .ant-btn {
font-size: 24px;
}
.bg0 .data .ant-table thead.ant-table-thead > tr > th {
min-width: 50px;
max-width: 90px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding: 11px 0 11px 8px;
height: 44px;
color: #000;
background: pink;
border-bottom: 0px solid #e6eaee;
}
.bg0 .data td {
text-align: center;
}
.bg0 .data div {
text-align: center;
}
.bg0 .data .ant-table .ant-table-tbody > tr:hover > td,
.mainContent .dataTable .ant-table .ant-table-tbody > tr.expand-parent > td {
background:yellowgreen;
}
.bg0 .data .ant-table .ant-table-tbody > tr > td {
min-width: 50px;
max-width: 90px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
border-bottom: 2px solid #05495a;
border-right: 2px solid #05495a;
padding: 7px 0 7px 8px;
height: 44px;
color: yellow;
}
.bg0 .bg1 #aa .topleftbox {
width: 20px;
height: 20px;
position: absolute;
left: 5px;
top: 5px;
border-top: 5px solid #116bb7;
border-left: 5px solid #116bb7;
}
.bg0 .bg1 #aa .toprightbox {
width: 20px;
height: 20px;
position: absolute;
right: 5px;
top: 5px;
border-top: 5px solid #116bb7;
border-right: 5px solid #116bb7;
}
.bg0 .bg1 #aa .bottomleftbox {
width: 20px;
height: 20px;
position: absolute;
left: 5px;
bottom: 5px;
border-bottom: 5px solid #116bb7;
border-left: 5px solid #116bb7;
}
.bg0 .bg1 #aa .bottomrightbox {
width: 20px;
height: 20px;
position: absolute;
right: 5px;
bottom: 5px;
border-bottom: 5px solid #116bb7;
border-right: 5px solid #116bb7;
}
.bg0 .bg1 #bb .topleftbox {
width: 20px;
height: 20px;
position: absolute;
left: 5px;
top: 5px;
border-top: 5px solid #116bb7;
border-left: 5px solid #116bb7;
}
.bg0 .bg1 #bb .toprightbox {
width: 20px;
height: 20px;
position: absolute;
right: 5px;
top: 5px;
border-top: 5px solid #116bb7;
border-right: 5px solid #116bb7;
}
.bg0 .bg1 #bb .bottomleftbox {
width: 20px;
height: 20px;
position: absolute;
left: 5px;
bottom: 5px;
border-bottom: 5px solid #116bb7;
border-left: 5px solid #116bb7;
}
.bg0 .bg1 #bb .bottomrightbox {
width: 20px;
height: 20px;
position: absolute;
right: 5px;
bottom: 5px;
border-bottom: 5px solid #116bb7;
border-right: 5px solid #116bb7;
}
.bg0 .bg2{
display: flex;
align-items: center;
height: 50%;
width: 100%;
flex-direction: row;
justify-content: space-around;
background-color: rgb(24,68,110);
// background-color: rgba(15,32,64,.5);
}
.bg0 .bg2 #app {
border-radius: 20px;
}
`
document.getElementsByTagName('head')[0].appendChild(css)
2.需要在extension里面安装echart、antd插件
下面是echart引入react方法
https://blog.csdn.net/hahahhahahahha123456/article/details/80390151
下面是antd的引入方式
https://blog.csdn.net/qq_42672798/article/details/108095775?spm=1001.2101.3001.6650.6&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-6-108095775-blog-120652263.pc_relevant_antiscanv3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-6-108095775-blog-120652263.pc_relevant_antiscanv3&utm_relevant_index=10
总结
提示:这里对文章进行总结:
以上就是今天要讲低代码开发的内容