├── .browserslistrc ├── .eslintrc.js ├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── factory.svg │ └── logo.png ├── commen │ ├── api.js │ ├── commen.js │ └── url.js ├── components │ ├── FlowEditor.vue │ ├── FlowPanelDefault.vue │ ├── FlowPanelNode.vue │ ├── FlowPanelNodeValue.vue │ ├── ItemList.vue │ └── flowPanelNodeChilds │ │ ├── FlowPanelNodeAction.vue │ │ ├── FlowPanelNodeAuth.vue │ │ └── FlowPanelNodeRes.vue ├── main.js ├── router.js ├── store.js └── views │ ├── flowDesign.vue │ ├── formDesign.vue │ ├── g6Editor.vue │ ├── home.vue │ ├── test.vue │ └── test1.vue └── vue.config.js /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # g6-edit 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | npm run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "g6-edit", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@antv/g": "^3.4.6", 12 | "@antv/g6": "^3.0.4", 13 | "ahaapi": "^3.0.0", 14 | "core-js": "^2.6.5", 15 | "element-ui": "^2.10.1", 16 | "vue": "^2.6.10", 17 | "vue-router": "^3.0.3", 18 | "vuex": "^3.0.1" 19 | }, 20 | "devDependencies": { 21 | "@vue/cli-plugin-babel": "^3.9.2", 22 | "@vue/cli-plugin-eslint": "^3.9.2", 23 | "@vue/cli-service": "^3.9.2", 24 | "babel-eslint": "^10.0.1", 25 | "eslint": "^5.16.0", 26 | "eslint-plugin-vue": "^5.0.0", 27 | "node-sass": "^4.9.0", 28 | "sass-loader": "^7.1.0", 29 | "vue-template-compiler": "^2.6.10" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cometang/vue-g6-editor/bb6447c958541169c8a44a42a533d270bf3b751b/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 工作流引擎编辑器 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 21 | -------------------------------------------------------------------------------- /src/assets/factory.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cometang/vue-g6-editor/bb6447c958541169c8a44a42a533d270bf3b751b/src/assets/logo.png -------------------------------------------------------------------------------- /src/commen/api.js: -------------------------------------------------------------------------------- 1 | import util from 'ahaapi' 2 | import baseUrl from './url' 3 | 4 | // let appId = process.env.appID;//应用编号 5 | // let appId =''; 6 | 7 | 8 | let api = {}; 9 | console.log('开始调用ctrl'); 10 | 11 | //创建表结构 12 | api.createTableSchema= function (cnt,callback) { 13 | util.call(baseUrl+'/flow/createTableSchema', cnt, callback) 14 | } 15 | 16 | export default api 17 | 18 | -------------------------------------------------------------------------------- /src/commen/commen.js: -------------------------------------------------------------------------------- 1 | 2 | const commen={} 3 | 4 | /** @getFormulaResult 根据计算公式返回计算完成的值 5 | * @item 一行的对应数据数据 Object (键值对) 6 | * @formula 对应的计算公式 String 7 | * @return 计算完成的数值 8 | * */ 9 | commen.getFormulaResult=function (item,formula) { 10 | /** 获取第一个变量的位置*/ 11 | let start = formula.indexOf('{{') 12 | let end = formula.indexOf('}}') 13 | 14 | while (start !=-1){ 15 | let variable = formula.substring(start+2,end) 16 | let str = '' 17 | /** 获取变量对应的值*/ 18 | let val = item[variable] 19 | if(val == undefined || val ==null || val == ''){ 20 | val = 0 21 | } 22 | /**如果起点是0 的情况*/ 23 | if(start == 0){ 24 | str = formula.substr(end+2) 25 | str = val+str 26 | }else{ 27 | /** 起点不是0的情况 拼接 左--中(对应的值)--右 字符串 */ 28 | let str1 = formula.substring(0,start) 29 | let str2 = val 30 | let str3 = formula.substr(end+2) 31 | str = str1+str2+str3 32 | } 33 | /** 重置字符串替换变量为对应值*/ 34 | formula = str 35 | start = formula.indexOf('{{') 36 | end = formula.indexOf('}}') 37 | } 38 | /** 返回计算完成的值*/ 39 | let value = eval(formula) 40 | return value 41 | } 42 | 43 | 44 | export default { 45 | commen 46 | } 47 | -------------------------------------------------------------------------------- /src/commen/url.js: -------------------------------------------------------------------------------- 1 | 2 | // const baseUrl = 'http://47.99.212.32/api/jiti'; //正式服请求地址前缀 3 | // const baseUrl = 'http://192.168.1.163:8080/dv'; //本地请求地址前缀 4 | const baseUrl = 'http://47.99.209.235/dv'; //测试服请求地址前缀 5 | 6 | 7 | export default baseUrl 8 | -------------------------------------------------------------------------------- /src/components/FlowEditor.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 240 | 241 | 244 | -------------------------------------------------------------------------------- /src/components/FlowPanelDefault.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 34 | 35 | 107 | -------------------------------------------------------------------------------- /src/components/FlowPanelNode.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 254 | 255 | 294 | -------------------------------------------------------------------------------- /src/components/FlowPanelNodeValue.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 63 | 64 | 67 | -------------------------------------------------------------------------------- /src/components/ItemList.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 104 | 105 | 112 | -------------------------------------------------------------------------------- /src/components/flowPanelNodeChilds/FlowPanelNodeAction.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /src/components/flowPanelNodeChilds/FlowPanelNodeAuth.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 33 | 34 | 55 | -------------------------------------------------------------------------------- /src/components/flowPanelNodeChilds/FlowPanelNodeRes.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 56 | 57 | 77 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | 6 | import ElementUI from 'element-ui'; 7 | import 'element-ui/lib/theme-chalk/index.css'; 8 | import api from './commen/api' 9 | import commen from './commen/commen' 10 | 11 | Vue.use(ElementUI) 12 | Vue.config.productionTip = false 13 | 14 | 15 | Vue.prototype.$commen = commen.commen 16 | Vue.prototype.$api = api 17 | 18 | new Vue({ 19 | router, 20 | store, 21 | render: h => h(App) 22 | }).$mount('#app') 23 | -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import home from './views/home' 4 | 5 | const test = () => import('./views/test') 6 | const test1 =()=> import('./views/test1') 7 | const formDesign =()=>import('./views/formDesign') 8 | const flowDesign =()=>import('./views/flowDesign') 9 | 10 | 11 | const g6Editor =()=>import('./views/g6Editor') 12 | 13 | 14 | Vue.use(Router) 15 | 16 | export default new Router({ 17 | mode: 'hash', 18 | base: process.env.BASE_URL, 19 | routes: [ 20 | { 21 | path: '/', 22 | name: 'home', 23 | component: home 24 | }, 25 | { 26 | path:'/formDesign', 27 | name:'formDesign', 28 | component:formDesign 29 | }, 30 | { 31 | path:'/flowDesign', 32 | name:'flowDesign', 33 | component:flowDesign 34 | }, 35 | { 36 | path:'/g6Editor', 37 | name:'g6Editor', 38 | component:g6Editor 39 | }, 40 | { 41 | path: '/test', 42 | name: 'test', 43 | component: test 44 | }, 45 | { 46 | path:'/test1', 47 | name:'test1', 48 | component:test1 49 | } 50 | ] 51 | }) 52 | -------------------------------------------------------------------------------- /src/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | flowData:{ 9 | graph:'', 10 | /*选中节点*/ 11 | graphActive:{ 12 | graphId:'', 13 | graphLabel:'', 14 | graphType:'', 15 | } 16 | } 17 | }, 18 | mutations: { 19 | 20 | }, 21 | actions: { 22 | 23 | } 24 | }) 25 | -------------------------------------------------------------------------------- /src/views/flowDesign.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 64 | 65 | 190 | -------------------------------------------------------------------------------- /src/views/formDesign.vue: -------------------------------------------------------------------------------- 1 | 245 | 246 | 536 | 537 | 664 | -------------------------------------------------------------------------------- /src/views/g6Editor.vue: -------------------------------------------------------------------------------- 1 | 102 | 103 | 642 | 643 | 766 | -------------------------------------------------------------------------------- /src/views/home.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 33 | 34 | 113 | -------------------------------------------------------------------------------- /src/views/test.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 280 | 281 | 307 | -------------------------------------------------------------------------------- /src/views/test1.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 397 | 398 | 421 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | // vue.config.js 2 | module.exports = { 3 | publicPath: process.env.NODE_ENV === 'production' 4 | ? './' 5 | : './' 6 | 7 | } 8 | --------------------------------------------------------------------------------