Commit 08f77e51 by 吴斌

Fix UI overlap issue and enable rule execution

parent 875f2e49
...@@ -562,7 +562,6 @@ function listenDiagram(){ ...@@ -562,7 +562,6 @@ function listenDiagram(){
myDiagram.addModelChangedListener(function(e:any){ myDiagram.addModelChangedListener(function(e:any){
if (e.isTransactionFinished) { if (e.isTransactionFinished) {
deviceMap.value = getDiagramMapData(myDiagram) deviceMap.value = getDiagramMapData(myDiagram)
runAllEnableRule(deviceMap.value)
} }
}) })
} }
...@@ -776,6 +775,7 @@ function changeDeviceData(){ ...@@ -776,6 +775,7 @@ function changeDeviceData(){
} }
) )
myDiagram.commitTransaction('changeDeviceData') myDiagram.commitTransaction('changeDeviceData')
runAllEnableRule(deviceMap.value)
} }
function changeDataRealTime(){ function changeDataRealTime(){
......
...@@ -40,11 +40,6 @@ export function makeShapeNode (stretch: typeof go.GraphObject.Fill = go.GraphObj ...@@ -40,11 +40,6 @@ export function makeShapeNode (stretch: typeof go.GraphObject.Fill = go.GraphObj
) )
} }
//
// export function makeGONode(){
// return GO(go.Shape, )
// }
/* /*
* 不同类型返回不同的节点模板 * 不同类型返回不同的节点模板
*/ */
......
...@@ -120,7 +120,10 @@ export function runRule(rule: any, deviceMap: Record<string, any>) { ...@@ -120,7 +120,10 @@ export function runRule(rule: any, deviceMap: Record<string, any>) {
export function runAllEnableRule(deviceMap: Record<string, any>) { export function runAllEnableRule(deviceMap: Record<string, any>) {
rules.forEach((item: any) => { rules.forEach((item: any) => {
if (item['enable'].toString() === 'true') { if (item['enable'].toString() === 'true') {
// 为了避免触发Notification的时间一样,会导致UI重叠,所以使用setTimeout添加延迟。
setTimeout(()=>{
runRule(item, deviceMap) runRule(item, deviceMap)
}, 1)
} }
}) })
} }
...@@ -205,10 +208,8 @@ export function runLua(rule: any, inputData: any) { ...@@ -205,10 +208,8 @@ export function runLua(rule: any, inputData: any) {
${rule['func']} ${rule['func']}
end end
` `
let luaFunction = fengari.load(codeString) let luaFunction = fengari.load(codeString)
return luaFunction().call(inputData) return luaFunction().call(inputData)
} catch (e) { } catch (e) {
alert(e) alert(e)
} }
......
...@@ -4,6 +4,7 @@ import gojs from 'gojs' ...@@ -4,6 +4,7 @@ import gojs from 'gojs'
import ElementUI from 'element-plus'; import ElementUI from 'element-plus';
import * as ElementPlusIconsVue from '@element-plus/icons-vue' import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import "element-plus/theme-chalk/index.css" import "element-plus/theme-chalk/index.css"
import './style/element-plus/custom.css'
import 'virtual:uno.css' import 'virtual:uno.css'
import './assets/iconfont/iconfont.css' import './assets/iconfont/iconfont.css'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment