|
|
@ -21,7 +21,7 @@ import i18n from '@/module/i18n' |
|
|
|
import store from '@/conf/home/store' |
|
|
|
import store from '@/conf/home/store' |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 节点,转数组 |
|
|
|
* Node, to array |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const rtTargetarrArr = (id) => { |
|
|
|
const rtTargetarrArr = (id) => { |
|
|
|
let a = $(`#${id}`).attr('data-targetarr') |
|
|
|
let a = $(`#${id}`).attr('data-targetarr') |
|
|
@ -29,7 +29,7 @@ const rtTargetarrArr = (id) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 存储节点id到targetarr |
|
|
|
* Store node id to targetarr |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const saveTargetarr = (valId, domId) => { |
|
|
|
const saveTargetarr = (valId, domId) => { |
|
|
|
let $target = $(`#${domId}`) |
|
|
|
let $target = $(`#${domId}`) |
|
|
@ -37,8 +37,12 @@ const saveTargetarr = (valId, domId) => { |
|
|
|
$target.attr('data-targetarr', targetStr) |
|
|
|
$target.attr('data-targetarr', targetStr) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rtBantpl = () => { |
|
|
|
|
|
|
|
return `<i class="iconfont" data-toggle="tooltip" data-html="true" data-container="body" data-placement="left" title="${i18n.$t('禁止执行')}"></i>` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回节点html |
|
|
|
* return node html |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType,runFlag }) => { |
|
|
|
const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType,runFlag }) => { |
|
|
|
let tpl = `` |
|
|
|
let tpl = `` |
|
|
@ -51,7 +55,7 @@ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType,runFlag |
|
|
|
tpl += `<div class="ep"></div>` |
|
|
|
tpl += `<div class="ep"></div>` |
|
|
|
tpl += `<div class="ban-p">` |
|
|
|
tpl += `<div class="ban-p">` |
|
|
|
if (runFlag === 'FORBIDDEN') { |
|
|
|
if (runFlag === 'FORBIDDEN') { |
|
|
|
tpl += `<i class="iconfont" data-toggle="tooltip" data-html="true" data-container="body" data-placement="left" title="${i18n.$t('禁止执行')}"></i>` |
|
|
|
tpl += rtBantpl() |
|
|
|
} |
|
|
|
} |
|
|
|
tpl += `</div>` |
|
|
|
tpl += `</div>` |
|
|
|
tpl += `</div>` |
|
|
|
tpl += `</div>` |
|
|
@ -60,7 +64,7 @@ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType,runFlag |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取所有tasks节点 |
|
|
|
* Get all tasks nodes |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const tasksAll = () => { |
|
|
|
const tasksAll = () => { |
|
|
|
let a = [] |
|
|
|
let a = [] |
|
|
@ -78,8 +82,8 @@ const tasksAll = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 判断 name 是否在当前的dag图中 |
|
|
|
* Determine if name is in the current dag map |
|
|
|
* rely dom / backfill dom元素 回填 |
|
|
|
* rely dom / backfill |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const isNameExDag = (name, rely) => { |
|
|
|
const isNameExDag = (name, rely) => { |
|
|
|
if (rely === 'dom') { |
|
|
|
if (rely === 'dom') { |
|
|
@ -90,17 +94,17 @@ const isNameExDag = (name, rely) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 更改svg线条颜色 |
|
|
|
* Change svg line color |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const setSvgColor = (e, color) => { |
|
|
|
const setSvgColor = (e, color) => { |
|
|
|
// 遍历 清除所有颜色
|
|
|
|
// Traverse clear all colors
|
|
|
|
$('.jtk-connector').each((i, o) => { |
|
|
|
$('.jtk-connector').each((i, o) => { |
|
|
|
_.map($(o)[0].childNodes, v => { |
|
|
|
_.map($(o)[0].childNodes, v => { |
|
|
|
$(v).attr('fill', '#555').attr('stroke', '#555').attr('stroke-width', 2) |
|
|
|
$(v).attr('fill', '#555').attr('stroke', '#555').attr('stroke-width', 2) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 给选择的添加颜色
|
|
|
|
// Add color to the selection
|
|
|
|
_.map($(e.canvas)[0].childNodes, (v, i) => { |
|
|
|
_.map($(e.canvas)[0].childNodes, (v, i) => { |
|
|
|
$(v).attr('fill', color).attr('stroke', color) |
|
|
|
$(v).attr('fill', color).attr('stroke', color) |
|
|
|
if ($(v).attr('class')) { |
|
|
|
if ($(v).attr('class')) { |
|
|
@ -110,7 +114,7 @@ const setSvgColor = (e, color) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取所有节点id |
|
|
|
* Get all node ids |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const allNodesId = () => { |
|
|
|
const allNodesId = () => { |
|
|
|
let idArr = [] |
|
|
|
let idArr = [] |
|
|
@ -134,5 +138,6 @@ export { |
|
|
|
tasksAll, |
|
|
|
tasksAll, |
|
|
|
isNameExDag, |
|
|
|
isNameExDag, |
|
|
|
setSvgColor, |
|
|
|
setSvgColor, |
|
|
|
allNodesId |
|
|
|
allNodesId, |
|
|
|
|
|
|
|
rtBantpl |
|
|
|
} |
|
|
|
} |
|
|
|