add:引入bpmn

This commit is contained in:
zhangzq
2024-03-19 11:04:40 +08:00
parent 8fdb1a45dd
commit c10b3e2054
32 changed files with 18419 additions and 37 deletions

View File

@@ -5,7 +5,7 @@
"author": "Zheng Jie",
"license": "Apache-2.0",
"scripts": {
"dev": "vue-cli-service serve",
"dev": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
@@ -33,85 +33,93 @@
"url": "https://github.com/elunez/eladmin/issues"
},
"dependencies": {
"@logicflow/core": "^1.1.22",
"@logicflow/extension": "^1.1.22",
"@logicflow/core": "1.1.22",
"@logicflow/extension": "1.1.22",
"@riophae/vue-treeselect": "0.4.0",
"af-table-column": "^1.0.3",
"af-table-column": "1.0.3",
"axios": "0.18.1",
"bpmn-js": "5.1.2",
"bpmn-moddle": "6.0.0",
"clipboard": "2.0.4",
"codemirror": "^5.49.2",
"codemirror": "5.49.2",
"connect": "3.6.6",
"echarts": "^4.2.1",
"echarts-gl": "^1.1.1",
"echarts-wordcloud": "^1.1.3",
"element-ui": "^2.6.3",
"core-js": "^3.3.2",
"didi": "^10.2.1",
"echarts": "4.2.1",
"echarts-gl": "1.1.1",
"echarts-wordcloud": "1.1.3",
"element-ui": "2.6.3",
"elt-transfer": "0.0.13",
"file-saver": "1.3.8",
"font-awesome": "^4.7.0",
"font-awesome": "4.7.0",
"fuse.js": "3.4.4",
"jquery": "^3.6.0",
"js-beautify": "^1.10.2",
"jquery": "3.6.0",
"js-beautify": "1.10.2",
"js-cookie": "2.2.0",
"jsencrypt": "^3.0.0-rc.1",
"jsencrypt": "3.0.0-rc.1",
"jszip": "3.1.5",
"mavon-editor": "^2.9.0",
"less-loader": "^12.2.0",
"mavon-editor": "2.9.0",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"qs": "^6.9.1",
"qs": "6.9.1",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"view-design": "^4.0.2",
"vue": "2.6.10",
"vue-bus": "^1.2.1",
"vue-color": "^2.8.1",
"vue-bus": "1.2.1",
"vue-color": "2.8.1",
"vue-count-to": "1.0.13",
"vue-cropper": "0.4.9",
"vue-echarts": "^5.0.0-beta.0",
"vue-highlightjs": "^1.3.3",
"vue-image-crop-upload": "^2.5.0",
"vue-echarts": "5.0.0-beta.0",
"vue-highlightjs": "1.3.3",
"vue-image-crop-upload": "2.5.0",
"vue-router": "3.0.2",
"vue-seamless-scroll": "^1.1.23",
"vue-seamless-scroll": "1.1.23",
"vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0",
"vuex": "3.1.0",
"vxe-table": "^3.3.10",
"wangeditor": "^3.1.1",
"xe-ajax": "^4.0.5",
"xe-utils": "^3.3.1",
"xlsx": "^0.14.1"
"vxe-table": "3.3.10",
"wangeditor": "3.1.1",
"xe-ajax": "4.0.5",
"xe-utils": "3.3.1",
"xlsx": "0.14.1"
},
"devDependencies": {
"@babel/core": "7.0.0",
"@babel/parser": "^7.7.4",
"@babel/parser": "7.7.4",
"@babel/register": "7.0.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.2.1",
"@vue/babel-plugin-transform-vue-jsx": "1.2.1",
"@vue/cli-plugin-babel": "3.5.3",
"@vue/cli-plugin-eslint": "^3.9.1",
"@vue/cli-plugin-eslint": "3.9.1",
"@vue/cli-plugin-unit-jest": "3.5.3",
"@vue/cli-service": "3.5.3",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "^9.5.1",
"ant-design-vue": "1.7.8",
"autoprefixer": "9.5.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "23.6.0",
"babel-plugin-dynamic-import-node": "2.3.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-remove-console": "6.9.4",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6",
"eslint": "5.15.3",
"eslint-plugin-vue": "5.2.2",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^0.19.1",
"http-proxy-middleware": "0.19.1",
"husky": "1.3.1",
"lint-staged": "8.1.5",
"lodash-es": "^4.17.21",
"plop": "2.3.0",
"runjs": "^4.3.2",
"sass": "^1.26.10",
"sass-loader": "^7.1.0",
"runjs": "4.3.2",
"sass": "1.26.10",
"sass-loader": "7.1.0",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "^1.13.2",
"serve-static": "1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"vue-template-compiler": "2.6.10"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 130 KiB

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2021 by original authors @ fontello.com</metadata>
<defs>
<font id="dmn" horiz-adv-x="1000" >
<font-face font-family="dmn" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="up" unicode="&#xe800;" d="M564 280q16-16 16-41t-16-41q-38-38-78 0l-196 188-196-188q-40-38-78 0-16 16-16 41t16 41l234 224q16 16 40 16t40-16z" horiz-adv-x="580" />
<glyph glyph-name="down" unicode="&#xe801;" d="M564 422l-234-224q-18-18-40-18t-40 18l-234 224q-16 16-16 41t16 41q38 38 78 0l196-188 196 188q40 38 78 0 16-16 16-41t-16-41z" horiz-adv-x="580" />
<glyph glyph-name="clear" unicode="&#xe802;" d="M452 194q18-18 18-43t-18-43q-18-16-43-16t-43 16l-132 152-132-152q-18-16-43-16t-43 16q-16 18-16 43t16 43l138 156-138 158q-16 18-16 43t16 43q18 16 43 16t43-16l132-152 132 152q18 16 43 16t43-16q18-18 18-43t-18-43l-138-158z" horiz-adv-x="470" />
<glyph glyph-name="plus" unicode="&#xe803;" d="M550 400q30 0 30-50t-30-50l-210 0 0-210q0-30-50-30t-50 30l0 210-210 0q-30 0-30 50t30 50l210 0 0 210q0 30 50 30t50-30l0-210 210 0z" horiz-adv-x="580" />
<glyph glyph-name="minus" unicode="&#xe804;" d="M550 400q30 0 30-50t-30-50l-520 0q-30 0-30 50t30 50l520 0z" horiz-adv-x="580" />
<glyph glyph-name="info" unicode="&#xe805;" d="M352 850q48 0 74-27t26-69q0-50-39-88t-95-38q-48 0-74 26t-24 72q0 46 35 85t97 39z m-206-1000q-100 0-54 178l60 254q14 56 0 56-12 0-54-18t-72-38l-26 44q90 78 189 126t151 48q78 0 36-162l-70-266q-16-64 6-64 44 0 118 60l30-40q-84-86-175-132t-139-46z" horiz-adv-x="460" />
<glyph glyph-name="left" unicode="&#xe806;" d="M242 626q14 16 39 16t41-16q38-36 0-80l-186-196 186-194q38-44 0-80-16-16-40-16t-40 16l-226 236q-16 16-16 38 0 24 16 40 206 214 226 236z" horiz-adv-x="341" />
<glyph glyph-name="decision" unicode="&#xe807;" d="M16 663l0-25 0-601 968 0 0 626-968 0z m51-51l866 0 0-524-866 0 0 524z" horiz-adv-x="1000" />
<glyph glyph-name="right" unicode="&#xe808;" d="M98 626l226-236q16-16 16-40 0-22-16-38l-226-236q-16-16-40-16t-40 16q-36 36 0 80l186 194-186 196q-36 44 0 80 16 16 41 16t39-16z" horiz-adv-x="340" />
<glyph glyph-name="input" unicode="&#xe809;" d="M661 350q0-14-11-25l-303-304q-11-10-26-10t-25 10-10 25v161h-250q-15 0-25 11t-11 25v214q0 15 11 25t25 11h250v161q0 14 10 25t25 10 26-10l303-304q11-10 11-25z m196 196v-392q0-67-47-114t-114-47h-178q-7 0-13 5t-5 13q0 2-1 11t0 15 2 13 5 11 12 3h178q37 0 64 27t26 63v392q0 37-26 64t-64 26h-174t-6 0-6 2-5 3-4 5-1 8q0 2-1 11t0 15 2 13 5 11 12 3h178q67 0 114-47t47-114z" horiz-adv-x="857.1" />
<glyph glyph-name="output" unicode="&#xe80a;" d="M357 46q0-2 1-11t0-14-2-14-5-11-12-3h-178q-67 0-114 47t-47 114v392q0 67 47 114t114 47h178q8 0 13-5t5-13q0-2 1-11t0-15-2-13-5-11-12-3h-178q-37 0-63-26t-27-64v-392q0-37 27-63t63-27h174t6 0 7-2 4-3 4-5 1-8z m518 304q0-14-11-25l-303-304q-11-10-25-10t-25 10-11 25v161h-250q-14 0-25 11t-11 25v214q0 15 11 25t25 11h250v161q0 14 11 25t25 10 25-10l303-304q11-10 11-25z" horiz-adv-x="928.6" />
<glyph glyph-name="copy" unicode="&#xe80b;" d="M970 480q38-10 30-46l-150-556q-4-16-18-23t-30-3l-406 110q-16 4-24 18t-4 28l24 92-180-48q-40-10-50 26l-160 602q-10 36 28 48l454 122q16 4 30-3t18-23l66-244z m-888 190l144-542 392 106-144 540z m702-742l132 492-298 82 76-282q10-34-28-46l-196-52-26-102z" horiz-adv-x="1001" />
<glyph glyph-name="keyboard" unicode="&#xe80c;" d="M930 650q28 0 49-21t21-49l0-460q0-30-21-50t-49-20l-860 0q-28 0-49 20t-21 50l0 460q0 28 21 49t49 21l860 0z m-380-100l0-100 100 0 0 100-100 0z m150-150l-100 0 0-100 100 0 0 100z m-300 150l0-100 100 0 0 100-100 0z m150-150l-100 0 0-100 100 0 0 100z m-300 150l0-100 100 0 0 100-100 0z m150-150l-100 0 0-100 100 0 0 100z m-300 150l0-100 100 0 0 100-100 0z m150-150l-100 0 0-100 100 0 0 100z m-50-250l0 100-100 0 0-100 100 0z m550 0l0 100-500 0 0-100 500 0z m150 0l0 100-100 0 0-100 100 0z m-150 150l100 0 0 100-100 0 0-100z m150 150l0 100-200 0 0-100 200 0z" horiz-adv-x="1000" />
<glyph glyph-name="undo" unicode="&#xe80d;" d="M532 736q170 0 289-120t119-290-119-290-289-120q-142 0-252 88l70 74q84-60 182-60 126 0 216 90t90 218-90 218-216 90q-124 0-214-87t-92-211l142 0-184-204-184 204 124 0q2 166 122 283t286 117z" horiz-adv-x="940" />
<glyph glyph-name="redo" unicode="&#xe80e;" d="M408 760q168 0 287-116t123-282l122 0-184-206-184 206 144 0q-4 124-94 210t-214 86q-126 0-216-90t-90-218q0-126 90-216t216-90q104 0 182 60l70-76q-110-88-252-88-168 0-288 120t-120 290 120 290 288 120z" horiz-adv-x="940" />
<glyph glyph-name="menu" unicode="&#xe80f;" d="M110 460q46 0 78-32t32-78q0-44-32-77t-78-33-78 33-32 77q0 46 32 78t78 32z m350 0q46 0 78-32t32-78q0-44-33-77t-77-33-77 33-33 77q0 46 32 78t78 32z m350 0q46 0 78-32t32-78q0-44-32-77t-78-33-78 33-32 77q0 46 32 78t78 32z" horiz-adv-x="920" />
<glyph glyph-name="setting" unicode="&#xe810;" d="M760 350q0-72 80-122-12-40-34-82-70 18-136-44-54-58-34-136-40-20-84-36-46 82-132 82t-132-82q-44 16-84 36 20 80-34 136-54 54-136 34-14 26-34 82 82 52 82 132 0 72-82 124 20 56 34 82 74-18 136 44 54 56 34 136 42 22 84 34 46-80 132-80t132 80q42-12 84-34-20-78 34-136 66-62 136-44 22-42 34-82-80-50-80-124z m-340-182q76 0 129 53t53 129-53 130-129 54-129-54-53-130 53-129 129-53z" horiz-adv-x="840" />
<glyph glyph-name="wrench" unicode="&#xe811;" d="M214 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m354 243q0-22-13-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t5-14z" horiz-adv-x="928.6" />
<glyph glyph-name="eraser" unicode="&#xe812;" d="M500 64l188 215h-429l-188-215h429z m565 601q9-19 6-40t-17-36l-500-572q-22-24-54-24h-429q-21 0-38 11t-27 31q-8 19-5 40t17 36l500 572q21 24 53 24h429q21 0 39-11t26-31z" horiz-adv-x="1071.4" />
<glyph glyph-name="attention" unicode="&#xe813;" d="M957-24q10-16 0-34-10-16-30-16l-892 0q-18 0-28 16-13 18-2 34l446 782q8 18 30 18t30-18z m-420 50l0 100-110 0 0-100 110 0z m0 174l0 300-110 0 0-300 110 0z" horiz-adv-x="962" />
<glyph glyph-name="resize-big" unicode="&#xe814;" d="M839 55l72 72 0-224-223 0 72 72-184 185 79 79z m-749 591l-72-72 0 223 223 0-72-72 184-184-79-79z m670 79l-72 72 223 0 0-223-72 72-184-184-79 79z m-407-565l-184-185 72-72-223 0 0 224 72-72 184 184z" horiz-adv-x="928" />
<glyph glyph-name="resize-small" unicode="&#xe815;" d="M648 88l-72-72 0 223 223 0-72-72 184-185-79-79z m-448 447l-182 183 79 79 183-182 73 70-1-222-222-1z m-182-553l184 185-72 72 223 0 0-223-72 72-184-185z m782 480l-224 0 0 225 73-72 183 182 79-79-183-183z" horiz-adv-x="928" />
<glyph glyph-name="file-code" unicode="&#xe816;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z m-518 500q4 7 12 7t13-3l28-21q7-5 7-12t-3-13l-102-136 102-136q4-6 3-13t-7-12l-28-21q-6-4-13-4t-12 7l-126 168q-8 11 0 22z m447-167q8-11 0-22l-126-168q-4-6-11-7t-14 4l-28 21q-6 5-7 12t3 13l102 136-102 136q-4 6-3 13t7 12l28 21q6 4 14 3t11-7z m-346-258q-7 1-11 8t-3 13l77 464q1 7 7 11t14 3l35-5q7-2 11-8t3-13l-77-464q-1-7-7-11t-13-3z" horiz-adv-x="857.1" />
<glyph glyph-name="business-knowledge" unicode="&#xe817;" d="M202 594l-191-225 0-10 1-252 794 0 183 226 0 261-787 0z m25-54l708 0 0-188-155-192-714 0-1 189 162 191z" horiz-adv-x="1000" />
<glyph glyph-name="knowledge-source" unicode="&#xe818;" d="M13 672l0-24 0-536 10-7c147-97 273-87 378-50 106 38 194 99 274 110l1 0 1 0c109 20 173-14 278-57l32-14 0 384 0 192-974 2z m47-48l880-2 0-144 0-313c-88 37-163 67-272 46-97-13-185-77-283-111-95-34-195-45-325 38l0 486z" horiz-adv-x="1000" />
<glyph glyph-name="input-data" unicode="&#xe819;" d="M203 594c-57 0-107-29-142-74-35-44-56-104-56-170 0-66 21-126 56-170 35-44 85-74 142-74l594 0c57 0 107 30 142 74 35 44 56 104 56 170 0 66-21 126-56 170-35 45-85 74-142 74l-594 0z m0-55l594 0c38 0 73-19 99-53 27-33 44-82 44-136 0-54-17-102-44-136-26-34-61-53-99-53l-594 0c-38 0-73 19-99 53-27 34-44 82-44 136 0 54 17 103 44 136 26 34 61 53 99 53z" horiz-adv-x="1000" />
<glyph glyph-name="text-annotation" unicode="&#xe81a;" d="M677 795l0-25 0-411 0-412 0-24 24 0 224 0 25 0 0 49-25 0-199 0 0 387 0 386 199 0 25 0 0 50-25 0-224 0-24 0z m-81-386l-75-60 60-75 75 60-60 75z m-151-119l-75-60 60-75 75 59-60 76z m-150-120l-76-59 60-76 75 60-59 75z m-151-119l-76-60 60-75 76 59-60 76z" horiz-adv-x="1000" />
<glyph glyph-name="connection" unicode="&#xe81b;" d="M911 749c0 0-285-146-431-214 31-28 60-59 90-89-147-149-295-299-443-448 11-11 22-21 33-31 148 149 295 299 443 448 30-29 60-60 90-90 77 153 218 424 218 424z" horiz-adv-x="1000" />
<glyph glyph-name="connection-multi" unicode="&#xe81c;" d="M916 798l-410-109 64-95-486-327 25-38 486 328 62-92 259 333 0 0z m0-328l-411-109 151-224 260 333 0 0z m-409-245l-63-43 25-37 63 42-25 38z m-126-85l-62-42 25-38 62 43-25 37z m-133-90l-63-43 25-37 63 43-25 37z m-126-85l-38-26 25-37 38 26-25 37z" horiz-adv-x="1000" />
<glyph glyph-name="drag" unicode="&#xe81d;" d="M563 100l187 0 0-188-187 0z m0 313l187 0 0-188-187 0z m-313-313l188 0 0-188-188 0z m0 313l188 0 0-188-188 0z m313 312l187 0 0-187-187 0z m-313 0l188 0 0-187-188 0z" horiz-adv-x="1000" />
<glyph glyph-name="lasso-tool" unicode="&#xe81e;" d="M303 798l0-218 103 0 0 218-103 0z m-248-246l0-103 218 0 0 103-218 0z m379 0l0-103 219 0 0 103-219 0z m349-30l0-40 123 0 0-117 40 0 0 157-163 0z m-480-104l0-218 103 0 0 218-103 0z m603-159l0-77 40 0 0 77-40 0z m0-190l0-116-119 0 0-40 159 0 0 156-40 0z m-570-1l0-157 159 0 0 40-119 0 0 117-40 0z m264-117l0-40 82 0 0 40-82 0z" horiz-adv-x="1000" />
<glyph glyph-name="screw-wrench" unicode="&#xe81f;" d="M756 704c-55 0-108-22-147-61-39-39-61-92-61-147 0-55 22-108 61-147 39-39 92-61 147-61 91 0 171 59 198 146l-149-40-116 77 62 124 79 21 78 21c-39 42-94 67-152 67z m-247-278l-461-316c-14-42 32-111 80-114l451 310c-36 31-61 73-70 120z" horiz-adv-x="1000" />
<glyph glyph-name="trash" unicode="&#xe820;" d="M429 743c-58-4-70 11-71-52l0-9-172-56c-20-5-20-29 0-30l624 0c19 0 19 25 0 30l-168 55 0 10c0 62-7 48-71 52l-71 0z m-215-204c-14 0-25-12-24-26l50-555c1-12 11-22 24-22l457 0c13 0 23 9 25 22l64 554c2 15-9 27-24 27l-143 0-143 0z m27-49l259 0 259 0-59-505-414 0z m120-73c-1 0-2 0-3 0-16-1-28-15-25-31l44-320c2-15 16-26 31-24 15 2 25 17 22 32l-44 319c-2 13-12 23-25 24z m280 0c-13 0-25-10-27-24l-44-319c-3-15 7-30 22-32 16-2 29 9 31 24l44 320c3 16-9 30-26 31z" horiz-adv-x="1000" />
<glyph glyph-name="bpmn-io" unicode="&#xe821;" d="M674 41h-348v-191h348z m-348 809v-714h176c114 0 171 57 171 166v58c0 76-23 133-81 157 48 24 67 71 67 143v28c0 105-48 162-162 162z m114-100h57c43 0 57-24 57-76v-38c0-57-23-76-66-76h-48z m-5-300h53c47 0 71-19 71-86v-62c0-52-19-71-57-71h-67z" horiz-adv-x="1000" />
<glyph glyph-name="decision-table" unicode="&#xe822;" d="M37 677l0-327 0-71 0-46 0-210 216 0 47 0 663 0 0 327 0 327-926 0z m46-219l170 0 0-179-170 0 0 71 0 108z m217 0l617 0 0-108 0-71-617 0 0 179z m-217-225l170 0 0-164-170 0 0 164z m217 0l617 0 0-164-617 0 0 164z" horiz-adv-x="1000" />
<glyph glyph-name="literal-expression" unicode="&#xe823;" d="M383 834c-52 0-99-12-134-41-34-28-54-73-54-131 0-32-2-160-2-193 0-30-22-66-97-66l-20 0 0-99 20 0c74 0 97-43 97-66 0-32 2-159 2-189 0-63 20-109 55-139 35-29 82-40 133-40l45 0 0 104-41 0c-29 0-46 8-57 21-12 13-18 34-18 63 0 29-1 138-1 168l0 0c0 42-16 76-39 101-11 11-24 20-37 27 13 7 25 16 36 27 24 23 40 57 40 99l0 0c0 31 1 147 1 174 0 28 6 47 16 58 11 11 28 18 59 18l41 0 0 104-45 0z m195 0l0-104 41 0c31 0 47-7 58-18 10-11 16-30 16-58 0-27 1-143 1-174 0-42 16-75 39-99 11-11 23-20 36-27-13-7-25-16-36-27-24-24-39-59-39-101 0-31-1-139-1-167 0-30-7-51-18-64-11-13-28-21-56-21l-41 0 0-103 44 0c51 0 98 11 132 40 35 29 55 76 55 138 0 31 2 157 2 189 0 8 3 19 10 29 6 6 12 12 17 18 15 11 37 19 69 19l20 0 0 99-20 0c-74 0-96 36-96 66 0 33-2 162-2 193 0 58-20 103-54 131-34 29-81 41-133 41l-44 0z m266-504c0 0 0 0 1 0 0 0-1-1-1-1l0 1z" horiz-adv-x="1000" />
<glyph glyph-name="edit" unicode="&#xe824;" d="M203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
<glyph glyph-name="cut" unicode="&#xe825;" d="M536 350q14 0 25-11t10-25-10-25-25-10-25 10-11 25 11 25 25 11z m167-36l283-222q16-11 14-31-3-20-19-28l-72-36q-7-4-16-4-10 0-17 4l-385 216-62-36q-4-3-7-3 8-28 6-54-4-43-31-83t-74-69q-74-47-154-47-76 0-124 44-51 47-44 116 4 42 31 82t73 69q74 47 155 47 46 0 84-18 5 8 13 13l68 40-68 41q-8 5-13 12-38-17-84-17-81 0-155 47-46 30-73 69t-31 82q-3 33 8 63t36 52q47 44 124 44 80 0 154-47 46-29 74-68t31-83q2-27-6-54 3-1 7-3l62-37 385 216q7 5 17 5 9 0 16-4l72-36q16-9 19-28 2-20-14-32z m-380 145q26 24 12 61t-59 65q-52 33-107 33-42 0-63-20-26-24-12-60t59-66q51-33 107-33 41 0 63 20z m-47-415q45 28 59 65t-12 60q-22 20-63 20-56 0-107-33-45-28-59-65t12-60q21-20 63-20 55 0 107 33z m99 342l54-33v7q0 20 18 31l8 4-44 26-15-14q-1-2-5-6t-7-7q-1-1-2-2t-2-1z m125-125l54-18 410 321-71 36-429-240v-64l-89-53 5-5q1-1 4-3 2-2 6-7t6-6l15-15z m393-232l71 35-290 228-99-77q-1-2-7-4z" horiz-adv-x="1000" />
<glyph glyph-name="hand-tool" unicode="&#xe8c1;" d="M498 750c-19 0-36-11-45-26-8-15-12-33-14-53-5-40-1-88-1-131 0-22 0-45 0-67-6 14-11 28-15 39l0 0 0 0c-16 40-30 81-50 111-10 15-21 27-36 34-16 8-34 7-52 0l0-1 0 0c-18-8-28-24-32-41-3-17 0-35 4-54 9-39 26-84 38-128 10-35 19-70 27-100-12 11-24 23-38 35-23 20-49 38-75 48-27 10-57 11-80-9l0 0 0 0c-18-17-27-37-24-57 2-20 13-38 27-56 29-36 74-75 118-128 49-58 102-152 140-201l5-7 332 0 3 12c7 21 14 62 26 114 11 51 27 112 47 165 28 71 56 138 68 191 6 26 9 49 4 70-5 20-22 37-45 41-20 4-39-5-52-19-14-13-24-31-33-52-8-15-14-33-21-50 0 29 0 36 0 75-1 43 2 92-1 131-2 19-5 37-12 51-7 14-22 26-40 25-17 1-32-7-41-19-10-13-16-28-20-44-9-34-13-74-19-107-3-16-6-32-9-47-2 16-4 33-6 51-4 40-6 88-15 128-4 19-9 37-19 51-9 15-25 26-43 25l1 0c0 0-1 0-2 0z m0-33c0 0 1 0 1 0l1 0 0 0c6 0 9-2 14-10 5-8 10-23 14-40 8-36 11-83 15-125 9-90 22-156 22-156l33 1c0 0 13 75 26 149 6 35 11 75 18 104 4 14 9 26 14 32 5 6 7 7 14 7l1 0 1 0c6 0 5 0 9-7 4-7 7-21 8-39 3-35 1-83 1-128 0-84 1-160 1-160l32-7c19 41 35 91 52 128 9 19 18 34 27 43 8 8 14 10 22 9l0 0 0 0c13-2 16-6 19-17 2-10 1-30-5-54-11-47-39-114-66-186-22-56-37-118-49-170-10-42-17-79-22-99l-289 0c-35 47-86 136-136 196-46 55-92 95-117 127-13 16-20 29-21 38-1 10 1 17 14 29 11 10 25 10 45 3 20-8 44-24 65-43 44-37 80-82 80-82l29 15c0 0-21 87-43 167-13 47-30 92-38 126-4 17-5 32-3 41 1 9 4 13 12 17 11 5 17 4 23 1 7-3 15-11 23-23 16-24 31-64 46-104l0 0c16-42 47-117 47-117l32 6c0 0 3 83 2 151-1 44-4 92 0 128 2 17 6 31 10 39 5 8 8 10 16 10z" horiz-adv-x="1000" />
<glyph glyph-name="paste" unicode="&#xf0ea;" d="M429-79h500v358h-233q-22 0-37 15t-16 38v232h-214v-643z m142 804v36q0 7-5 12t-12 6h-393q-7 0-13-6t-5-12v-36q0-7 5-13t13-5h393q7 0 12 5t5 13z m143-375h167l-167 167v-167z m286-71v-375q0-23-16-38t-38-16h-535q-23 0-38 16t-16 38v89h-303q-23 0-38 16t-16 37v750q0 23 16 38t38 16h607q22 0 38-16t15-38v-183q12-7 20-15l228-228q16-15 27-42t11-49z" horiz-adv-x="1000" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/flow-bpmn/logo.ico">
<title>Bpmn Designer</title>
<!-- 使用CDN的CSS文件 -->
<!-- 使用CDN的CSS文件 -->
<!-- 使用CDN的JS文件 -->
<!-- 使用CDN的JS文件 -->
<link href="/flow-bpmn/js/app.js" rel="preload" as="script"><link href="/flow-bpmn/js/chunk-vendors.js" rel="preload" as="script"></head>
<body class="full-container">
<noscript>
<strong>We're sorry but bpmn-process-designer doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="/flow-bpmn/js/chunk-vendors.js"></script><script type="text/javascript" src="/flow-bpmn/js/app.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because one or more lines are too long

View File

@@ -6,6 +6,10 @@ import 'normalize.css/normalize.css'
import Element from 'element-ui'
import ant from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
import 'font-awesome/css/font-awesome.css'
// vue中markdown编辑器
@@ -49,7 +53,7 @@ import 'jquery'
import VueBus from 'vue-bus'
Vue.use(scroll)
Vue.use(ant)
Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)

View File

@@ -0,0 +1,67 @@
/**
* 存储流程设计相关参数
*/
export default class BpmData {
constructor () {
this.controls = [] // 设计器控件
this.init()
}
init () {
this.controls = [
{
action: 'create.start-event',
title: '开始'
},
{
action: 'create.intermediate-event',
title: '中间'
},
{
action: 'create.end-event',
title: '结束'
},
{
action: 'create.exclusive-gateway',
title: '网关'
},
{
action: 'create.task',
title: '任务'
},
{
action: 'create.user-task',
title: '用户任务'
},
{
action: 'create.user-sign-task',
title: '会签任务'
},
{
action: 'create.subprocess-expanded',
title: '子流程'
},
{
action: 'create.data-object',
title: '数据对象'
},
{
action: 'create.data-store',
title: '数据存储'
},{
action: 'create.participant-expanded',
title: '扩展流程'
},
{
action: 'create.group',
title: '分组'
}
]
}
// 获取控件配置信息
getControl (action) {
const result = this.controls.filter(item => item.action === action)
return result[0] || {}
}
}

View File

@@ -0,0 +1,226 @@
<template>
<div class="property-panel" ref="propertyPanel">
<el-form :inline="true" :model="form" label-width="100px" size="small">
<el-form-item label="节点ID">
<el-input v-model="form.id" disabled></el-input>
</el-form-item>
<el-form-item label="节点名称">
<el-input v-model="form.name" @input="nameChange"></el-input>
</el-form-item>
<el-form-item label="节点颜色">
<el-color-picker v-model="form.color" @active-change="colorChange"></el-color-picker>
</el-form-item>
<!-- 任务节点允许选择人员 -->
<el-form-item label="节点人员" v-if="userTask">
<el-select v-model="form.userType" placeholder="请选择" @change="typeChange">
<el-option value="assignee" label="指定人员"></el-option>
<el-option value="candidateUsers" label="候选人员"></el-option>
<el-option value="candidateGroups" label="角色/岗位"></el-option>
</el-select>
</el-form-item>
<!-- 指定人员 -->
<el-form-item label="指定人员" v-if="userTask && form.userType === 'assignee'">
<el-select
v-model="form.assignee"
placeholder="请选择"
key="1"
@change="(value) => addUser({assignee: value})"
>
<el-option
v-for="item in users"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<!-- 候选人员 -->
<el-form-item label="候选人员" v-else-if="userTask && form.userType === 'candidateUsers'">
<el-select
v-model="form.candidateUsers"
placeholder="请选择"
key="2"
multiple
@change="(value) => addUser({candidateUsers: value.join(',') || value})"
>
<el-option
v-for="item in users"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<!-- 角色/岗位 -->
<el-form-item label="角色/岗位" v-else-if="userTask && form.userType === 'candidateGroups'">
<el-select
v-model="form.candidateGroups"
placeholder="请选择"
@change="(value) => addUser({candidateGroups: value})"
>
<el-option
v-for="item in roles"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<!-- 分支允许添加条件 -->
<el-form-item label="分支条件" v-if="sequenceFlow">
<el-select v-model="form.user" placeholder="请选择">
<el-option
v-for="item in users"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: "PropertyPanel",
props: {
modeler: {
type: Object,
required: true
}
},
computed: {
userTask() {
if (!this.element) {
return;
}
return this.element.type === 'bpmn:UserTask'
},
sequenceFlow() {
if (!this.element) {
return
}
return this.element.type === 'bpmn:SequenceFlow'
}
},
data() {
return {
form: {
id: "",
name: "",
color: null
},
element: {},
users: [
{
value: "zhangsan",
label: "张三"
},
{
value: "lisi",
label: "李四"
},
{
value: "wangwu",
label: "王五"
}
],
roles: [
{
value: "manager",
label: "经理"
},
{
value: "personnel",
label: "人事"
},
{
value: 'charge',
label: '主管'
}
]
};
},
mounted() {
this.handleModeler()
},
methods: {
handleModeler() {
// 监听节点选择变化
this.modeler.on("selection.changed", e => {
const element = e.newSelection[0];
this.element = element;
console.log(this.element);
if (!element) return;
this.form = {
...element.businessObject,
...element.businessObject.$attrs
};
if (this.form.userType === "candidateUsers") {
this.form["candidateUsers"] =
this.form["candidateUsers"].split(",") || [];
}
});
// 监听节点属性变化
this.modeler.on("element.changed", e => {
const { element } = e;
if (!element) return;
// 新增节点需要更新回属性面板
if (element.id === this.form.id) {
this.form.name = element.businessObject.name;
this.form = { ...this.form };
}
});
},
// 属性面板名称,更新回流程节点
nameChange(name) {
const modeling = this.modeler.get("modeling");
modeling.updateLabel(this.element, name);
},
// 属性面板颜色,更新回流程节点
colorChange(color) {
const modeling = this.modeler.get("modeling");
modeling.setColor(this.element, {
fill: null,
stroke: color
});
modeling.updateProperties(this.element, { color: color });
},
// 任务节点配置人员
addUser(properties) {
this.updateProperties(
Object.assign(properties, {
userType: Object.keys(properties)[0]
})
);
},
// 切换人员类型
typeChange() {
const types = ["assignee", "candidateUsers", "candidateGroups"];
types.forEach(type => {
delete this.element.businessObject.$attrs[type];
delete this.form[type];
});
},
// 在这里我们封装一个通用的更新节点属性的方法
updateProperties(properties) {
const modeling = this.modeler.get("modeling");
modeling.updateProperties(this.element, properties);
}
}
};
</script>
<style lang="scss" scoped>
.property-panel {
position: absolute;
right: 0px;
top: 0px;
border-left: 1px solid #cccccc;
padding: 20px 0;
width: 300px;
height: 100%;
}
</style>

View File

@@ -0,0 +1,285 @@
<template>
<div class="containers">
<div ref="canvas" class="canvas" />
<panel v-if="bpmnModeler" :modeler="bpmnModeler" />
<div class="toolbar">
<a title="download">下载</a>
<a ref="saveDiagram" href="javascript:" title="download BPMN diagram">BPMN</a>
<a ref="saveSvg" href="javascript:" title="download as SVG image">SVG</a>
</div>
</div>
</template>
<script>
import BpmnModeler from 'bpmn-js/lib/Modeler' // bpmn-js 设计器
import panel from './PropertyPanel' // 属性面板
import BpmData from './BpmData'
import customPalette from './palette'
export default {
components: {
panel
},
data() {
return {
bpmnModeler: null,
element: null,
bpmData: new BpmData()
}
},
mounted() {
const canvas = this.$refs.canvas
// 生成实例
this.bpmnModeler = new BpmnModeler({
additionalModules: [customPalette],
container: canvas
})
// 获取a标签dom节点
const downloadLink = this.$refs.saveDiagram
const downloadSvgLink = this.$refs.saveSvg
// 监听流程图改变事件
const _this = this
this.bpmnModeler.on('commandStack.changed', function() {
_this.saveSVG(function(err, svg) {
_this.setEncoded(downloadSvgLink, 'diagram.svg', err ? null : svg)
})
_this.saveDiagram(function(err, xml) {
_this.setEncoded(downloadLink, 'diagram.bpmn', err ? null : xml)
})
})
// 新增流程定义
this.createNewDiagram()
},
methods: {
createNewDiagram() {
const bpmnXmlStr = `
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="process1567044459787" name="流程1567044459787">
<bpmn2:documentation>描述</bpmn2:documentation>
<bpmn2:startEvent id="StartEvent_01ydzqe" name="开始">
<bpmn2:outgoing>SequenceFlow_1qw929z</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1qw929z" sourceRef="StartEvent_01ydzqe" targetRef="Task_1piqdk6" />
<bpmn2:userTask id="Task_1piqdk6" name="请假申请">
<bpmn2:incoming>SequenceFlow_1qw929z</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_11h4o22</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:exclusiveGateway id="ExclusiveGateway_0k39v3u">
<bpmn2:incoming>SequenceFlow_11h4o22</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1iu7pfe</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_04uqww2</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_11h4o22" sourceRef="Task_1piqdk6" targetRef="ExclusiveGateway_0k39v3u" />
<bpmn2:sequenceFlow id="SequenceFlow_1iu7pfe" sourceRef="ExclusiveGateway_0k39v3u" targetRef="Task_10fqcwp" />
<bpmn2:userTask id="Task_10fqcwp" name="经理审批">
<bpmn2:incoming>SequenceFlow_1iu7pfe</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1xod8nh</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_04uqww2" sourceRef="ExclusiveGateway_0k39v3u" targetRef="Task_15n23yh" />
<bpmn2:userTask id="Task_15n23yh" name="总部审批">
<bpmn2:incoming>SequenceFlow_04uqww2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0c8wrs4</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:exclusiveGateway id="ExclusiveGateway_1sq33g6">
<bpmn2:incoming>SequenceFlow_0c8wrs4</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_1xod8nh</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0h8za82</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_0c8wrs4" sourceRef="Task_15n23yh" targetRef="ExclusiveGateway_1sq33g6" />
<bpmn2:sequenceFlow id="SequenceFlow_1xod8nh" sourceRef="Task_10fqcwp" targetRef="ExclusiveGateway_1sq33g6" />
<bpmn2:endEvent id="EndEvent_0pnmjd3">
<bpmn2:incoming>SequenceFlow_0h8za82</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_0h8za82" sourceRef="ExclusiveGateway_1sq33g6" targetRef="EndEvent_0pnmjd3" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="process1567044459787">
<bpmndi:BPMNShape id="StartEvent_01ydzqe_di" bpmnElement="StartEvent_01ydzqe">
<dc:Bounds x="532" y="72" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="539" y="53" width="22" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1qw929z_di" bpmnElement="SequenceFlow_1qw929z">
<di:waypoint x="550" y="108" />
<di:waypoint x="550" y="150" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="UserTask_1qxjy46_di" bpmnElement="Task_1piqdk6">
<dc:Bounds x="500" y="150" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0k39v3u_di" bpmnElement="ExclusiveGateway_0k39v3u" isMarkerVisible="true">
<dc:Bounds x="525" y="275" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11h4o22_di" bpmnElement="SequenceFlow_11h4o22">
<di:waypoint x="550" y="230" />
<di:waypoint x="550" y="275" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1iu7pfe_di" bpmnElement="SequenceFlow_1iu7pfe">
<di:waypoint x="575" y="300" />
<di:waypoint x="680" y="300" />
<di:waypoint x="680" y="380" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="UserTask_18pwui1_di" bpmnElement="Task_10fqcwp">
<dc:Bounds x="630" y="380" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_04uqww2_di" bpmnElement="SequenceFlow_04uqww2">
<di:waypoint x="525" y="300" />
<di:waypoint x="430" y="300" />
<di:waypoint x="430" y="380" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="UserTask_1j0us24_di" bpmnElement="Task_15n23yh">
<dc:Bounds x="380" y="380" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1sq33g6_di" bpmnElement="ExclusiveGateway_1sq33g6" isMarkerVisible="true">
<dc:Bounds x="525" y="515" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0c8wrs4_di" bpmnElement="SequenceFlow_0c8wrs4">
<di:waypoint x="430" y="460" />
<di:waypoint x="430" y="540" />
<di:waypoint x="525" y="540" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1xod8nh_di" bpmnElement="SequenceFlow_1xod8nh">
<di:waypoint x="680" y="460" />
<di:waypoint x="680" y="540" />
<di:waypoint x="575" y="540" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0pnmjd3_di" bpmnElement="EndEvent_0pnmjd3">
<dc:Bounds x="532" y="602" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0h8za82_di" bpmnElement="SequenceFlow_0h8za82">
<di:waypoint x="550" y="565" />
<di:waypoint x="550" y="602" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
`
// 将字符串转换成图显示出来
this.bpmnModeler.importXML(bpmnXmlStr, err => {
if (err) {
console.error(err)
} else {
this.adjustPalette()
}
})
},
// 调整左侧工具栏排版
adjustPalette() {
try {
// 获取 bpmn 设计器实例
const canvas = this.$refs.canvas
const djsPalette = canvas.children[0].children[1].children[4]
const djsPalStyle = {
width: '130px',
padding: '5px',
background: 'white',
left: '20px',
borderRadius: 0
}
for (var key in djsPalStyle) {
djsPalette.style[key] = djsPalStyle[key]
}
const palette = djsPalette.children[0]
const allGroups = palette.children
allGroups[0].style['display'] = 'none'
// 修改控件样式
for (var gKey in allGroups) {
const group = allGroups[gKey]
for (var cKey in group.children) {
const control = group.children[cKey]
const controlStyle = {
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'center',
width: '100%',
padding: '5px'
}
if (
control.className &&
control.dataset &&
control.className.indexOf('entry') !== -1
) {
const controlProps = this.bpmData.getControl(
control.dataset.action
)
control.innerHTML = `<div style='font-size: 14px;font-weight:500;margin-left:15px;'>${
controlProps['title']
}</div>`
for (var csKey in controlStyle) {
control.style[csKey] = controlStyle[csKey]
}
}
}
}
} catch (e) {
console.log(e)
}
},
// 下载为SVG格式,done是个函数调用的时候传入的
saveSVG(done) {
// 把传入的done再传给bpmn原型的saveSVG函数调用
this.bpmnModeler.saveSVG(done)
},
// 下载为SVG格式,done是个函数调用的时候传入的
saveDiagram(done) {
// 把传入的done再传给bpmn原型的saveXML函数调用
this.bpmnModeler.saveXML({ format: true }, function(err, xml) {
done(err, xml)
})
},
// 当图发生改变的时候会调用这个函数这个data就是图的xml
setEncoded(link, name, data) {
// 把xml转换为URI下载要用到的
const encodedData = encodeURIComponent(data)
// 获取到图的xml保存就是把这个xml提交给后台
this.xmlStr = data
// 下载图的具体操作,改变a的属性className令a标签可点击href令能下载download是下载的文件的名字
if (data) {
link.className = 'active'
link.href = 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData
link.download = name
}
}
}
}
</script>
<style lang="scss">
/*左边工具栏以及编辑节点的样式*/
@import "~bpmn-js/dist/assets/diagram-js.css";
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
@import "~bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";
.containers {
position: absolute;
background-color: #ffffff;
width: 100%;
height: 100%;
.canvas {
width: 100%;
height: 100%;
}
.panel {
position: absolute;
right: 0;
top: 50px;
width: 300px;
}
.bjs-powered-by {
display: none;
}
.toolbar {
position: absolute;
top: 20px;
right: 350px;
a {
text-decoration: none;
margin: 5px;
color: #409eff;
}
}
}
</style>

View File

@@ -0,0 +1,401 @@
import {
isFunction,
isArray,
forEach
} from 'min-dash'
import {
domify,
query as domQuery,
attr as domAttr,
clear as domClear,
classes as domClasses,
matches as domMatches,
delegate as domDelegate,
event as domEvent
} from 'min-dom'
var TOGGLE_SELECTOR = '.djs-palette-toggle'
var ENTRY_SELECTOR = '.entry'
var ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR
var PALETTE_OPEN_CLS = 'open'
var PALETTE_TWO_COLUMN_CLS = 'two-column'
/**
* A palette containing modeling elements.
*/
export default function Palette(
eventBus,
canvas,
elementFactory,
create,
paletteContainer,
paletteEntries) {
this._eventBus = eventBus
this._canvas = canvas
this._providers = []
var self = this
eventBus.on('tool-manager.update', function(event) {
var tool = event.tool
self.updateToolHighlight(tool)
})
eventBus.on('i18n.changed', function() {
self._update()
})
eventBus.on('diagram.init', function() {
self._diagramInitialized = true
// initialize + update once diagram is ready
if (self._providers.length) {
self._init()
self._update()
}
})
}
Palette.$inject = [
'eventBus',
'canvas',
/* 自定义 */
]
/**
* Register a provider with the palette
*
* @param {PaletteProvider} provider
*/
Palette.prototype.registerProvider = function(provider) {
this._providers.push(provider)
// postpone init / update until diagram is initialized
if (!this._diagramInitialized) {
return
}
if (!this._container) {
this._init()
}
this._update()
}
/**
* Returns the palette entries for a given element
*
* @return {Array<PaletteEntryDescriptor>} list of entries
*/
Palette.prototype.getEntries = function() {
var entries = {}
// loop through all providers and their entries.
// group entries by id so that overriding an entry is possible
forEach(this._providers, function(provider) {
var e = provider.getPaletteEntries()
forEach(e, function(entry, id) {
entries[id] = entry
})
})
return entries
}
/**
* Initialize
*/
Palette.prototype._init = function() {
var self = this
var eventBus = this._eventBus
var parentContainer = this._getParentContainer()
var container = this._container = domify(Palette.HTML_MARKUP)
parentContainer.appendChild(container)
domDelegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
var target = event.delegateTarget
if (domMatches(target, TOGGLE_SELECTOR)) {
return self.toggle()
}
self.trigger('click', event)
})
// prevent drag propagation
domEvent.bind(container, 'mousedown', function(event) {
event.stopPropagation()
})
// prevent drag propagation
domDelegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
self.trigger('dragstart', event)
})
eventBus.on('canvas.resized', this._layoutChanged, this)
eventBus.fire('palette.create', {
container: container
})
}
/**
* Update palette state.
*
* @param {Object} [state] { open, twoColumn }
*/
Palette.prototype._toggleState = function(state) {
state = state || {}
var parent = this._getParentContainer()
var container = this._container
var eventBus = this._eventBus
var twoColumn
var cls = domClasses(container)
if ('twoColumn' in state) {
twoColumn = state.twoColumn
} else {
twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {})
}
// always update two column
cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn)
if ('open' in state) {
cls.toggle(PALETTE_OPEN_CLS, state.open)
}
eventBus.fire('palette.changed', {
twoColumn: twoColumn,
open: this.isOpen()
})
}
Palette.prototype._update = function() {
var entriesContainer = domQuery('.djs-palette-entries', this._container)
var entries = this._entries = this.getEntries()
domClear(entriesContainer)
forEach(entries, function(entry, id) {
var grouping = entry.group || 'default'
var container = domQuery('[data-group=' + grouping + ']', entriesContainer)
if (!container) {
container = domify('<div class="group" data-group="' + grouping + '"></div>')
entriesContainer.appendChild(container)
}
var html = entry.html || (
entry.separator
? '<hr class="separator" />'
: '<div class="entry" draggable="true"></div>')
var control = domify(html)
container.appendChild(control)
if (!entry.separator) {
domAttr(control, 'data-action', id)
if (entry.title) {
domAttr(control, 'title', entry.title)
}
if (entry.className) {
addClasses(control, entry.className)
}
if (entry.imageUrl) {
control.appendChild(domify('<img src="' + entry.imageUrl + '">'))
}
}
})
// open after update
this.open()
}
/**
* Trigger an action available on the palette
*
* @param {String} action
* @param {Event} event
*/
Palette.prototype.trigger = function(action, event, autoActivate) {
var entries = this._entries
var entry
var handler
var originalEvent
var button = event.delegateTarget || event.target
if (!button) {
return event.preventDefault()
}
entry = entries[domAttr(button, 'data-action')]
// when user clicks on the palette and not on an action
if (!entry) {
return
}
handler = entry.action
originalEvent = event.originalEvent || event
// simple action (via callback function)
if (isFunction(handler)) {
if (action === 'click') {
handler(originalEvent, autoActivate)
}
} else {
if (handler[action]) {
handler[action](originalEvent, autoActivate)
}
}
// silence other actions
event.preventDefault()
}
Palette.prototype._layoutChanged = function() {
this._toggleState({})
}
/**
* Do we need to collapse to two columns?
*
* @param {Number} availableHeight
* @param {Object} entries
*
* @return {Boolean}
*/
Palette.prototype._needsCollapse = function(availableHeight, entries) {
// top margin + bottom toggle + bottom margin
// implementors must override this method if they
// change the palette styles
var margin = 20 + 10 + 20
var entriesHeight = Object.keys(entries).length * 46
return availableHeight < entriesHeight + margin
}
/**
* Close the palette
*/
Palette.prototype.close = function() {
this._toggleState({
open: false,
twoColumn: false
})
}
/**
* Open the palette
*/
Palette.prototype.open = function() {
this._toggleState({ open: true })
}
Palette.prototype.toggle = function(open) {
if (this.isOpen()) {
this.close()
} else {
this.open()
}
}
Palette.prototype.isActiveTool = function(tool) {
return tool && this._activeTool === tool
}
Palette.prototype.updateToolHighlight = function(name) {
var entriesContainer,
toolsContainer
if (!this._toolsContainer) {
entriesContainer = domQuery('.djs-palette-entries', this._container)
this._toolsContainer = domQuery('[data-group=tools]', entriesContainer)
}
toolsContainer = this._toolsContainer
forEach(toolsContainer.children, function(tool) {
var actionName = tool.getAttribute('data-action')
if (!actionName) {
return
}
var toolClasses = domClasses(tool)
actionName = actionName.replace('-tool', '')
if (toolClasses.contains('entry') && actionName === name) {
toolClasses.add('highlighted-entry')
} else {
toolClasses.remove('highlighted-entry')
}
})
}
/**
* Return true if the palette is opened.
*
* @example
*
* palette.open();
*
* if (palette.isOpen()) {
* // yes, we are open
* }
*
* @return {boolean} true if palette is opened
*/
Palette.prototype.isOpen = function() {
return domClasses(this._container).has(PALETTE_OPEN_CLS)
}
/**
* Get container the palette lives in.
*
* @return {Element}
*/
Palette.prototype._getParentContainer = function() {
return this._canvas.getContainer()
}
/* markup definition */
Palette.HTML_MARKUP =
'<div class="djs-palette">' +
'<div class="djs-palette-entries"></div>' +
'<div class="djs-palette-toggle"></div>' +
'</div>'
// helpers //////////////////////
function addClasses(element, classNames) {
var classes = domClasses(element)
var actualClassNames = isArray(classNames) ? classNames : classNames.split(/\s+/g)
actualClassNames.forEach(function(cls) {
classes.add(cls)
})
}

View File

@@ -0,0 +1,191 @@
import { assign } from 'min-dash';
export default function PaletteProvider(
palette, create, elementFactory,
spaceTool, lassoTool, handTool,
globalConnect, translate) {
this._palette = palette;
this._create = create;
this._elementFactory = elementFactory;
this._spaceTool = spaceTool;
this._lassoTool = lassoTool;
this._handTool = handTool;
this._globalConnect = globalConnect;
this._translate = translate;
palette.registerProvider(this);
}
PaletteProvider.$inject = [
'palette',
'create',
'elementFactory',
'spaceTool',
'lassoTool',
'handTool',
'globalConnect',
'translate'
]
PaletteProvider.prototype.getPaletteEntries = function(element) {
var actions = {}
var create = this._create
var elementFactory = this._elementFactory
var spaceTool = this._spaceTool
var lassoTool = this._lassoTool
var handTool = this._handTool
var globalConnect = this._globalConnect
var translate = this._translate
function createAction(type, group, className, title, options) {
function createListener(event) {
var shape = elementFactory.createShape(assign({ type: type }, options));
if (options) {
shape.businessObject.di.isExpanded = options.isExpanded;
}
create.start(event, shape);
}
var shortType = type.replace(/^bpmn:/, '');
return {
group: group,
className: className,
title: title || translate('Create {type}', { type: shortType }),
action: {
dragstart: createListener,
click: createListener
}
}
}
function createSubprocess(event) {
var subProcess = elementFactory.createShape({
type: 'bpmn:SubProcess',
x: 0,
y: 0,
isExpanded: true
})
var startEvent = elementFactory.createShape({
type: 'bpmn:StartEvent',
x: 40,
y: 82,
parent: subProcess
})
create.start(event, [ subProcess, startEvent ], {
hints: {
autoSelect: [ startEvent ]
}
})
}
function createParticipant(event) {
create.start(event, elementFactory.createParticipantShape());
}
assign(actions, {
'hand-tool': {
group: 'tools',
className: 'bpmn-icon-hand-tool',
title: translate('Activate the hand tool'),
action: {
click: function(event) {
handTool.activateHand(event);
}
}
},
'lasso-tool': {
group: 'tools',
className: 'bpmn-icon-lasso-tool',
title: translate('Activate the lasso tool'),
action: {
click: function(event) {
lassoTool.activateSelection(event);
}
}
},
'space-tool': {
group: 'tools',
className: 'bpmn-icon-space-tool',
title: translate('Activate the create/remove space tool'),
action: {
click: function(event) {
spaceTool.activateSelection(event);
}
}
},
'global-connect-tool': {
group: 'tools',
className: 'bpmn-icon-connection-multi',
title: translate('Activate the global connect tool'),
action: {
click: function(event) {
globalConnect.toggle(event);
}
}
},
'tool-separator': {
group: 'tools',
separator: true
},
'create.start-event': createAction(
'bpmn:StartEvent', 'event', 'bpmn-icon-start-event-none',
translate('Create StartEvent')
),
'create.intermediate-event': createAction(
'bpmn:IntermediateThrowEvent', 'event', 'bpmn-icon-intermediate-event-none',
translate('Create Intermediate/Boundary Event')
),
'create.end-event': createAction(
'bpmn:EndEvent', 'event', 'bpmn-icon-end-event-none',
translate('Create EndEvent')
),
'create.exclusive-gateway': createAction(
'bpmn:ExclusiveGateway', 'gateway', 'bpmn-icon-gateway-none',
translate('Create Gateway')
),
'create.task': createAction(
'bpmn:Task', 'activity', 'bpmn-icon-task',
translate('Create Task')
),
'create.data-object': createAction(
'bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object',
translate('Create DataObjectReference')
),
'create.data-store': createAction(
'bpmn:DataStoreReference', 'data-store', 'bpmn-icon-data-store',
translate('Create DataStoreReference')
),
'create.subprocess-expanded': {
group: 'activity',
className: 'bpmn-icon-subprocess-expanded',
title: translate('Create expanded SubProcess'),
action: {
dragstart: createSubprocess,
click: createSubprocess
}
},
'create.participant-expanded': {
group: 'collaboration',
className: 'bpmn-icon-participant',
title: translate('Create Pool/Participant'),
action: {
dragstart: createParticipant,
click: createParticipant
}
},
'create.group': createAction(
'bpmn:Group', 'artifact', 'bpmn-icon-group',
translate('Create Group')
),
});
return actions;
};

View File

@@ -0,0 +1,13 @@
import customPalette from './CustomPalette'
import PaletteProvider from './CustomPaletteProvider'
// 除了引进的模块的名字可以修改,其他的不建议修改,会报错
export default {
__depends__: [
{
__init__: ['customPalette'],
customPalette: ['type', customPalette]
}
], // 依赖于 customPalette 这个模块
__init__: ['customPaletteProvider'], // 调用 customPaletteProvider 来初始化
customPaletteProvider: ['type', PaletteProvider]
}

View File

@@ -0,0 +1,15 @@
<template>
<vue-bpmn />
</template>
<script>
import VueBpmn from '@/views/components/VueBpmn';
export default {
components: {
VueBpmn
}
}
</script>
<style lang="scss" scoped>
</style>