ProcessViewer.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <template>
  2. <div class="my-process-designer">
  3. <div class="my-process-designer__container">
  4. <div class="my-process-designer__canvas" style="height: 760px" ref="bpmnCanvas"></div>
  5. </div>
  6. </div>
  7. </template>
  8. <script lang="ts" setup>
  9. import BpmnViewer from 'bpmn-js/lib/Viewer'
  10. import DefaultEmptyXML from './plugins/defaultEmpty'
  11. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  12. import { formatDate } from '@/utils/formatTime'
  13. import { isEmpty } from '@/utils/is'
  14. defineOptions({ name: 'MyProcessViewer' })
  15. const props = defineProps({
  16. value: {
  17. // BPMN XML 字符串
  18. type: String,
  19. default: ''
  20. },
  21. prefix: {
  22. // 使用哪个引擎
  23. type: String,
  24. default: 'camunda'
  25. },
  26. activityData: {
  27. // 活动的数据。传递时,可高亮流程
  28. type: Array,
  29. default: () => []
  30. },
  31. processInstanceData: {
  32. // 流程实例的数据。传递时,可展示流程发起人等信息
  33. type: Object,
  34. default: () => {}
  35. },
  36. taskData: {
  37. // 任务实例的数据。传递时,可展示 UserTask 审核相关的信息
  38. type: Array,
  39. default: () => []
  40. }
  41. })
  42. provide('configGlobal', props)
  43. const emit = defineEmits(['destroy'])
  44. let bpmnModeler
  45. const xml = ref('')
  46. const activityLists = ref<any[]>([])
  47. const processInstance = ref<any>(undefined)
  48. const taskList = ref<any[]>([])
  49. const bpmnCanvas = ref()
  50. // const element = ref()
  51. const elementOverlayIds = ref<any>(null)
  52. const overlays = ref<any>(null)
  53. const initBpmnModeler = () => {
  54. if (bpmnModeler) return
  55. bpmnModeler = new BpmnViewer({
  56. container: bpmnCanvas.value,
  57. bpmnRenderer: {}
  58. })
  59. }
  60. /* 创建新的流程图 */
  61. const createNewDiagram = async (xml) => {
  62. // 将字符串转换成图显示出来
  63. let newId = `Process_${new Date().getTime()}`
  64. let newName = `业务流程_${new Date().getTime()}`
  65. let xmlString = xml || DefaultEmptyXML(newId, newName, props.prefix)
  66. try {
  67. let { warnings } = await bpmnModeler.importXML(xmlString)
  68. if (warnings && warnings.length) {
  69. warnings.forEach((warn) => console.warn(warn))
  70. }
  71. // 高亮流程图
  72. await highlightDiagram()
  73. const canvas = bpmnModeler.get('canvas')
  74. canvas.zoom('fit-viewport', 'auto')
  75. } catch (e) {
  76. console.error(e)
  77. // console.error(`[Process Designer Warn]: ${e?.message || e}`);
  78. }
  79. }
  80. /* 高亮流程图 */
  81. // TODO 芋艿:如果多个 endActivity 的话,目前的逻辑可能有一定的问题。https://www.jdon.com/workflow/multi-events.html
  82. const highlightDiagram = async () => {
  83. const activityList = activityLists.value
  84. if (activityList.length === 0) {
  85. return
  86. }
  87. // 参考自 https://gitee.com/tony2y/RuoYi-flowable/blob/master/ruoyi-ui/src/components/Process/index.vue#L222 实现
  88. // 再次基础上,增加不同审批结果的颜色等等
  89. let canvas = bpmnModeler.get('canvas')
  90. let todoActivity: any = activityList.find((m: any) => !m.endTime) // 找到待办的任务
  91. let endActivity: any = activityList[activityList.length - 1] // 获得最后一个任务
  92. let findProcessTask = false //是否已经高亮了进行中的任务
  93. //进行中高亮之后的任务 key 集合,用于过滤掉 taskList 进行中后面的任务,避免进行中后面的数据 Hover 还有数据
  94. let removeTaskDefinitionKeyList = []
  95. // debugger
  96. bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach((n: any) => {
  97. let activity: any = activityList.find((m: any) => m.key === n.id) // 找到对应的活动
  98. if (!activity) {
  99. return
  100. }
  101. if (n.$type === 'bpmn:UserTask') {
  102. // 用户任务
  103. // 处理用户任务的高亮
  104. const task: any = taskList.value.find((m: any) => m.id === activity.taskId) // 找到活动对应的 taskId
  105. if (!task) {
  106. return
  107. }
  108. // 进行中的任务已经高亮过了,则不高亮后面的任务了
  109. if (findProcessTask) {
  110. removeTaskDefinitionKeyList.push(n.id)
  111. return
  112. }
  113. // 高亮任务
  114. canvas.addMarker(n.id, getResultCss(task.status))
  115. //标记是否高亮了进行中任务
  116. if (task.status === 1) {
  117. findProcessTask = true
  118. }
  119. // 如果非通过,就不走后面的线条了
  120. if (task.status !== 2) {
  121. return
  122. }
  123. // 处理 outgoing 出线
  124. const outgoing = getActivityOutgoing(activity)
  125. outgoing?.forEach((nn: any) => {
  126. // debugger
  127. let targetActivity: any = activityList.find((m: any) => m.key === nn.targetRef.id)
  128. // 如果目标活动存在,则根据该活动是否结束,进行【bpmn:SequenceFlow】连线的高亮设置
  129. if (targetActivity) {
  130. canvas.addMarker(nn.id, targetActivity.endTime ? 'highlight' : 'highlight-todo')
  131. } else if (nn.targetRef.$type === 'bpmn:ExclusiveGateway') {
  132. // TODO 芋艿:这个流程,暂时没走到过
  133. canvas.addMarker(nn.id, activity.endTime ? 'highlight' : 'highlight-todo')
  134. canvas.addMarker(nn.targetRef.id, activity.endTime ? 'highlight' : 'highlight-todo')
  135. } else if (nn.targetRef.$type === 'bpmn:EndEvent') {
  136. // TODO 芋艿:这个流程,暂时没走到过
  137. if (!todoActivity && endActivity.key === n.id) {
  138. canvas.addMarker(nn.id, 'highlight')
  139. canvas.addMarker(nn.targetRef.id, 'highlight')
  140. }
  141. if (!activity.endTime) {
  142. canvas.addMarker(nn.id, 'highlight-todo')
  143. canvas.addMarker(nn.targetRef.id, 'highlight-todo')
  144. }
  145. }
  146. })
  147. } else if (n.$type === 'bpmn:ExclusiveGateway') {
  148. // 排它网关
  149. // 设置【bpmn:ExclusiveGateway】排它网关的高亮
  150. canvas.addMarker(n.id, getActivityHighlightCss(activity))
  151. // 查找需要高亮的连线
  152. let matchNN: any = undefined
  153. let matchActivity: any = undefined
  154. n.outgoing?.forEach((nn: any) => {
  155. let targetActivity = activityList.find((m: any) => m.key === nn.targetRef.id)
  156. if (!targetActivity) {
  157. return
  158. }
  159. // 特殊判断 endEvent 类型的原因,ExclusiveGateway 可能后续连有 2 个路径:
  160. // 1. 一个是 UserTask => EndEvent
  161. // 2. 一个是 EndEvent
  162. // 在选择路径 1 时,其实 EndEvent 可能也存在,导致 1 和 2 都高亮,显然是不正确的。
  163. // 所以,在 matchActivity 为 EndEvent 时,需要进行覆盖~~
  164. if (!matchActivity || matchActivity.type === 'endEvent') {
  165. matchNN = nn
  166. matchActivity = targetActivity
  167. }
  168. })
  169. if (matchNN && matchActivity) {
  170. canvas.addMarker(matchNN.id, getActivityHighlightCss(matchActivity))
  171. }
  172. } else if (n.$type === 'bpmn:ParallelGateway') {
  173. // 并行网关
  174. // 设置【bpmn:ParallelGateway】并行网关的高亮
  175. canvas.addMarker(n.id, getActivityHighlightCss(activity))
  176. n.outgoing?.forEach((nn: any) => {
  177. // 获得连线是否有指向目标。如果有,则进行高亮
  178. const targetActivity = activityList.find((m: any) => m.key === nn.targetRef.id)
  179. if (targetActivity) {
  180. canvas.addMarker(nn.id, getActivityHighlightCss(targetActivity)) // 高亮【bpmn:SequenceFlow】连线
  181. // 高亮【...】目标。其中 ... 可以是 bpm:UserTask、也可以是其它的。当然,如果是 bpm:UserTask 的话,其实不做高亮也没问题,因为上面有逻辑做了这块。
  182. canvas.addMarker(nn.targetRef.id, getActivityHighlightCss(targetActivity))
  183. }
  184. })
  185. } else if (n.$type === 'bpmn:StartEvent') {
  186. // 开始节点
  187. canvas.addMarker(n.id, 'highlight')
  188. n.outgoing?.forEach((nn) => {
  189. // outgoing 例如说【bpmn:SequenceFlow】连线
  190. // 获得连线是否有指向目标。如果有,则进行高亮
  191. let targetActivity = activityList.find((m: any) => m.key === nn.targetRef.id)
  192. if (targetActivity) {
  193. canvas.addMarker(nn.id, 'highlight') // 高亮【bpmn:SequenceFlow】连线
  194. canvas.addMarker(n.id, 'highlight') // 高亮【bpmn:StartEvent】开始节点(自己)
  195. }
  196. })
  197. } else if (n.$type === 'bpmn:EndEvent') {
  198. // 结束节点
  199. if (!processInstance.value || processInstance.value.status === 1) {
  200. return
  201. }
  202. canvas.addMarker(n.id, getResultCss(processInstance.value.status))
  203. } else if (n.$type === 'bpmn:ServiceTask') {
  204. //服务任务
  205. if (activity.startTime > 0 && activity.endTime === 0) {
  206. //进入执行,标识进行色
  207. canvas.addMarker(n.id, getResultCss(1))
  208. }
  209. if (activity.endTime > 0) {
  210. // 执行完成,节点标识完成色, 所有outgoing标识完成色。
  211. canvas.addMarker(n.id, getResultCss(2))
  212. const outgoing = getActivityOutgoing(activity)
  213. outgoing?.forEach((out) => {
  214. canvas.addMarker(out.id, getResultCss(2))
  215. })
  216. }
  217. } else if (n.$type === 'bpmn:SequenceFlow') {
  218. let targetActivity = activityList.find((m: any) => m.key === n.targetRef.id)
  219. if (targetActivity) {
  220. canvas.addMarker(n.id, getActivityHighlightCss(targetActivity))
  221. }
  222. }
  223. })
  224. if (!isEmpty(removeTaskDefinitionKeyList)) {
  225. taskList.value = taskList.value.filter(
  226. (item) => !removeTaskDefinitionKeyList.includes(item.taskDefinitionKey)
  227. )
  228. }
  229. }
  230. const getActivityHighlightCss = (activity) => {
  231. return activity.endTime ? 'highlight' : 'highlight-todo'
  232. }
  233. const getResultCss = (status) => {
  234. if (status === 1) {
  235. // 审批中
  236. return 'highlight-todo'
  237. } else if (status === 2) {
  238. // 已通过
  239. return 'highlight'
  240. } else if (status === 3) {
  241. // 不通过
  242. return 'highlight-reject'
  243. } else if (status === 4) {
  244. // 已取消
  245. return 'highlight-cancel'
  246. } else if (status === 5) {
  247. // 退回
  248. return 'highlight-return'
  249. } else if (status === 6) {
  250. // 委派
  251. return 'highlight-todo'
  252. } else if (status === 7) {
  253. // 审批通过中
  254. return 'highlight-todo'
  255. } else if (status === 0) {
  256. // 待审批
  257. return 'highlight-todo'
  258. }
  259. return ''
  260. }
  261. const getActivityOutgoing = (activity) => {
  262. // 如果有 outgoing,则直接使用它
  263. if (activity.outgoing && activity.outgoing.length > 0) {
  264. return activity.outgoing
  265. }
  266. // 如果没有,则遍历获得起点为它的【bpmn:SequenceFlow】节点们。原因是:bpmn-js 的 UserTask 拿不到 outgoing
  267. const flowElements = bpmnModeler.getDefinitions().rootElements[0].flowElements
  268. const outgoing: any[] = []
  269. flowElements.forEach((item: any) => {
  270. if (item.$type !== 'bpmn:SequenceFlow') {
  271. return
  272. }
  273. if (item.sourceRef.id === activity.key) {
  274. outgoing.push(item)
  275. }
  276. })
  277. return outgoing
  278. }
  279. const initModelListeners = () => {
  280. const EventBus = bpmnModeler.get('eventBus')
  281. // 注册需要的监听事件
  282. EventBus.on('element.hover', function (eventObj) {
  283. let element = eventObj ? eventObj.element : null
  284. elementHover(element)
  285. })
  286. EventBus.on('element.out', function (eventObj) {
  287. let element = eventObj ? eventObj.element : null
  288. elementOut(element)
  289. })
  290. }
  291. // 流程图的元素被 hover
  292. const elementHover = (element) => {
  293. element.value = element
  294. !elementOverlayIds.value && (elementOverlayIds.value = {})
  295. !overlays.value && (overlays.value = bpmnModeler.get('overlays'))
  296. // 展示信息
  297. // console.log(activityLists.value, 'activityLists.value')
  298. // console.log(element.value, 'element.value')
  299. const activity = activityLists.value.find((m) => m.key === element.value.id)
  300. // console.log(activity, 'activityactivityactivityactivity')
  301. if (!activity) {
  302. return
  303. }
  304. if (!elementOverlayIds.value[element.value.id] && element.value.type !== 'bpmn:Process') {
  305. let html = `<div class="element-overlays">
  306. <p>Elemet id: ${element.value.id}</p>
  307. <p>Elemet type: ${element.value.type}</p>
  308. </div>` // 默认值
  309. if (element.value.type === 'bpmn:StartEvent' && processInstance.value) {
  310. html = `<p>发起人:${processInstance.value.startUser.nickname}</p>
  311. <p>部门:${processInstance.value.startUser.deptName}</p>
  312. <p>创建时间:${formatDate(processInstance.value.createTime)}`
  313. } else if (element.value.type === 'bpmn:UserTask') {
  314. let task = taskList.value.find((m) => m.id === activity.taskId) // 找到活动对应的 taskId
  315. if (!task) {
  316. return
  317. }
  318. let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS)
  319. let dataResult = ''
  320. optionData.forEach((element) => {
  321. if (element.value == task.status) {
  322. dataResult = element.label
  323. }
  324. })
  325. html = `<p>审批人:${task.assigneeUser.nickname}</p>
  326. <p>部门:${task.assigneeUser.deptName}</p>
  327. <p>结果:${dataResult}</p>
  328. <p>创建时间:${formatDate(task.createTime)}</p>`
  329. // html = `<p>审批人:${task.assigneeUser.nickname}</p>
  330. // <p>部门:${task.assigneeUser.deptName}</p>
  331. // <p>结果:${getIntDictOptions(
  332. // DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
  333. // task.status
  334. // )}</p>
  335. // <p>创建时间:${formatDate(task.createTime)}</p>`
  336. if (task.endTime) {
  337. html += `<p>结束时间:${formatDate(task.endTime)}</p>`
  338. }
  339. if (task.reason) {
  340. html += `<p>审批建议:${task.reason}</p>`
  341. }
  342. } else if (element.value.type === 'bpmn:ServiceTask' && processInstance.value) {
  343. if (activity.startTime > 0) {
  344. html = `<p>创建时间:${formatDate(activity.startTime)}</p>`
  345. }
  346. if (activity.endTime > 0) {
  347. html += `<p>结束时间:${formatDate(activity.endTime)}</p>`
  348. }
  349. console.log(html)
  350. } else if (element.value.type === 'bpmn:EndEvent' && processInstance.value) {
  351. let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS)
  352. let dataResult = ''
  353. optionData.forEach((element) => {
  354. if (element.value == processInstance.value.status) {
  355. dataResult = element.label
  356. }
  357. })
  358. html = `<p>结果:${dataResult}</p>`
  359. // html = `<p>结果:${getIntDictOptions(
  360. // DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
  361. // processInstance.value.status
  362. // )}</p>`
  363. if (processInstance.value.endTime) {
  364. html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
  365. }
  366. }
  367. // console.log(html, 'html111111111111111')
  368. elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, {
  369. position: { left: 0, bottom: 0 },
  370. html: `<div class="element-overlays">${html}</div>`
  371. })
  372. }
  373. }
  374. // 流程图的元素被 out
  375. const elementOut = (element) => {
  376. toRaw(overlays.value).remove({ element })
  377. elementOverlayIds.value[element.id] = null
  378. }
  379. onMounted(() => {
  380. xml.value = props.value
  381. activityLists.value = props.activityData
  382. // 初始化
  383. initBpmnModeler()
  384. createNewDiagram(xml.value)
  385. // 初始模型的监听器
  386. initModelListeners()
  387. })
  388. onBeforeUnmount(() => {
  389. // this.$once('hook:beforeDestroy', () => {
  390. // })
  391. if (bpmnModeler) bpmnModeler.destroy()
  392. emit('destroy', bpmnModeler)
  393. bpmnModeler = null
  394. })
  395. watch(
  396. () => props.value,
  397. (newValue) => {
  398. xml.value = newValue
  399. createNewDiagram(xml.value)
  400. }
  401. )
  402. watch(
  403. () => props.activityData,
  404. (newActivityData) => {
  405. activityLists.value = newActivityData
  406. createNewDiagram(xml.value)
  407. }
  408. )
  409. watch(
  410. () => props.processInstanceData,
  411. (newProcessInstanceData) => {
  412. processInstance.value = newProcessInstanceData
  413. createNewDiagram(xml.value)
  414. }
  415. )
  416. watch(
  417. () => props.taskData,
  418. (newTaskListData) => {
  419. taskList.value = newTaskListData
  420. createNewDiagram(xml.value)
  421. }
  422. )
  423. </script>
  424. <style lang="scss">
  425. /** 处理中 */
  426. .highlight-todo.djs-connection > .djs-visual > path {
  427. stroke: #1890ff !important;
  428. stroke-dasharray: 4px !important;
  429. fill-opacity: 0.2 !important;
  430. }
  431. .highlight-todo.djs-shape .djs-visual > :nth-child(1) {
  432. fill: #1890ff !important;
  433. stroke: #1890ff !important;
  434. stroke-dasharray: 4px !important;
  435. fill-opacity: 0.2 !important;
  436. }
  437. :deep(.highlight-todo.djs-connection > .djs-visual > path) {
  438. stroke: #1890ff !important;
  439. stroke-dasharray: 4px !important;
  440. fill-opacity: 0.2 !important;
  441. marker-end: url('#sequenceflow-end-_E7DFDF-_E7DFDF-803g1kf6zwzmcig1y2ulm5egr');
  442. }
  443. :deep(.highlight-todo.djs-shape .djs-visual > :nth-child(1)) {
  444. fill: #1890ff !important;
  445. stroke: #1890ff !important;
  446. stroke-dasharray: 4px !important;
  447. fill-opacity: 0.2 !important;
  448. }
  449. /** 通过 */
  450. .highlight.djs-shape .djs-visual > :nth-child(1) {
  451. fill: green !important;
  452. stroke: green !important;
  453. fill-opacity: 0.2 !important;
  454. }
  455. .highlight.djs-shape .djs-visual > :nth-child(2) {
  456. fill: green !important;
  457. }
  458. .highlight.djs-shape .djs-visual > path {
  459. fill: green !important;
  460. fill-opacity: 0.2 !important;
  461. stroke: green !important;
  462. }
  463. .highlight.djs-connection > .djs-visual > path {
  464. stroke: green !important;
  465. }
  466. .highlight:not(.djs-connection) .djs-visual > :nth-child(1) {
  467. fill: green !important; /* color elements as green */
  468. }
  469. :deep(.highlight.djs-shape .djs-visual > :nth-child(1)) {
  470. fill: green !important;
  471. stroke: green !important;
  472. fill-opacity: 0.2 !important;
  473. }
  474. :deep(.highlight.djs-shape .djs-visual > :nth-child(2)) {
  475. fill: green !important;
  476. }
  477. :deep(.highlight.djs-shape .djs-visual > path) {
  478. fill: green !important;
  479. fill-opacity: 0.2 !important;
  480. stroke: green !important;
  481. }
  482. :deep(.highlight.djs-connection > .djs-visual > path) {
  483. stroke: green !important;
  484. }
  485. .djs-element.highlight > .djs-visual > path {
  486. stroke: green !important;
  487. }
  488. /** 不通过 */
  489. .highlight-reject.djs-shape .djs-visual > :nth-child(1) {
  490. fill: red !important;
  491. stroke: red !important;
  492. fill-opacity: 0.2 !important;
  493. }
  494. .highlight-reject.djs-shape .djs-visual > :nth-child(2) {
  495. fill: red !important;
  496. }
  497. .highlight-reject.djs-shape .djs-visual > path {
  498. fill: red !important;
  499. fill-opacity: 0.2 !important;
  500. stroke: red !important;
  501. }
  502. .highlight-reject.djs-connection > .djs-visual > path {
  503. stroke: red !important;
  504. marker-end: url(#sequenceflow-end-white-success) !important;
  505. }
  506. .highlight-reject:not(.djs-connection) .djs-visual > :nth-child(1) {
  507. fill: red !important; /* color elements as green */
  508. }
  509. :deep(.highlight-reject.djs-shape .djs-visual > :nth-child(1)) {
  510. fill: red !important;
  511. stroke: red !important;
  512. fill-opacity: 0.2 !important;
  513. }
  514. :deep(.highlight-reject.djs-shape .djs-visual > :nth-child(2)) {
  515. fill: red !important;
  516. }
  517. :deep(.highlight-reject.djs-shape .djs-visual > path) {
  518. fill: red !important;
  519. fill-opacity: 0.2 !important;
  520. stroke: red !important;
  521. }
  522. :deep(.highlight-reject.djs-connection > .djs-visual > path) {
  523. stroke: red !important;
  524. }
  525. /** 已取消 */
  526. .highlight-cancel.djs-shape .djs-visual > :nth-child(1) {
  527. fill: grey !important;
  528. stroke: grey !important;
  529. fill-opacity: 0.2 !important;
  530. }
  531. .highlight-cancel.djs-shape .djs-visual > :nth-child(2) {
  532. fill: grey !important;
  533. }
  534. .highlight-cancel.djs-shape .djs-visual > path {
  535. fill: grey !important;
  536. fill-opacity: 0.2 !important;
  537. stroke: grey !important;
  538. }
  539. .highlight-cancel.djs-connection > .djs-visual > path {
  540. stroke: grey !important;
  541. }
  542. .highlight-cancel:not(.djs-connection) .djs-visual > :nth-child(1) {
  543. fill: grey !important; /* color elements as green */
  544. }
  545. :deep(.highlight-cancel.djs-shape .djs-visual > :nth-child(1)) {
  546. fill: grey !important;
  547. stroke: grey !important;
  548. fill-opacity: 0.2 !important;
  549. }
  550. :deep(.highlight-cancel.djs-shape .djs-visual > :nth-child(2)) {
  551. fill: grey !important;
  552. }
  553. :deep(.highlight-cancel.djs-shape .djs-visual > path) {
  554. fill: grey !important;
  555. fill-opacity: 0.2 !important;
  556. stroke: grey !important;
  557. }
  558. :deep(.highlight-cancel.djs-connection > .djs-visual > path) {
  559. stroke: grey !important;
  560. }
  561. /** 回退 */
  562. .highlight-return.djs-shape .djs-visual > :nth-child(1) {
  563. fill: #e6a23c !important;
  564. stroke: #e6a23c !important;
  565. fill-opacity: 0.2 !important;
  566. }
  567. .highlight-return.djs-shape .djs-visual > :nth-child(2) {
  568. fill: #e6a23c !important;
  569. }
  570. .highlight-return.djs-shape .djs-visual > path {
  571. fill: #e6a23c !important;
  572. fill-opacity: 0.2 !important;
  573. stroke: #e6a23c !important;
  574. }
  575. .highlight-return.djs-connection > .djs-visual > path {
  576. stroke: #e6a23c !important;
  577. }
  578. .highlight-return:not(.djs-connection) .djs-visual > :nth-child(1) {
  579. fill: #e6a23c !important; /* color elements as green */
  580. }
  581. :deep(.highlight-return.djs-shape .djs-visual > :nth-child(1)) {
  582. fill: #e6a23c !important;
  583. stroke: #e6a23c !important;
  584. fill-opacity: 0.2 !important;
  585. }
  586. :deep(.highlight-return.djs-shape .djs-visual > :nth-child(2)) {
  587. fill: #e6a23c !important;
  588. }
  589. :deep(.highlight-return.djs-shape .djs-visual > path) {
  590. fill: #e6a23c !important;
  591. fill-opacity: 0.2 !important;
  592. stroke: #e6a23c !important;
  593. }
  594. :deep(.highlight-return.djs-connection > .djs-visual > path) {
  595. stroke: #e6a23c !important;
  596. }
  597. .element-overlays {
  598. width: 200px;
  599. padding: 8px;
  600. color: #fafafa;
  601. background: rgb(0 0 0 / 60%);
  602. border-radius: 4px;
  603. box-sizing: border-box;
  604. }
  605. </style>