├── babel.config.js ├── public ├── favicon.ico └── index.html ├── src ├── assets │ └── logo.png ├── views │ ├── About.vue │ └── Home.vue ├── components │ └── flow-design │ │ ├── imgs │ │ ├── shenpi.png │ │ ├── chaosong.png │ │ ├── shenpi@2x.png │ │ ├── shenpi@3x.png │ │ ├── tiaojian.png │ │ ├── chaosong@2x.png │ │ ├── chaosong@3x.png │ │ ├── tiaojian@2x.png │ │ └── tiaojian@3x.png │ │ ├── index.js │ │ ├── mixin │ │ └── util-mixin.js │ │ ├── components │ │ ├── node-wrap.vue │ │ ├── branch-wrap.vue │ │ ├── approver-node.vue │ │ ├── add-node-button.vue │ │ └── condition-node.vue │ │ └── index.vue ├── App.vue ├── utils │ └── index.js ├── main.js ├── router │ └── index.js └── mock │ └── index.js ├── images └── C7C39127-26A1-4CA7-A30E-DC8FB7007863.png ├── vue.config.js ├── .gitignore ├── README.md └── package.json /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"] 3 | }; 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /src/views/About.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/components/flow-design/imgs/shenpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/shenpi.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/chaosong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/chaosong.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/shenpi@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/shenpi@2x.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/shenpi@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/shenpi@3x.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/tiaojian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/tiaojian.png -------------------------------------------------------------------------------- /images/C7C39127-26A1-4CA7-A30E-DC8FB7007863.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/images/C7C39127-26A1-4CA7-A30E-DC8FB7007863.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/chaosong@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/chaosong@2x.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/chaosong@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/chaosong@3x.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/tiaojian@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/tiaojian@2x.png -------------------------------------------------------------------------------- /src/components/flow-design/imgs/tiaojian@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baoxiaowang/flow-design-vue/HEAD/src/components/flow-design/imgs/tiaojian@3x.png -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 19 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const resolve = dir => path.join(__dirname, dir); 3 | module.exports = { 4 | chainWebpack: config => { 5 | config.resolve.alias // 添加别名 6 | .set("@", resolve("src")) 7 | .set("src", resolve("src")); 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /src/utils/index.js: -------------------------------------------------------------------------------- 1 | export function guid() { 2 | // 生成随机码 3 | function S4() { 4 | return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); 5 | } 6 | return ( 7 | S4() + 8 | S4() + 9 | "-" + 10 | S4() + 11 | "-" + 12 | S4() + 13 | "-" + 14 | S4() + 15 | "-" + 16 | S4() + 17 | S4() + 18 | S4() 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import Vue from "vue"; 3 | import App from "./App.vue"; 4 | import router from "./router"; 5 | import ElementUI from "element-ui"; 6 | import "element-ui/lib/theme-chalk/index.css"; 7 | import "src/components/flow-design/index.js"; 8 | Vue.use(ElementUI); 9 | Vue.config.productionTip = false; 10 | 11 | new Vue({ 12 | router, 13 | render: h => h(App) 14 | }).$mount("#app"); 15 | -------------------------------------------------------------------------------- /src/components/flow-design/index.js: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import Vue from "vue"; 3 | import ConditionNode from "src/components/flow-design/components/condition-node.vue"; 4 | import NodeWrap from "src/components/flow-design/components/node-wrap.vue"; 5 | import ApproverNode from "src/components/flow-design/components/approver-node.vue"; 6 | import BranchWrap from "src/components/flow-design/components/branch-wrap.vue"; 7 | 8 | Vue.component("ConditionNode", ConditionNode); 9 | Vue.component("NodeWrap", NodeWrap); 10 | Vue.component("ApproverNode", ApproverNode); 11 | Vue.component("BranchWrap", BranchWrap); 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flow-design-vue 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 | 29 | 30 | ### Customize configuration 31 | See [Configuration Reference](https://cli.vuejs.org/config/). 32 | 33 | ![./images/C7C39127-26A1-4CA7-A30E-DC8FB7007863.png](https://github.com/baoxiaowang/flow-design-vue/blob/master/images/C7C39127-26A1-4CA7-A30E-DC8FB7007863.png) -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import VueRouter from "vue-router"; 3 | import Home from "../views/Home.vue"; 4 | 5 | Vue.use(VueRouter); 6 | 7 | const routes = [ 8 | { 9 | path: "/", 10 | name: "Home", 11 | component: Home 12 | }, 13 | { 14 | path: "/about", 15 | name: "About", 16 | // route level code-splitting 17 | // this generates a separate chunk (about.[hash].js) for this route 18 | // which is lazy-loaded when the route is visited. 19 | component: () => 20 | import(/* webpackChunkName: "about" */ "../views/About.vue") 21 | } 22 | ]; 23 | 24 | const router = new VueRouter({ 25 | mode: "history", 26 | base: process.env.BASE_URL, 27 | routes 28 | }); 29 | 30 | export default router; 31 | -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 34 | 39 | -------------------------------------------------------------------------------- /src/components/flow-design/mixin/util-mixin.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: xuwang.bao 3 | * @LastEditors: xuwang.bao 4 | * @Description: 一些公共逻辑mixin 5 | * @$emit: 6 | * @$slot: 7 | * @Date: 2019-04-09 09:43:07 8 | * @LastEditTime: 2020-09-02 13:47:50 9 | */ 10 | // @ts-ignore 11 | import AddNodeButton from "./../components/add-node-button.vue"; 12 | export default { 13 | inject: { 14 | flowIndex: { default: null }, 15 | branchWrap: { default: null }, 16 | nodeWrap: { default: null }, 17 | parentApproverNode: { default: null } 18 | }, 19 | props: { 20 | selectItem: { 21 | // 当前选中项 22 | }, 23 | parentNode: { 24 | // 父节点 25 | required: true, 26 | default: () => ({}) 27 | } 28 | }, 29 | components: { 30 | AddNodeButton 31 | }, 32 | computed: { 33 | readonly() { 34 | return this.flowIndex.readonly; 35 | }, 36 | isSelect() { 37 | // 自己是否被选中 38 | return this.nodeData === this.selectItem; 39 | } 40 | }, 41 | methods: {} 42 | }; 43 | -------------------------------------------------------------------------------- /src/mock/index.js: -------------------------------------------------------------------------------- 1 | export const processTree = { 2 | data: { 3 | addTime: 1597901005, 4 | corpid: "ding45b220254ed2e97335c2f4657eb6378f", 5 | transferText: "转交", 6 | del: 0, 7 | templateId: 1152, 8 | timeoutHandle: "", 9 | type: 1, 10 | ccPrintFlag: 0, 11 | commitPrintFlag: 0, 12 | enable: 1, 13 | appId: 218, 14 | backFlag: 0, 15 | menuId: 2913, 16 | signType: 1, 17 | endText: "结束流程", 18 | id: 8066, 19 | fieldPermissionList: [], 20 | formId: 4428, 21 | storageFlag: 1, 22 | mainUserList: [], 23 | backType: 0, 24 | opinionFlag: 0, 25 | commitText: "提交", 26 | backNodeList: [], 27 | name: "流程开始节点", 28 | prevId: "0", 29 | fieldPermission: "", 30 | ccUser: "[]", 31 | transferFlag: 0, 32 | printTemplateId: 0, 33 | creatorId: "012736392139290520", 34 | endFlag: 0, 35 | uid: "startNode", 36 | ccUserList: [], 37 | mainUser: "[]", 38 | backText: "回退", 39 | commitPrintText: "提交并打印", 40 | backNode: "[]", 41 | fieldPermissionMap: {}, 42 | storageText: "暂存", 43 | commitVerifyFlag: 1, 44 | commitFlag: 1, 45 | updateTime: 1597901005, 46 | transferUser: "[]", 47 | transferUserList: [], 48 | enableCCFlag: 0, 49 | commitVerifyCondition: "", 50 | x: 0, 51 | y: 50 52 | }, 53 | name: "流程开始节点", 54 | nodeId: "startNode", 55 | prevId: "0", 56 | type: 1 57 | }; 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flow-design-vue", 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 | "core-js": "^3.6.5", 12 | "element-ui": "^2.13.2", 13 | "vue": "^2.6.11", 14 | "vue-router": "^3.2.0" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "^4.5.0", 18 | "@vue/cli-plugin-eslint": "^4.5.0", 19 | "@vue/cli-service": "^4.5.0", 20 | "@vue/eslint-config-prettier": "^6.0.0", 21 | "babel-eslint": "^10.1.0", 22 | "eslint": "^6.7.2", 23 | "eslint-plugin-prettier": "^3.1.3", 24 | "eslint-plugin-vue": "^6.2.2", 25 | "lint-staged": "^9.5.0", 26 | "prettier": "^1.19.1", 27 | "sass": "^1.26.5", 28 | "sass-loader": "^8.0.2", 29 | "vue-template-compiler": "^2.6.11" 30 | }, 31 | "eslintConfig": { 32 | "root": true, 33 | "env": { 34 | "node": true 35 | }, 36 | "extends": [ 37 | "plugin:vue/essential", 38 | "eslint:recommended", 39 | "@vue/prettier" 40 | ], 41 | "parserOptions": { 42 | "parser": "babel-eslint" 43 | }, 44 | "rules": {} 45 | }, 46 | "browserslist": [ 47 | "> 1%", 48 | "last 2 versions", 49 | "not dead" 50 | ], 51 | "gitHooks": { 52 | "pre-commit": "lint-staged" 53 | }, 54 | "lint-staged": { 55 | "*.{js,jsx,vue}": [ 56 | "vue-cli-service lint", 57 | "git add" 58 | ] 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/components/flow-design/components/node-wrap.vue: -------------------------------------------------------------------------------- 1 | 10 | 40 | 41 | 87 | 88 | 113 | -------------------------------------------------------------------------------- /src/components/flow-design/index.vue: -------------------------------------------------------------------------------- 1 | 10 | 42 | 203 | 204 | 299 | -------------------------------------------------------------------------------- /src/components/flow-design/components/branch-wrap.vue: -------------------------------------------------------------------------------- 1 | 10 | 67 | 68 | 145 | 146 | 332 | -------------------------------------------------------------------------------- /src/components/flow-design/components/approver-node.vue: -------------------------------------------------------------------------------- 1 | 10 | 81 | 82 | 239 | 240 | 390 | -------------------------------------------------------------------------------- /src/components/flow-design/components/add-node-button.vue: -------------------------------------------------------------------------------- 1 | 10 | 44 | 45 | 334 | 335 | 389 | -------------------------------------------------------------------------------- /src/components/flow-design/components/condition-node.vue: -------------------------------------------------------------------------------- 1 | 10 | 83 | 84 | 263 | 264 | 441 | --------------------------------------------------------------------------------