gongzijian 6 years ago
parent
commit
f9b1ef0bf5
  1. 12
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  2. 29
      escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js

12
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -178,7 +178,7 @@
import mShell from './tasks/shell'
import mSpark from './tasks/spark'
import mPython from './tasks/python'
import { isNameExDag } from './../plugIn/util'
import { isNameExDag,rtBantpl } from './../plugIn/util'
import JSP from './../plugIn/jsPlumbHandle'
import mProcedure from './tasks/procedure'
import mDependent from './tasks/dependent'
@ -383,7 +383,15 @@
})
}
},
watch: {},
watch: {
runFlag(val){
let dom = $(`#${this.id}`).find('.ban-p')
dom.html('')
if (val === 'FORBIDDEN') {
dom.append(rtBantpl())
}
}
},
created () {
// Unbind copy and paste events
JSP.removePaste()

29
escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js

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

Loading…
Cancel
Save