1.2.2 • Published 1 month ago

econdraw v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

易通 econdraw

易通 econdraw Web 组态软件,方便组件化模块化工程化引入 组态内部弹窗使用 element-ui 组件,要使用内部弹窗需要安装 element-ui

易通组态官网

易通官网

更新日志

npm 安装

 npm install --save econdraw

注册

import econdraw from "econdraw";
import "econdraw/dist/index.css";

Vue.use(econdraw);

CDN 在线引入

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/econdraw/dist/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/econdraw/dist/index.umd.min.js"></script>

CDN 注册

main.js

Vue.component(econdraw.name, econdraw);

或者 在vue文件中使用

components: {
    econDraw: econdraw
  },

使用

<econDraw
  v-if="graphFlag"
  ref="econDraw"
  :control="control"
  :fitView="fitView"
  :graph="graphData"
  :pushData="pushData"
  :originData="originData"
  :alarmData="alarmData"
  :permission="permission"
  :defaultPageId="defaultPageId"
  @event="handleClick"
></econDraw>
export default {
  data() {
    return {
      graphFlag: false,
      control:{
          show: true,
          background: '#fff',
          grabColor: '#409eff',
          position: 'bottom-right',
          color: '#666'
        }
      graphData: '',
      originData: [
        {
          TagName: 'Project.Dev.Point',
          TagValue: 0
        },
        {
          TagName: 'Project.Dev.Point2',
          TagValue: 0
        },
        {
          TagName: 'Project.Dev.Point3',
          TagValue: 0
        }
      ]
      pushData: [
        {
          TagName: 'Project.Dev.Point1',
          TagValue: 0
        }
      ],
      fitView: false,
      alarmData: [],
      permission: [],
      defaultPageId: '',
    }
  },
  mounted() {
    this.getGraphData()
  },
  methods: {
    getGraphData () {
      this.graphFlag = true
      this.graphData = '图纸数据'
    },
    handleClick(data, object) {
      // data 当前图元的全部数据
      // object 当前动作的数据
        console.log(data,object);
      }
    }
  }
}

Attributes

参数说明类型可选值默认值
graph图纸字符string-
originData原始数据array-
pushData更新数据array-
control控制按钮object-
fitView加载完图纸自动适应画布大小boolean-false
alarmData报警数据array-[]
permission权限array-[]
defaultPageId默认要显示的页面 Idstring--

graph: json 数据使用 JSON.stringify(data)转为 string

control

参数说明类型可选值默认值
show控制按钮显示Boolean-false
gird按钮排列方向Stringrow 横排竖排
grabColor拖拽模式切换箱String-#409eff
background控制按钮背景string-#fff
color控制按钮颜色string-#ccc
position控制按钮位置stringtop-left / top-right / bottom-left / bottom-rightbottom-right

originData 格式

originData = [
  {
    TagName: "Project.Dev.Point",
    TagValue: 0,
  },
  {
    TagName: "Project.Dev.Point2",
    TagValue: 0,
  },
  {
    TagName: "Project.Dev.Point3",
    TagValue: 0,
  },
];

pushData 格式

pushData = [
  {
    TagValue: 5,
    TagName: "Project.Dev.Point",
  },
];

alarmData 格式

alarmData = [
  {
    DevName: "电表1",
    PointName: "Ia",
    AlarmLevelText: "严重",
    Rule: "报警规则",
    LastAlarmTime: "2023-08-08 09:05:05",
  },
  {
    DevName: "电表2",
    PointName: "Ib",
    AlarmLevelText: "一般",
    Rule: "电流超限",
    LastAlarmTime: "2023-08-06 19:15:25",
  },
];

permission 格式

permission = ['Permission_1','Permission_2','Permission_3',...,'Permission_32']

event

事件名称说明回调参数
event组件触发事件当前组件的全部属性, 触发的事件

自定义控制按钮事件$ref

事件名称说明
hnadleZoomIn放大
handleZoomOut缩小
handleFitView适应窗口
handleFullScreen全屏
<econDraw
  ref="econDraw"
  @event="handleClick"
  @getComponents="handleGetComponents"
></econDraw>
export default {
  methods: {
    customFunction () {
      // 加载json图纸完成,执行一次 handleFitView
      this.$refs['econDraw'].hnadleZoomIn() //放大
      this.$refs['econDraw'].handleZoomOut() //缩小

      this.$refs['econDraw'].handleFitView() //适应窗口
      this.$refs['econDraw'].handleFullScreen() //全屏
      this.$refs['econDraw'].handleRender()// 重新render
      // 外层div包围盒宽高改变需要执行 handlefitBounding 方法
      // this.$refs['econDraw'].handlefitBounding()// 适应外面的包围盒
    },
    handleClick(data, object) {
      // data 当前图元的全部数据
      // object 当前动作的数据
        console.log(data,object);
      }
    },
    handleGetComponents(components) {
      components[0].set('fill', 'red') //给第一个组件设置 填充红色
      this.$refs['econDraw'].handleRender()//属性修改需要执行 handleRender
    }
  }
}

handleClick object 数据

{
  type: "click", //click: 单击事件, dblclick:双击事件, mouserover: 鼠标移入, mouseout: 鼠标移出
  action: "",// dialog: 打开弹窗,control: 控制下发, link: 打开链接,  page: 打开页面, custom: 自定义
  value: "value",
  name: "name",
}

handleClick data 属性

angle: 0;
backgroundColor: "";
customEvents: [];
fill: "rgba(80, 227, 194, 1)";
fillRule: "nonzero";
flipX: false;
flipY: false;
globalCompositeOperation: "source-over";
height: 40;
id: "m21aurd6";
left: 765.65;
opacity: 1;
originX: "center";
originY: "center";
paintFirst: "fill";
rx: "5";
ry: "5";
scaleX: 1;
scaleY: 1;
shadow: null;
skewX: 0;
skewY: 0;
stroke: "#000";
strokeDashArray: null;
strokeDashOffset: 0;
strokeLineCap: "butt";
strokeLineJoin: "miter";
strokeMiterLimit: 4;
strokeUniform: true;
strokeWidth: 1;
tag: "";
top: 386.01;
type: "ecRect";
version: "5.0.0";
visible: true;
width: 100;
1.2.2

1 month ago

1.2.1

1 month ago

1.2.0

5 months ago

1.1.9

6 months ago

1.1.8

6 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.1.1

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.0.10

8 months ago

1.0.2

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.1

9 months ago

0.6.3

2 years ago

0.6.4

2 years ago

0.5.6

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.9

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.9

2 years ago

0.4.8

2 years ago

0.5.4

2 years ago

0.4.5

2 years ago

0.5.3

2 years ago

0.4.4

2 years ago

0.4.7

2 years ago

0.5.5

2 years ago

0.4.6

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.4.3

2 years ago

0.5.1

2 years ago

0.3.9

2 years ago

0.3.6

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.4

2 years ago

0.4.2

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.1

2 years ago

0.2.3

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago