# RuoYi-Vue-Postgresql-Electron **Repository Path**: suxia2/ruo-yi-vue-postgresql-electron ## Basic Information - **Project Name**: RuoYi-Vue-Postgresql-Electron - **Description**: 若依 postgresql 版本的桌面版,主要集成了 web 桌面打印. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 76 - **Forks**: 28 - **Created**: 2022-01-10 - **Last Updated**: 2025-06-15 ## Categories & Tags **Categories**: backend **Tags**: None ## README # RuoYi-Vue-Postgresql-Electron #### 介绍 若依 postgresql 版本的桌面版,主要集成了 web 静默打印. #### 环境说明 1. nodejs 版本为 16.13.0 以上,如果该版本以下,[请使用electron4分支中的代码](https://gitee.com/suxia2/ruo-yi-vue-postgresql-electron/tree/electron4/). ### 修改说明 1. **此项目对应sql文件只需执行前两个. 为** 1. **[postgresql.sql](https://gitee.com/suxia2/RuoYi-Vue-Postgresql/blob/master/sql/postgresql.sql)** 2. **[postgresql_view.sql](https://gitee.com/suxia2/RuoYi-Vue-Postgresql/blob/master/sql/postgresql_view.sql)** 3. **[quartz.sql](https://gitee.com/suxia2/RuoYi-Vue-Postgresql/blob/master/sql/quartz.sql) 与[ry_20210908.sql](https://gitee.com/suxia2/RuoYi-Vue-Postgresql/blob/master/sql/ry_20210908.sql) 不需要执行 是mysql语法的,用于比对官方项目的sql文件更新.** 2. **如此项目报错请在 issue 中提问** ### 已知bug 1. 打包后无法引用 "clipboard", 把以下文件内容全部注释掉 ``` /src/directive/module/clipboard.js ``` #### 前端使用 ```bash # 克隆项目 git clone https://gitee.com/suxia2/ruo-yi-vue-postgresql-electron # 进入项目目录 cd ruoyi-ui # 安装依赖 npm install # 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 npm install --registry=https://registry.npm.taobao.org # 启动服务 npm run electron:serve # 打包服务 windows npm run electron:build # vue.config.js 中配置 详见文档 https://blog.csdn.net/honest1120110/article/details/116643392 pluginOptions: { electronBuilder: { // preload: 'src/preload.js', nodeIntegration: true, contextIsolation: false, enableRemoteModule: true, publish: [{ "provider": "xxxx有限公司", "url": "http://xxxxx/" }], "copyright": "Copyright © 2022", builderOptions:{ appId: 'com.ruoyi', productName: 'ruoyi', nsis:{ "oneClick": false, "allowElevation": true, "allowToChangeInstallationDirectory": true, }, win: { "icon": "build/app.ico", "target": [ { "target": "nsis", //使用nsis打成安装包,"portable"打包成免安装版 "arch": [ "ia32", //32位 "x64" //64位 ] } ] }, }, // preload: path.join(__dirname, "/dist_electron/preload.js"), }, }, ``` ### 改造步骤 已完成 1. 安装electron-builder ```javascript 处理外网访问速度过慢问题 npm config set registry https://registry.npm.taobao.org/ npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/ vue add electron-builder ``` 2. 在vue.config.js中添加以下代码 ``` pluginOptions: { electronBuilder: { nodeIntegration: true, contextIsolation: false, } } ``` 3. 在启动类/src/background.js 更改并添加以下代码 ``` const win = new BrowserWindow({ width: 1200, height: 700, // fullscreen: true,//全屏 show: false, webPreferences: { // Use pluginOptions.nodeIntegration, leave this alone // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info contextIsolation:false, //上下文隔离 enableRemoteModule: true, //启用远程模块 nodeIntegration: true, //开启自带node环境 webviewTag: true, //开启webview webSecurity: false, allowDisplayingInsecureContent: true, allowRunningInsecureContent: true }, // frame: false,//客户端窗口顶部菜单去掉 }) win.maximize() win.show() ipcMain.on('getPrinterList', (event) => { //主线程获取打印机列表 const list = win.webContents.getPrinters(); //通过webContents发送事件到渲染线程,同时将打印机列表也传过去 win.webContents.send('getPrinterList', list); }); ``` 5. 打印模板存放位置 ``` /static/print.html ``` ### 此项目 官网同步更新 ### 基于 Postgresql 实现 1. 代码自动生成 2. 由mysql语法转换为Postgresql(对应文件为 postgresql.sql) ### 代码自动生成 1. 执行sql文件夹下的view.sql 2. 操作一致
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |