├── .browserslistrc ├── .editorconfig ├── .env.development ├── .env.production ├── .env.production.sit ├── .env.production.uat ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── LICENSE ├── README.md ├── babel.config.js ├── docker ├── Dockerfile ├── docker-compose.yaml └── pig-ui.conf ├── docs └── screen │ ├── pig-home.png │ ├── pig-login.png │ └── pig-menus.png ├── package.json ├── public ├── cdn │ ├── animate │ │ └── 3.5.2 │ │ │ └── animate.css │ ├── avue │ │ └── avue.css │ └── store │ │ └── 1.3.20 │ │ └── store.js ├── favicon.ico ├── img │ └── logo.png ├── index.html └── svg │ └── loading-spin.svg ├── src ├── App.vue ├── api │ ├── admin │ │ ├── client.js │ │ ├── dept.js │ │ ├── dict.js │ │ ├── log.js │ │ ├── menu.js │ │ ├── role.js │ │ ├── token.js │ │ └── user.js │ ├── gen │ │ ├── form.js │ │ └── gen.js │ └── login.js ├── background.js ├── components │ ├── basic-container │ │ └── main.vue │ ├── editor │ │ ├── LICENSE │ │ └── index.vue │ ├── error-page │ │ ├── 403.vue │ │ ├── 404.vue │ │ └── 500.vue │ └── iframe │ │ └── main.vue ├── config │ └── env.js ├── const │ ├── crud │ │ ├── admin │ │ │ ├── client.js │ │ │ ├── dict.js │ │ │ ├── log.js │ │ │ ├── role.js │ │ │ ├── token.js │ │ │ └── user.js │ │ └── gen │ │ │ ├── form.js │ │ │ └── gen.js │ ├── errorCode.js │ ├── iconList.js │ └── website.js ├── error.js ├── filters │ └── index.js ├── main.js ├── mixins │ └── color.js ├── page │ ├── index │ │ ├── index.vue │ │ ├── layout.vue │ │ ├── logo.vue │ │ ├── sidebar │ │ │ ├── config.js │ │ │ ├── index.vue │ │ │ └── sidebarItem.vue │ │ ├── tags.vue │ │ └── top │ │ │ ├── index.vue │ │ │ └── top-menu.vue │ ├── login │ │ ├── index.vue │ │ └── userlogin.vue │ └── wel.vue ├── permission.js ├── router │ ├── avue-router.js │ ├── axios.js │ ├── page │ │ └── index.js │ ├── router.js │ └── views │ │ └── index.js ├── store │ ├── getters.js │ ├── index.js │ └── modules │ │ ├── common.js │ │ ├── tags.js │ │ └── user.js ├── styles │ ├── animate │ │ └── vue-transition.scss │ ├── common.scss │ ├── element-ui.scss │ ├── login.scss │ ├── media.scss │ ├── mixin.scss │ ├── normalize.scss │ ├── sidebar.scss │ ├── tags.scss │ ├── top.scss │ └── variables.scss ├── util │ ├── admin.js │ ├── date.js │ ├── store.js │ ├── util.js │ └── validate.js └── views │ ├── admin │ ├── client │ │ └── index.vue │ ├── dept │ │ └── index.vue │ ├── dict │ │ └── index.vue │ ├── log │ │ └── index.vue │ ├── menu │ │ ├── index.vue │ │ └── menu-form.vue │ ├── role │ │ └── index.vue │ ├── token │ │ └── index.vue │ └── user │ │ ├── index.vue │ │ └── info.vue │ └── gen │ ├── datasource.vue │ ├── design.vue │ ├── form.vue │ ├── index.vue │ └── preview.vue └── vue.config.js /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | insert_final_newline = false 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | NODE_ENV=development 2 | VUE_APP_NODE_ENV=dev 3 | VUE_APP_API_URL='http://pig-gateway:9999' 4 | -------------------------------------------------------------------------------- /.env.production: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | VUE_APP_NODE_ENV=prod 3 | VUE_APP_API_URL='http://pig-gateway:9999' 4 | -------------------------------------------------------------------------------- /.env.production.sit: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | VUE_APP_NODE_ENV=prod:sit 3 | VUE_APP_API_URL='http://pig-gateway:9999' 4 | -------------------------------------------------------------------------------- /.env.production.uat: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | VUE_APP_NODE_ENV=prod:uat 3 | VUE_APP_API_URL='http://pig-gateway:9999' 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | "plugin:vue/essential" 8 | ], 9 | rules: { 10 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 11 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 12 | }, 13 | parserOptions: { 14 | parser: 'babel-eslint' 15 | } 16 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | /tests/e2e/videos/ 6 | /tests/e2e/screenshots/ 7 | 8 | # local env files 9 | .env.local 10 | .env.*.local 11 | 12 | # Log files 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # Editor directories and files 18 | .idea 19 | .vscode 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw* 25 | 26 | # Lock File 27 | package-lock.json 28 | yarn.lock 29 | 30 | #Electron-builder output 31 | /dist_electron -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## pig-ui electron 版本 2 | 3 | 此项目是 [pig-ui](https://github.com/pig-mesh/pig-ui) 的`electron`移植版 4 | 5 | 6 | ### 开发环境 7 | 8 | 安装依赖 9 | 10 | ```shell script 11 | yarn 12 | ``` 13 | 或者 14 | ```shell script 15 | npm i 16 | ``` 17 | 18 | 修改`.env.development`文件中的`VUE_APP_API_URL`参数,它表示后端服务的地址。然后可以跑起来了: 19 | 20 | ```shell script 21 | yarn electron:dev 22 | ``` 23 | 24 | > 启动过程可能有点慢,需要等一会。 25 | 26 | 27 | ### 打包 28 | 29 | 打包预设了3种环境: 30 | 31 | - 集成测试 `prod:sit` 32 | - 验收测试 `prod:uat` 33 | - 生产环境 `prod` 34 | 35 | 对应的配置文件`.env.development.sit`、.env.development.uat`、.env.development`,你需要修改里面的`VUE_APP_API_URL`参数,填上服务端地址。 36 | 37 | 根据你的需要进行打包: 38 | 39 | ```shell script 40 | yarn electron:build:sit 41 | yarn electron:build:uat 42 | yarn electron:build:prod 43 | ``` 44 | 45 | ### 命令行参数 46 | 47 | `--url ${URL}` 以外部URL启动,比如 `pig-ui.exe --url https://pigx.pig4cloud.com/` 一般用于测试。 48 | 49 | ### 效果演示 50 | 51 | ![login](docs/screen/pig-login.png) 52 | 53 | ![login](docs/screen/pig-home.png) 54 | 55 | ![login](docs/screen/pig-menus.png) -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | 3 | COPY ./dist /data 4 | 5 | RUN rm /etc/nginx/conf.d/default.conf 6 | 7 | ADD pig-ui.conf /etc/nginx/conf.d/ 8 | 9 | RUN /bin/bash -c 'echo init ok' -------------------------------------------------------------------------------- /docker/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | pig-ui: 4 | build: 5 | context: . 6 | restart: always 7 | container_name: pig-ui 8 | image: pig-ui 9 | networks: 10 | - pig_default 11 | external_links: 12 | - pig-gateway 13 | ports: 14 | - 80:80 15 | 16 | # 加入到后端网络, 默认为 pig_default | docker network ls 查看 17 | networks: 18 | pig_default: 19 | external: true -------------------------------------------------------------------------------- /docker/pig-ui.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | 5 | # 打包好的dist目录文件,放置到这个目录下 6 | root /data/; 7 | 8 | location ~* ^/(code|auth|admin|gen) { 9 | proxy_pass http://pig-gateway:9999; 10 | #proxy_set_header Host $http_host; 11 | proxy_connect_timeout 15s; 12 | proxy_send_timeout 15s; 13 | proxy_read_timeout 15s; 14 | proxy_set_header X-Forwarded-Proto http; 15 | proxy_set_header X-Real-IP $remote_addr; 16 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 17 | } 18 | } -------------------------------------------------------------------------------- /docs/screen/pig-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pig-mesh/pig-ui-electron/c4dc926b4cccf38aa588c7473da777ac85563443/docs/screen/pig-home.png -------------------------------------------------------------------------------- /docs/screen/pig-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pig-mesh/pig-ui-electron/c4dc926b4cccf38aa588c7473da777ac85563443/docs/screen/pig-login.png -------------------------------------------------------------------------------- /docs/screen/pig-menus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pig-mesh/pig-ui-electron/c4dc926b4cccf38aa588c7473da777ac85563443/docs/screen/pig-menus.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pig-ui", 3 | "version": "3.2.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "vue-cli-service build", 7 | "lint": "vue-cli-service lint", 8 | "dev": "vue-cli-service serve", 9 | "electron:build:prod": "vue-cli-service electron:build --mode production", 10 | "electron:build:sit": "vue-cli-service electron:build --mode production.sit", 11 | "electron:build:uat": "vue-cli-service electron:build --mode production.uat", 12 | "electron:dev": "vue-cli-service electron:serve", 13 | "postinstall": "electron-builder install-app-deps", 14 | "postuninstall": "electron-builder install-app-deps", 15 | "pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org " 16 | }, 17 | "main": "background.js", 18 | "dependencies": { 19 | "@riophae/vue-treeselect": "^0.4.0", 20 | "@smallwei/avue": "2.6.18", 21 | "@sscfaith/avue-form-design": "1.3.12", 22 | "avue-plugin-ueditor": "^0.0.6", 23 | "axios": "0.19.0", 24 | "babel-polyfill": "^6.26.0", 25 | "classlist-polyfill": "^1.2.0", 26 | "codemirror": "^5.58.1", 27 | "crypto-js": "^3.1.9-1", 28 | "element-ui": "^2.13.2", 29 | "nprogress": "^0.2.0", 30 | "script-loader": "^0.7.2", 31 | "vue": "^2.6.10", 32 | "vue-axios": "^2.1.4", 33 | "vue-router": "^3.1.3", 34 | "vuex": "^3.2.0" 35 | }, 36 | "devDependencies": { 37 | "@vue/cli-plugin-babel": "^3.12.0", 38 | "@vue/cli-service": "^3.12.0", 39 | "chai": "^4.2.0", 40 | "electron": "^9.0.0", 41 | "electron-devtools-installer": "^3.1.0", 42 | "node-sass": "^4.12.0", 43 | "sass-loader": "^8.0.0", 44 | "vue-cli-plugin-electron-builder": "~2.0.0-rc.4", 45 | "vue-template-compiler": "^2.6.10" 46 | }, 47 | "lint-staged": { 48 | "*.js": [ 49 | "vue-cli-service lint", 50 | "git add" 51 | ], 52 | "*.vue": [ 53 | "vue-cli-service lint", 54 | "git add" 55 | ] 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /public/cdn/avue/avue.css: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #app { 4 | height: 100%; 5 | margin: 0; 6 | padding: 0; 7 | } 8 | 9 | .avue-home { 10 | background-color: #303133; 11 | height: 100%; 12 | display: flex; 13 | flex-direction: column; 14 | } 15 | 16 | .avue-home__main { 17 | user-select: none; 18 | width: 100%; 19 | flex-grow: 1; 20 | display: flex; 21 | justify-content: center; 22 | align-items: center; 23 | flex-direction: column; 24 | } 25 | 26 | .avue-home__footer { 27 | width: 100%; 28 | flex-grow: 0; 29 | text-align: center; 30 | padding: 1em 0; 31 | } 32 | 33 | .avue-home__footer > a { 34 | font-size: 12px; 35 | color: #ABABAB; 36 | text-decoration: none; 37 | } 38 | 39 | .avue-home__loading { 40 | height: 32px; 41 | width: 32px; 42 | margin-bottom: 20px; 43 | } 44 | 45 | .avue-home__title { 46 | color: #FFF; 47 | font-size: 14px; 48 | margin-bottom: 10px; 49 | } 50 | 51 | .avue-home__sub-title { 52 | color: #ABABAB; 53 | font-size: 12px; 54 | } 55 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pig-mesh/pig-ui-electron/c4dc926b4cccf38aa588c7473da777ac85563443/public/favicon.ico -------------------------------------------------------------------------------- /public/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pig-mesh/pig-ui-electron/c4dc926b4cccf38aa588c7473da777ac85563443/public/img/logo.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | pig微服务快速开发框架 16 | 17 | 22 | 23 | 24 | 25 | 28 |
29 |
30 |
31 | loading 32 |
33 | 正在加载资源 34 |
35 |
36 | 初次加载资源可能需要较多时间 请耐心等待 37 |
38 |
39 | 43 |
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /public/svg/loading-spin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 20 | 27 | -------------------------------------------------------------------------------- /src/api/admin/client.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList (query) { 21 | return request({ 22 | url: '/admin/client/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function addObj (obj) { 29 | return request({ 30 | url: '/admin/client', 31 | method: 'post', 32 | data: obj 33 | }) 34 | } 35 | 36 | export function getObj (id) { 37 | return request({ 38 | url: '/admin/client/' + id, 39 | method: 'get' 40 | }) 41 | } 42 | 43 | export function delObj (id) { 44 | return request({ 45 | url: '/admin/client/' + id, 46 | method: 'delete' 47 | }) 48 | } 49 | 50 | export function putObj (obj) { 51 | return request({ 52 | url: '/admin/client', 53 | method: 'put', 54 | data: obj 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /src/api/admin/dept.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchDeptTree (query) { 21 | return request({ 22 | url: '/admin/dept/user-tree', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function fetchTree (query) { 29 | return request({ 30 | url: '/admin/dept/tree', 31 | method: 'get', 32 | params: query 33 | }) 34 | } 35 | 36 | export function addObj (obj) { 37 | return request({ 38 | url: '/admin/dept', 39 | method: 'post', 40 | data: obj 41 | }) 42 | } 43 | 44 | export function getObj (id) { 45 | return request({ 46 | url: '/admin/dept/' + id, 47 | method: 'get' 48 | }) 49 | } 50 | 51 | export function delObj (id) { 52 | return request({ 53 | url: '/admin/dept/' + id, 54 | method: 'delete' 55 | }) 56 | } 57 | 58 | export function putObj (obj) { 59 | return request({ 60 | url: '/admin/dept', 61 | method: 'put', 62 | data: obj 63 | }) 64 | } 65 | 66 | export function getdetails (obj) { 67 | return request({ 68 | url: '/admin/dept/details/' + obj, 69 | method: 'get' 70 | }) 71 | } 72 | 73 | -------------------------------------------------------------------------------- /src/api/admin/dict.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList(query) { 21 | return request({ 22 | url: '/admin/dict/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function fetchItemList(query) { 29 | return request({ 30 | url: '/admin/dict/item/page', 31 | method: 'get', 32 | params: query 33 | }) 34 | } 35 | 36 | export function addItemObj(obj) { 37 | return request({ 38 | url: '/admin/dict/item', 39 | method: 'post', 40 | data: obj 41 | }) 42 | } 43 | 44 | export function getItemObj(id) { 45 | return request({ 46 | url: '/admin/dict/item/' + id, 47 | method: 'get' 48 | }) 49 | } 50 | 51 | export function delItemObj(id) { 52 | return request({ 53 | url: '/admin/dict/item/' + id, 54 | method: 'delete' 55 | }) 56 | } 57 | 58 | export function putItemObj(obj) { 59 | return request({ 60 | url: '/admin/dict/item', 61 | method: 'put', 62 | data: obj 63 | }) 64 | } 65 | 66 | export function addObj(obj) { 67 | return request({ 68 | url: '/admin/dict/', 69 | method: 'post', 70 | data: obj 71 | }) 72 | } 73 | 74 | export function getObj(id) { 75 | return request({ 76 | url: '/admin/dict/' + id, 77 | method: 'get' 78 | }) 79 | } 80 | 81 | export function delObj(row) { 82 | return request({ 83 | url: '/admin/dict/' + row.id, 84 | method: 'delete' 85 | }) 86 | } 87 | 88 | export function putObj(obj) { 89 | return request({ 90 | url: '/admin/dict/', 91 | method: 'put', 92 | data: obj 93 | }) 94 | } 95 | 96 | export function remote(type) { 97 | return request({ 98 | url: '/admin/dict/type/' + type, 99 | method: 'get' 100 | }) 101 | } 102 | -------------------------------------------------------------------------------- /src/api/admin/log.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList (query) { 21 | return request({ 22 | url: '/admin/log/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function delObj (id) { 29 | return request({ 30 | url: '/admin/log/' + id, 31 | method: 'delete' 32 | }) 33 | } 34 | 35 | export function addObj (obj) { 36 | return request({ 37 | url: '/admin/log', 38 | method: 'post', 39 | data: obj 40 | }) 41 | } 42 | 43 | export function getObj (id) { 44 | return request({ 45 | url: '/admin/log/' + id, 46 | method: 'get' 47 | }) 48 | } 49 | 50 | export function putObj (obj) { 51 | return request({ 52 | url: '/admin/log', 53 | method: 'put', 54 | data: obj 55 | }) 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/api/admin/menu.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function getMenu(id) { 21 | return request({ 22 | url: '/admin/menu', 23 | params: {parentId: id}, 24 | method: 'get' 25 | }) 26 | } 27 | 28 | export function fetchMenuTree(lazy, parentId) { 29 | return request({ 30 | url: '/admin/menu/tree', 31 | method: 'get', 32 | params: {lazy: lazy, parentId: parentId} 33 | }) 34 | } 35 | 36 | export function addObj(obj) { 37 | return request({ 38 | url: '/admin/menu', 39 | method: 'post', 40 | data: obj 41 | }) 42 | } 43 | 44 | export function getObj(id) { 45 | return request({ 46 | url: '/admin/menu/' + id, 47 | method: 'get' 48 | }) 49 | } 50 | 51 | export function delObj(id) { 52 | return request({ 53 | url: '/admin/menu/' + id, 54 | method: 'delete' 55 | }) 56 | } 57 | 58 | export function putObj(obj) { 59 | return request({ 60 | url: '/admin/menu', 61 | method: 'put', 62 | data: obj 63 | }) 64 | } 65 | -------------------------------------------------------------------------------- /src/api/admin/role.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList (query) { 21 | return request({ 22 | url: '/admin/role/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function deptRoleList () { 29 | return request({ 30 | url: '/admin/role/list', 31 | method: 'get' 32 | }) 33 | } 34 | 35 | export function getObj (id) { 36 | return request({ 37 | url: '/admin/role/' + id, 38 | method: 'get' 39 | }) 40 | } 41 | 42 | export function addObj (obj) { 43 | return request({ 44 | url: '/admin/role', 45 | method: 'post', 46 | data: obj 47 | }) 48 | } 49 | 50 | export function putObj (obj) { 51 | return request({ 52 | url: '/admin/role', 53 | method: 'put', 54 | data: obj 55 | }) 56 | } 57 | 58 | export function delObj (id) { 59 | return request({ 60 | url: '/admin/role/' + id, 61 | method: 'delete' 62 | }) 63 | } 64 | 65 | export function permissionUpd (roleId, menuIds) { 66 | return request({ 67 | url: '/admin/role/menu', 68 | method: 'put', 69 | data: { 70 | roleId: roleId, 71 | menuIds: menuIds 72 | } 73 | }) 74 | } 75 | 76 | export function fetchRoleTree (roleName) { 77 | return request({ 78 | url: '/admin/menu/tree/' + roleName, 79 | method: 'get' 80 | }) 81 | } 82 | -------------------------------------------------------------------------------- /src/api/admin/token.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList (query) { 21 | return request({ 22 | url: '/admin/token/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function delObj (token) { 29 | return request({ 30 | url: '/admin/token/' + token, 31 | method: 'delete' 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /src/api/admin/user.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList (query) { 21 | return request({ 22 | url: '/admin/user/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function addObj (obj) { 29 | return request({ 30 | url: '/admin/user', 31 | method: 'post', 32 | data: obj 33 | }) 34 | } 35 | 36 | export function getObj (id) { 37 | return request({ 38 | url: '/admin/user/' + id, 39 | method: 'get' 40 | }) 41 | } 42 | 43 | export function delObj (id) { 44 | return request({ 45 | url: '/admin/user/' + id, 46 | method: 'delete' 47 | }) 48 | } 49 | 50 | export function putObj (obj) { 51 | return request({ 52 | url: '/admin/user', 53 | method: 'put', 54 | data: obj 55 | }) 56 | } 57 | 58 | export function getDetails (obj) { 59 | return request({ 60 | url: '/admin/user/details/' + obj, 61 | method: 'get' 62 | }) 63 | } 64 | -------------------------------------------------------------------------------- /src/api/gen/form.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, test All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: test 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList(query) { 21 | return request({ 22 | url: '/gen/form/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function addObj(obj) { 29 | return request({ 30 | url: '/gen/form', 31 | method: 'post', 32 | data: obj 33 | }) 34 | } 35 | 36 | export function getObj(id) { 37 | return request({ 38 | url: '/gen/form/' + id, 39 | method: 'get' 40 | }) 41 | } 42 | 43 | export function delObj(id) { 44 | return request({ 45 | url: '/gen/form/' + id, 46 | method: 'delete' 47 | }) 48 | } 49 | 50 | export function putObj(obj) { 51 | return request({ 52 | url: '/gen/form', 53 | method: 'put', 54 | data: obj 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /src/api/gen/gen.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, test All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng 16 | */ 17 | 18 | import request from '@/router/axios' 19 | 20 | export function fetchList(query) { 21 | return request({ 22 | url: '/gen/generator/page', 23 | method: 'get', 24 | params: query 25 | }) 26 | } 27 | 28 | export function preview(table) { 29 | return request({ 30 | url: '/gen/generator/preview', 31 | method: 'get', 32 | params: table 33 | }) 34 | } 35 | 36 | export function fetchDsList(query) { 37 | return request({ 38 | url: '/gen/dsconf/page', 39 | method: 'get', 40 | params: query 41 | }) 42 | } 43 | 44 | export function fetchSelectDsList() { 45 | return request({ 46 | url: '/gen/dsconf/list', 47 | method: 'get' 48 | }) 49 | } 50 | 51 | export function addObj(obj) { 52 | return request({ 53 | url: '/gen/dsconf/', 54 | method: 'post', 55 | data: obj 56 | }) 57 | } 58 | 59 | export function getObj(id) { 60 | return request({ 61 | url: '/gen/dsconf/' + id, 62 | method: 'get' 63 | }) 64 | } 65 | 66 | export function delObj(id) { 67 | return request({ 68 | url: '/gen/dsconf/' + id, 69 | method: 'delete' 70 | }) 71 | } 72 | 73 | export function putObj(obj) { 74 | return request({ 75 | url: '/gen/dsconf/', 76 | method: 'put', 77 | data: obj 78 | }) 79 | } 80 | 81 | export function handleDown(table) { 82 | return request({ 83 | url: '/gen/generator/code', 84 | method: 'post', 85 | data: table, 86 | responseType: 'arraybuffer' 87 | }).then((response) => { // 处理返回的文件流 88 | const blob = new Blob([response.data], { type: 'application/zip' }) 89 | const filename = table.tableName + '.zip' 90 | const link = document.createElement('a') 91 | link.href = URL.createObjectURL(blob) 92 | link.download = filename 93 | document.body.appendChild(link) 94 | link.click() 95 | window.setTimeout(function () { 96 | URL.revokeObjectURL(blob) 97 | document.body.removeChild(link) 98 | }, 0) 99 | }) 100 | } 101 | 102 | 103 | export function getForm(tableName, dsName) { 104 | return request({ 105 | url: '/gen/form/info', 106 | params: { tableName: tableName, dsName: dsName }, 107 | method: 'get' 108 | }) 109 | } 110 | 111 | export function postForm(formInfo, tableName, dsId) { 112 | return request({ 113 | url: '/gen/form/', 114 | method: 'post', 115 | data: Object.assign({ formInfo, tableName, dsId }) 116 | }) 117 | } 118 | 119 | -------------------------------------------------------------------------------- /src/api/login.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | import request from '@/router/axios' 18 | const scope = 'server' 19 | 20 | export const loginByUsername = (username, password, code, randomStr) => { 21 | const grant_type = 'password' 22 | 23 | return request({ 24 | url: '/auth/oauth/token', 25 | headers: { 26 | isToken:false, 27 | 'Authorization': 'Basic cGlnOnBpZw==' 28 | }, 29 | method: 'post', 30 | params: { username, password, randomStr, code, grant_type, scope } 31 | }) 32 | } 33 | 34 | export const refreshToken = (refresh_token) => { 35 | const grant_type = 'refresh_token' 36 | return request({ 37 | url: '/auth/oauth/token', 38 | headers: { 39 | 'isToken': false, 40 | 'Authorization': 'Basic cGlnOnBpZw==', 41 | }, 42 | method: 'post', 43 | params: { refresh_token, grant_type, scope } 44 | }) 45 | } 46 | 47 | export const getUserInfo = () => { 48 | return request({ 49 | url: '/admin/user/info', 50 | method: 'get' 51 | }) 52 | } 53 | 54 | export const logout = () => { 55 | return request({ 56 | url: '/auth/token/logout', 57 | method: 'delete' 58 | }) 59 | } 60 | -------------------------------------------------------------------------------- /src/background.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import { app, protocol, BrowserWindow } from 'electron' 4 | import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' 5 | import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer' 6 | const isDevelopment = process.env.NODE_ENV !== 'production' 7 | const parseArgs = require('minimist') 8 | const args = parseArgs(process.argv.slice(1), {string: ['url']}) 9 | // Keep a global reference of the window object, if you don't, the window will 10 | // be closed automatically when the JavaScript object is garbage collected. 11 | let win 12 | 13 | // Scheme must be registered before the app is ready 14 | protocol.registerSchemesAsPrivileged([ 15 | { scheme: 'app', privileges: { secure: true, standard: true } } 16 | ]) 17 | 18 | function createWindow() { 19 | // Create the browser window. 20 | win = new BrowserWindow({ 21 | width: 1440, 22 | height: 900, 23 | webPreferences: { 24 | // Use pluginOptions.nodeIntegration, leave this alone 25 | // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info 26 | nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, 27 | webSecurity: false 28 | } 29 | }) 30 | let url = args.url 31 | if (process.env.WEBPACK_DEV_SERVER_URL) { 32 | // Load the url of the dev server if in development mode 33 | win.loadURL(process.env.WEBPACK_DEV_SERVER_URL) 34 | if (!process.env.IS_TEST) win.webContents.openDevTools() 35 | } else { 36 | if(url) { 37 | console.log(`load form url ${url}`) 38 | win.loadURL(url) 39 | } else { 40 | createProtocol('app') 41 | // Load the index.html when not in development 42 | win.loadURL('app://./index.html') 43 | } 44 | } 45 | 46 | win.on('closed', () => { 47 | win = null 48 | }) 49 | } 50 | 51 | // Quit when all windows are closed. 52 | app.on('window-all-closed', () => { 53 | // On macOS it is common for applications and their menu bar 54 | // to stay active until the user quits explicitly with Cmd + Q 55 | if (process.platform !== 'darwin') { 56 | app.quit() 57 | } 58 | }) 59 | 60 | app.on('activate', () => { 61 | // On macOS it's common to re-create a window in the app when the 62 | // dock icon is clicked and there are no other windows open. 63 | if (win === null) { 64 | createWindow() 65 | } 66 | }) 67 | 68 | // This method will be called when Electron has finished 69 | // initialization and is ready to create browser windows. 70 | // Some APIs can only be used after this event occurs. 71 | app.on('ready', async () => { 72 | if (isDevelopment && !process.env.IS_TEST) { 73 | // Install Vue Devtools 74 | try { 75 | await installExtension(VUEJS_DEVTOOLS) 76 | } catch (e) { 77 | console.error('Vue Devtools failed to install:', e.toString()) 78 | } 79 | } 80 | createWindow() 81 | }) 82 | 83 | // Exit cleanly on request from parent process in development mode. 84 | if (isDevelopment) { 85 | if (process.platform === 'win32') { 86 | process.on('message', (data) => { 87 | if (data === 'graceful-exit') { 88 | app.quit() 89 | } 90 | }) 91 | } else { 92 | process.on('SIGTERM', () => { 93 | app.quit() 94 | }) 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/components/basic-container/main.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 21 | 22 | 41 | -------------------------------------------------------------------------------- /src/components/editor/index.vue: -------------------------------------------------------------------------------- 1 |