Files

913 lines
27 KiB
Plaintext
Raw Permalink Normal View History

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment env
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
.layui-card {
border: 1px solid #f2f2f2;
border-radius: 5px;
}
.icon {
margin-right: 10px;
color: #1aa094;
}
.icon-cray {
color: #ffb800 !important;
}
.icon-blue {
color: #1e9fff !important;
}
.icon-tip {
color: #ff5722 !important;
}
.layuimini-qiuck-module {
text-align: center;
margin-top: 10px
}
.layuimini-qiuck-module a i {
display: inline-block;
width: 100%;
height: 60px;
line-height: 60px;
text-align: center;
border-radius: 2px;
font-size: 30px;
background-color: #F8F8F8;
color: #333;
transition: all .3s;
-webkit-transition: all .3s;
}
.layuimini-qiuck-module a cite {
position: relative;
top: 2px;
display: block;
color: #666;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 14px;
}
.welcome-module {
width: 100%;
height: 210px;
}
.panel {
background-color: #fff;
border: 1px solid transparent;
border-radius: 3px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05)
}
.panel-body {
padding: 10px
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 12px;
color: inherit
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-top: .3em;
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-top: .3em;
}
.layui-red {
color: red
}
.main_btn > p {
height: 40px;
}
.layui-bg-number {
background-color: #F8F8F8;
}
.layuimini-notice:hover {
background: #f6f6f6;
}
.layuimini-notice {
padding: 7px 16px;
clear: both;
font-size: 12px !important;
cursor: pointer;
position: relative;
transition: background 0.2s ease-in-out;
}
.layuimini-notice-title, .layuimini-notice-label {
padding-right: 70px !important;
text-overflow: ellipsis !important;
overflow: hidden !important;
white-space: nowrap !important;
}
.layuimini-notice-title {
line-height: 28px;
font-size: 14px;
}
.layuimini-notice-extra {
position: absolute;
top: 50%;
margin-top: -8px;
right: 16px;
display: inline-block;
height: 16px;
color: #999;
}
</style>
<script>
layui.use(['layer', 'echarts', 'common'], function () {
var $ = layui.jquery,
layer = layui.layer,
common = layui.common,
echarts = layui.echarts;
wcLoading.close();
//拖拽
const draggable_dev = true;
//新版色彩
const fill_backgroud = '#28333e';
//const fill_backgroud = '#2a0056';
// const fill_iobox = '#2492e9';//00
// const fill_iobox = '#345266';//001
const fill_iobox = '#345b87';//002
// const fill_iobox = '#50657a';//003
// const fill_iobox = '#334b64';//004
//const fill_iobox = '#3d5062';//005
const stroke_iobox = '#494d52';;
const stroke_iobox_line = '#42444a';
const stroke_iobox_spiltline = '#474b58';
const fill_top_name = '#ffffff';
const fill_top_name_value = '#ffffff';
const fill_rect = '#cecece';
const fill_rect_text_name = '#ffffff';
//const fill_rect_text_name = '#02f2e0';
const fill_rect_text_description = '#ffffff';
//const fill_rect_text_description = '#02f2e0';
const fill_rect_io_on = '#00ff55';//'#00ff7f'
//const fill_rect_io_on = '#00ff7f'
const fill_rect_io_off = '#cecece';
const leafer = new LeaferUI.Leafer({
view: 'idmain', // 支持 window 、div、canvas 标签对象, 可使用id字符串(不用加 # 号)
width: 3000, // 不能设置为 0 否则会变成自动布局
height: 1200,
fill: fill_backgroud,
move: {
drag: true,
},
wheel: {
zoomMode: true,
zoomSpeed: 0.01,
},
zoom:{
min: 0.4,
max: 1.5,
}
})
const group = new LeaferUI.Group({ x: 0, y: 0, scaleX: 1, scaleY: 1 })
leafer.add(group)
function draw(){
//1
var rect_step0 = new LeaferUI.Rect({
x: 200,
y: 100,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step0',
name:'step0'
})
var s0_text = new LeaferUI.Text({
x: 260,
y: 125,
width: 100,
fill: fill_top_name,
text: 'S0_初始步',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
// id:'s0text',
name:'step0'
})
group.add(s0_text);
const line0 = new LeaferUI.Line({
// id: 'line0',
points: [225, 150, 225, 250],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
})
group.add(line0)
var con0 = new LeaferUI.Line({
id: 'con0',
points: [200, 200, 250, 200],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con0'
})
group.add(con0)
var c0_text = new LeaferUI.Text({
x: 260,
y: 200,
width: 100,
fill: fill_top_name,
text: '执行该流程请求',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con0'
})
group.add(c0_text)
var rect_step1 = new LeaferUI.Rect({
x: 200,
y: 250,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step1',
name:'step1'
})
var s1_text = new LeaferUI.Text({
x: 260,
y: 275,
width: 100,
fill: fill_top_name,
text: 'S1_执行动作1',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'step1'
})
group.add(s1_text);
const line1_1 = new LeaferUI.Line({
// id: 'line1_1',
points: [225, 300, 225, 450],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
})
group.add(line1_1)
var con1_1 = new LeaferUI.Line({
id: 'con11',
points: [200, 400, 250, 400],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con11'
})
group.add(con1_1)
var c1_1_text = new LeaferUI.Text({
x: 260,
y: 400,
width: 100,
fill: fill_top_name,
text: 'S2转换条件',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con11'
})
group.add(c1_1_text)
var cc1_1_1_text = new LeaferUI.Text({
x: 350,
y: 390,
width: 100,
fill: fill_top_name,
text: '第一个条件变量',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'cc111'
})
group.add(cc1_1_1_text)
var cc1_1_2_text = new LeaferUI.Text({
x: 350,
y: 410,
width: 100,
fill: fill_top_name,
text: '第二个条件变量',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'cc112'
})
group.add(cc1_1_2_text)
const line1_2 = new LeaferUI.Line({
// id: 'line1_2',
points: [225, 300, 225, 350, 575, 350, 575, 450],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
})
group.add(line1_2)
var con1_2 = new LeaferUI.Line({
id: 'con12',
points: [550, 400, 600, 400],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con12'
})
group.add(con1_2)
var c1_2_text = new LeaferUI.Text({
x: 610,
y: 400,
width: 100,
fill: fill_top_name,
text: 'S4转换条件',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con12'
})
group.add(c1_2_text)
var rect_step2 = new LeaferUI.Rect({
x: 200,
y: 450,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step2',
name:'step2'
})
var s2_text = new LeaferUI.Text({
x: 260,
y: 475,
width: 100,
fill: fill_top_name,
text: 'S2_执行子流程',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'step2'
})
group.add(s2_text);
const line2 = new LeaferUI.Line({
// id: 'line2',
points: [225, 450, 225, 600],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
})
group.add(line2)
var con2 = new LeaferUI.Line({
id: 'con2',
points: [200, 550, 250, 550],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con2'
})
group.add(con2)
var c2_text = new LeaferUI.Text({
x: 260,
y: 550,
width: 100,
fill: fill_top_name,
text: 'S3转换条件',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con2'
})
group.add(c2_text)
var cc2_1_text = new LeaferUI.Text({
x: 350,
y: 535,
width: 100,
fill: fill_top_name,
text: '第一个条件变量',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'cc21'
})
group.add(cc2_1_text)
var cc2_2_text = new LeaferUI.Text({
x: 350,
y: 550,
width: 100,
fill: fill_top_name,
text: '第二个条件变量',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'cc22'
})
group.add(cc2_2_text)
var cc2_3_text = new LeaferUI.Text({
x: 350,
y: 565,
width: 100,
fill: fill_top_name,
text: '第三个条件变量',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'cc23'
})
group.add(cc2_3_text)
var rect_step3 = new LeaferUI.Rect({
x: 200,
y: 600,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step3',
name:'step3'
})
var s3_text = new LeaferUI.Text({
x: 260,
y: 625,
width: 100,
fill: fill_top_name,
text: 'S3_设备输出1\n 设备输出2',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'step3'
})
group.add(s3_text);
const line3 = new LeaferUI.Line({
// id: 'line3',
points: [225, 650, 225, 800],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
})
group.add(line3)
var con3 = new LeaferUI.Line({
id: 'con3',
points: [200, 700, 250, 700],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con3'
})
group.add(con3)
var c3_text = new LeaferUI.Text({
x: 260,
y: 700,
width: 100,
fill: fill_top_name,
text: 'S6转换条件',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con3'
})
group.add(c3_text)
var rect_step4 = new LeaferUI.Rect({
x: 550,
y: 450,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step4',
name:'step4'
})
var s4_text = new LeaferUI.Text({
x: 610,
y: 475,
width: 100,
fill: fill_top_name,
text: 'S4_执行子流程',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'step4'
})
group.add(s4_text);
const line4 = new LeaferUI.Line({
// id: 'line4',
points: [575, 500, 575, 600],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
})
group.add(line4)
var con4 = new LeaferUI.Line({
id: 'con4',
points: [550, 550, 600, 550],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con4'
})
group.add(con4)
var c4_text = new LeaferUI.Text({
x: 610,
y: 550,
width: 100,
fill: fill_top_name,
text: 'S5转换条件',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con4'
})
group.add(c4_text)
var rect_step5 = new LeaferUI.Rect({
x: 550,
y: 600,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step5',
name:'step5'
})
var s5_text = new LeaferUI.Text({
x: 610,
y: 625,
width: 100,
fill: fill_top_name,
text: 'S5_执行子流程',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'step5'
})
group.add(s5_text);
const line5 = new LeaferUI.Line({
// id: 'line5',
points: [575, 650, 575, 750, 225, 750, 225, 800],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
});
group.add(line5);
var con5 = new LeaferUI.Line({
id: 'con5',
points: [550, 700, 600, 700],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con5'
});
group.add(con5);
var c5_text = new LeaferUI.Text({
x: 610,
y: 700,
width: 100,
fill: fill_top_name,
text: 'S6转换条件',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con5'
})
group.add(c5_text)
var rect_step6 = new LeaferUI.Rect({
x: 200,
y: 800,
height: 50,
width: 50,
fill: fill_rect,
draggable: false,
// id: 'step6',
name:'step6'
})
var s6_text = new LeaferUI.Text({
x: 260,
y: 825,
width: 100,
fill: fill_top_name,
text: 'S6_Set 执行该流程完成',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'step6'
})
group.add(s6_text);
const line6 = new LeaferUI.Line({
// id: 'line6',
points: [225, 850, 225, 950, 100, 950, 100, 125, 200, 125],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
}
});
group.add(line6);
var con6 = new LeaferUI.Line({
id: 'con6',
points: [200, 900, 250, 900],
strokeWidth: 2,
stroke: '#cecece',
shadow: {
x: 0,
y: 0,
blur: 1,
color: '#cecece',
visible: true,
},
name:'con6'
});
group.add(con6);
var c6_text = new LeaferUI.Text({
x: 260,
y: 900,
width: 100,
fill: fill_top_name,
text: '执行该流程完成',
textAlign: 'left',
verticalAlign: 'middle',
textWrap: 'none',
padding: 0,
fontSize: 12,
name:'con6'
})
group.add(c6_text)
group.add(rect_step0)
group.add(rect_step1)
group.add(rect_step2)
group.add(rect_step3)
group.add(rect_step4)
group.add(rect_step5)
group.add(rect_step6)
}
draw();
var t = null;
function time() {
clearTimeout(t); //清除定时器
UpdataChart()
t = setTimeout(time, 1 * 1000); //设定定时器,循环运行
}
async function UpdataChart() {
myajax = await $.ajax({
url: "/DevicesManage/DeviceMonitoring/GetRealDeviceTag",
type: "Get",
dataType: "json",
success: function (redata) {
}
});
$.when(myajax).done(function (redata) {
// var data = redata[0]
debugger;
for(var i = 0; i < redata.length; i++)
{
// leafer.findOne('#'+redata[i].TagName).fill =(redata[i].TagValue == '1') ? fill_rect_io_on : fill_rect_io_off;
// leafer.find(redata[i].TagName);
leafer.find(function (item) {
for(var ii= 0;ii<=item.leafs;ii++)
{
try
{
if(item.children[0].children[ii].__tag == 'Line')
{
if(item.children[0].children[ii].id ==redata[i].TagName)
{
item.children[0].children[ii].stroke =(redata[i].TagValue == '1') ? fill_rect_io_on : fill_rect_io_off;
}
}
else
{
if(item.children[0].children[ii].name ==redata[i].TagName)
{
item.children[0].children[ii].fill =(redata[i].TagValue == '1') ? fill_rect_io_on : fill_rect_io_off;
}
}
}
catch(error)
{
console.log(error)
}
}
// if(item.name == redata[i].TagName )
// {
// item.fill =(redata[i].TagValue == '1') ? fill_rect_io_on : fill_rect_io_off;
// }
});
// console.log(arr);
}
// leafer.findOne('#' + 'RUN1').fill = fill_rect_io_on;
// leafer.findOne('#' + 'RUN').fill = fill_rect_io_on;
// leafer.findOne('#' + 'ETH0').fill = fill_rect_io_on;
// leafer.findOne('#' + 'ETH1').fill = fill_rect_io_on;
// leafer.findOne('#' + 'ETH2').fill = fill_rect_io_on;
// for(var ioName in redata)
// {
// leafer.findOne('#'+ioName.replace('_','.')).fill =(redata[ioName] == '1') ? fill_rect_io_on : fill_rect_io_off;
// }
// for (var ioslot = 0; ioslot < 8; ioslot++) {
// leafer.findOne('#' + 'Slot:' + ioslot + '_OnlineSatate').fill = fill_rect_io_on;
// }
});
}
t = setTimeout(time, 1 * 1000); //开始运行
})
</script>
<script type="text/javascript" src="~/lib//leafer-ui@1.2.1/web.js"></script>
<div style ="width:100%;height:100%;">
<div class="layuimini-container" style="width:100%;height:100%; ">
<div id = "idmain">
</div>
</div>
</div>