From 2aadce35223343b959865827e4ec2d58aefb6bc2 Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Tue, 10 Sep 2024 15:32:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=89=8D=E7=AB=AFeslint=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83=20#12=20#=20Reviewed,=20transaction?= =?UTF-8?q?=20id:=2017922?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProcessCanvas/components/dnd/index.vue | 3 +- .../components/shortcutPanel.vue | 10 +-- .../src/components/ProcessCanvas/index.vue | 33 ++++---- .../components/shortcutPanel.vue | 8 +- .../src/components/VerticalCanvas/index.vue | 2 +- .../components/layout/NavigationHeadRight.vue | 6 +- frontend/src/config/i18n/cn.js | 8 +- frontend/src/config/i18n/en.js | 10 +-- frontend/src/main.js | 2 +- frontend/src/store/modules/template.js | 11 ++- .../task/TaskExecute/TaskOperationHeader.vue | 5 +- .../views/task/TaskExecute/taskCondition.vue | 14 ++-- .../template/TemplateEdit/ConditionEdit.vue | 9 +- .../NodeConfig/JsonschemaInputParams.vue | 17 ---- .../components/ConditionExpression.vue | 83 +++++++++++++++++++ .../src/views/template/TemplateEdit/index.vue | 6 +- .../MockSetting/components/MockConfig.vue | 2 +- 17 files changed, 149 insertions(+), 80 deletions(-) create mode 100644 frontend/src/views/template/TemplateEdit/components/ConditionExpression.vue diff --git a/frontend/src/components/ProcessCanvas/components/dnd/index.vue b/frontend/src/components/ProcessCanvas/components/dnd/index.vue index 373cdf3..30cc9a8 100644 --- a/frontend/src/components/ProcessCanvas/components/dnd/index.vue +++ b/frontend/src/components/ProcessCanvas/components/dnd/index.vue @@ -11,8 +11,7 @@ node.id === 'group' ? 'group-node' : `common-icon-node-${node.icon}`, { disabled: ['start', 'end'].includes(node.id) }, ]" - :data-type="node.id"> - + :data-type="node.id" /> diff --git a/frontend/src/components/ProcessCanvas/components/shortcutPanel.vue b/frontend/src/components/ProcessCanvas/components/shortcutPanel.vue index ef141a2..378ce19 100644 --- a/frontend/src/components/ProcessCanvas/components/shortcutPanel.vue +++ b/frontend/src/components/ProcessCanvas/components/shortcutPanel.vue @@ -101,7 +101,7 @@ startNode: state => state.template.start_event, endNode: state => state.template.end_event, }), - nodeTypeList () { + nodeTypeList() { const list = [ { key: 'tasknode', id: 'task', tips: this.$t('标准插件节点') }, // { key: 'subflow', id: 'subflow', tips: '子流程节点' }, @@ -109,11 +109,11 @@ { key: 'parallelgateway', id: 'parallel-gateway', tips: this.$t('并行网关') }, { key: 'conditionalparallelgateway', id: 'conditional-parallel-gateway', tips: this.$t('条件并行网关') }, { key: 'convergegateway', id: 'converge-gateway', tips: this.$t('汇聚网关') }, - ] + ]; if (this.activeCell.data.type === 'parallel-gateway') { - return list.filter(item => item.id !== 'converge-gateway') + return list.filter(item => item.id !== 'converge-gateway'); } - return list + return list; }, branchConditions() { const branchConditions = {}; @@ -234,7 +234,7 @@ }); } else if (specialType.indexOf(currLoc.type) > -1 && isHaveNodeBehind) { // 如果网管分支已有输出连线则后续连线输出端点都由bottom出发 - edges[0].source.port = 'port_bottom' + edges[0].source.port = 'port_bottom'; // 拿到并行中最靠下的节点 const { x: parallelX, y: parallelY } = this.getParallelNodeMinDistance(id); location.y = parallelY + 100; diff --git a/frontend/src/components/ProcessCanvas/index.vue b/frontend/src/components/ProcessCanvas/index.vue index 8a7afc7..34dfe59 100644 --- a/frontend/src/components/ProcessCanvas/index.vue +++ b/frontend/src/components/ProcessCanvas/index.vue @@ -1006,17 +1006,16 @@ if (branchInfo && Object.keys(branchInfo).length > 0) { const conditionInfo = cell.data?.conditionInfo || branchInfo[cell.id] || {}; if (!Object.keys(conditionInfo).length) return; - const { width: edgeWidth } = cell.getBBox() const textDom = document.createElement('span'); textDom.innerText = conditionInfo.name; textDom.style.fontSize = '12px'; textDom.style.padding = '0 6px'; document.body.appendChild(textDom); let { width = 0 } = textDom.getBoundingClientRect(); - width = width > 60 ? width : 60 + width = width > 60 ? width : 60; width = width > 112 ? 112 : width; document.body.removeChild(textDom); - const distance = conditionInfo.loc || (-width/2 - 20) + const distance = conditionInfo.loc || (-width / 2 - 20); cell.appendLabel({ markup: Markup.getForeignObjectMarkup(), attrs: { @@ -1035,9 +1034,9 @@ position: { distance, offset: { - x: width/2, + x: width / 2, y: 0, - } + }, }, }); } @@ -1065,22 +1064,22 @@ return branchConditions; }, // 标签拖拽 - handleLabelDrag ({ edge, current, previous }) { - if (!previous || !previous.length || !current.length) return + handleLabelDrag({ edge, current, previous }) { + if (!previous || !previous.length || !current.length) return; // 边的长度 - const svgPath = this.getNodeElement(`.${edge.id}`) - const edgeLength = svgPath.getTotalLength() + const svgPath = this.getNodeElement(`.${edge.id}`); + const edgeLength = svgPath.getTotalLength(); current.forEach((item) => { - const { width } = item.attrs.fo + const { width } = item.attrs.fo; item.position.offset = { x: width / 2, - y: 0 + y: 0, }; // 限制label.position.distance的值在min到max之间 - const min = (width / 2 + 20) / edgeLength - const max = 1 - min - const distance = Math.max(min, Math.min(max, item.position.distance)) - item.position.distance = distance + const min = (width / 2 + 20) / edgeLength; + const max = 1 - min; + const distance = Math.max(min, Math.min(max, item.position.distance)); + item.position.distance = distance; // 更新本地condition配置 const condition = { ...item.label, @@ -1177,7 +1176,7 @@ const canvasDom = this.getNodeElement(); const { left: canvasLeft, top: canvasTop } = canvasDom.getBoundingClientRect(); // dnd侧栏宽度 - const dndWidth = this.showPalette ? 60 : 0 + const dndWidth = this.showPalette ? 60 : 0; // 200节点的气泡卡片展示最小宽度 const bodyWidth = document.body.offsetWidth; const isRight = bodyWidth - nodeRight > 200; @@ -1262,7 +1261,7 @@ svgCloneDom.style.width = `${canvasWidth}px`; svgCloneDom.style.height = `${canvasHeight}px`; const viewCloneDom = clone.querySelector('.x6-graph-svg-viewport'); - viewCloneDom.style.transform = `translate(${offsetX + 30 + 'px'}, ${offsetY + 30 + 'px'})`; + viewCloneDom.style.transform = `translate(${`${offsetX + 30}px`}, ${`${offsetY + 30}px`})`; }, }); }, diff --git a/frontend/src/components/VerticalCanvas/components/shortcutPanel.vue b/frontend/src/components/VerticalCanvas/components/shortcutPanel.vue index 7727e71..6ea96ce 100644 --- a/frontend/src/components/VerticalCanvas/components/shortcutPanel.vue +++ b/frontend/src/components/VerticalCanvas/components/shortcutPanel.vue @@ -76,7 +76,7 @@ startNode: state => state.template.start_event, endNode: state => state.template.end_event, }), - nodeTypeList () { + nodeTypeList() { const list = [ { key: 'tasknode', id: 'task', tips: this.$t('标准插件节点') }, // { key: 'subflow', id: 'subflow', tips: '子流程节点' }, @@ -84,11 +84,11 @@ { key: 'parallelgateway', id: 'parallel-gateway', tips: this.$t('并行网关') }, { key: 'conditionalparallelgateway', id: 'conditional-parallel-gateway', tips: this.$t('条件并行网关') }, { key: 'convergegateway', id: 'converge-gateway', tips: this.$t('汇聚网关') }, - ] + ]; if (this.activeCell.data.type === 'parallel-gateway') { - return list.filter(item => item.id !== 'converge-gateway') + return list.filter(item => item.id !== 'converge-gateway'); } - return list + return list; }, branchConditions() { const branchConditions = {}; diff --git a/frontend/src/components/VerticalCanvas/index.vue b/frontend/src/components/VerticalCanvas/index.vue index 4f092b0..059824d 100644 --- a/frontend/src/components/VerticalCanvas/index.vue +++ b/frontend/src/components/VerticalCanvas/index.vue @@ -807,7 +807,7 @@ svgCloneDom.style.width = `${canvasWidth}px`; svgCloneDom.style.height = `${canvasHeight}px`; const viewCloneDom = clone.querySelector('.x6-graph-svg-viewport'); - viewCloneDom.style.transform = `translate(${offsetX + 30 + 'px'}, ${offsetY + 30 + 'px'})`; + viewCloneDom.style.transform = `translate(${`${offsetX + 30}px`}, ${`${offsetY + 30}px`})`; }, }); }, diff --git a/frontend/src/components/layout/NavigationHeadRight.vue b/frontend/src/components/layout/NavigationHeadRight.vue index 1a97326..99877d9 100644 --- a/frontend/src/components/layout/NavigationHeadRight.vue +++ b/frontend/src/components/layout/NavigationHeadRight.vue @@ -52,15 +52,15 @@
{{ $t('makoOperates') }}
+{{ $t('支持 "and、or、not、True、False" 等 MAKO 关键字语法') }}
+{{ $t('支持直接引用全局变量') }}
+{{ $t('使用内置函数、datetime、re、hashlib、random、time、os.path模块处理全局变量') }}
+{{ $t('示例:') }}
+{{ $t('假设 key 是值为 "3" 的全局变量') }}
+{{ $t('字符串比较:') }}key == "3"
{{ $t('数值比较:') }}int(key) >= 3
{{ $t('包含:') }}int(key) in (1,2,3)
{{ $t('feelOperates') }}
+{{ $t('支持 "and、or、true、false" 等关键字语法') }}
+{{ $t('支持 FEEL (Friendly Enough Expression Language) 基础语法') }}
+{{ $t('支持使用全局变量,如') }}${key}
、${int(key)}
{{ $t('${}中支持使用内置函数、datetime、re、hashlib、random、time、os.path模块处理全局变量') }}
+{{ $t('示例:') }}
+{{ $t('字符串比较:') }}"${key}" = "my string"
{{ $t('数值比较:') }}${int(key)} >= 3
{{ $t('包含:') }}list contains([1, 2, 3], ${int(key)})
{{ $t('makoOperates') }}
+{{ $t('支持 "and、or、True/true、False/false" 等关键字语法') }}
+
+ {{ $t('表达式更多细节请参考') }}
+
{{ $t('支持使用全局变量,如') }}${key}
、${int(key)}
{{ $t('支持使用内置函数、datetime、re、hashlib、random、time、os.path模块处理全局变量') }}
+{{ $t('示例:') }}
+{{ $t('字符串比较:') }}"${key}" == "my string"
{{ $t('数值比较:') }}${int(key)} >= 3
{{ $t('包含:') }}${key} in (1,2,3)