diff --git a/.gitignore b/.gitignore index 574b56e5..29059ede 100644 --- a/.gitignore +++ b/.gitignore @@ -1,35 +1,35 @@ -.DS_Store -node_modules/ -dist/ -demo/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* -**/*.log - -tests/**/coverage/ -tests/e2e/reports -selenium-debug.log -cutejava-doc - -# Editor directories and files -.idea -.vscode -*.suo -*.ntvs* -*.njsproj -*.sln -*.local - -package-lock.json -yarn.lock - -### IDEA ### -.DS_Store -~/* -.idea/* -*.iml -*/target/* -*/*.iml -/.gradle/ +.DS_Store +node_modules/ +dist/ +demo/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log +cutejava-doc + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.local + +package-lock.json +yarn.lock + +### IDEA ### +.DS_Store +~/* +.idea/* +*.iml +*/target/* +*/*.iml +/.gradle/ /application.pid \ No newline at end of file diff --git a/LICENSE b/LICENSE index 485efc74..fe57103d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,191 +1,191 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "{}" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright 2022-2025 Odboy - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "{}" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright 2022-2025 Odboy + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and limitations under the License. \ No newline at end of file diff --git a/README.MD b/README.MD index 5dcacd33..1257ae09 100644 --- a/README.MD +++ b/README.MD @@ -1,96 +1,96 @@ -

CuteJava 后台管理系统

- -#### 项目简介 - -一个基于 Spring Boot 2.7.18 、 Mybatis-Plus、 JWT、Spring Security、Redis、Vue2的前后端分离的后台管理系统 - -**账号密码:** `admin / 123456` - -#### 项目源码 - -https://github.com/odboy-tianjun/cutejava - -#### 编码规范 - -- 和数据库表一一对应的类, 以`Tb`结尾 -- API请求参数类名, 以`Args`结尾 -- API响应参数类名, 以`Vo`结尾 -- 事件驱动类名, 以`Event`结尾 -- 消息队列/Socket传输类名,以`Message`结尾 -- 常用的辅助类的类名, 以`Cs`开头 -- 查询分页、查询列表的方法,一律为同一个方法名 - - 查询分页:queryUser(args, page) - - 查询列表:queryUser(args) - - MapperXml:这样mapper.xml文件中的实现方法只需要写一个queryUser -- 枚举类名,以`Enum`结尾 -- 拒绝过度包装 - -#### 主要特性 - -- 使用最新技术栈,社区资源丰富。 -- 高效率开发,代码生成器可一键生成前后端代码 -- 支持数据字典,可方便地对一些状态进行管理 -- 支持接口限流,避免恶意请求导致服务层压力过大 -- 支持接口级别的功能权限与数据权限,可自定义操作 -- 自定义权限注解与匿名接口注解,可快速对接口拦截与放行 -- 对一些常用地前端组件封装:表格数据请求、数据字典等 -- 前后端统一异常拦截处理,统一输出异常,避免繁琐的判断 -- 支持在线用户管理与服务器性能监控,支持限制单用户登录 -- 支持一键复制菜单项,避免菜单繁琐配置 - -#### 系统功能 - -- 用户管理:提供用户的相关配置,新增用户后,默认密码为123456 -- 角色管理:对权限与菜单进行分配,可根据部门设置角色的数据权限 -- 菜单管理:已实现菜单动态路由,后端可配置化,支持多级菜单 -- 部门管理:可配置系统组织架构,树形表格展示 -- 岗位管理:配置各个部门的职位 -- 字典管理:可维护常用一些固定的数据,如:状态,性别等 -- SQL监控:采用druid 监控数据库访问性能,默认用户名admin,密码123456 -- 定时任务:整合Quartz做定时任务,加入任务日志,任务运行情况一目了然 -- 邮件工具:配合富文本,发送html格式的邮件 -- 存储管理:本地存储、Minio存储 -- 服务监控:监控服务器的负载情况 - -#### 前端基础组件 - -> 组件所在路径:cutejava-front/src/views/components/dev - -- CuteSimpleTable 简单表格 -- CuteDragTable 支持拖拽的表格 -- CuteFormDialog 支持表单的对话框 -- CuteFormDrawer 支持表单的抽屉 -- CuteRichTextEditor 富文本编辑器 -- CuteOneKeyCopy 一键复制 -- CuteMarkdown Markdown编辑器 -- CuteJavaEditor Java编辑器(已弃用) -- CuteYamlEditor Yaml编辑器(已弃用) -- CuteCodeEditor 多语言编辑器(支持yaml、java、go、swift、dockerfile、groovy、lua、perl、python、ruby、sql、xml、vue) - -#### 前端业务组件 - -> 组件所在路径:cutejava-front/src/views/components/business - -- CuteDeptTree 部门树 -- CuteProductLineSelect 产品线选择框 -- CuteProductLineSelectPro 产品线级联选择框 -- CuteUserSelect 用户多选框 - ![CuteBusiness](./cutejava-front/docs/images/CuteBusiness.png) -- CuteFileUpload 上传文件到OSS, 必须结合Minio使用(上传完成后必须销毁组件) - ![CuteFileUpload](./cutejava-front/docs/images/CuteFileUpload.png) -- CuteFileDragUpload 支持拖拽上传文件到OSS, 必须结合Minio使用(上传完成后必须销毁组件) - ![CuteFileDragUpload](./cutejava-front/docs/images/CuteFileDragUpload.png) -- CutePipelineNode 流水线节点组件 - ![CutePipelineNode](./cutejava-front/docs/images/CutePipelineNode.png) - -#### 系统模块 - -- cutejava-framework:系统基础框架。提供核心功能,如:权限、数据权限、异常处理、缓存、工具类、接口限流、接口防重、接口幂等。 -- cutejava-system:系统功能模块。提供用户、角色、菜单、部门、岗位、字典、定时任务、邮件、Minio存储、服务监控等功能 -- cutejava-devops:devops模块,已实现流水线功能。参考阿里云云效,提供流水线功能,可配置流水线任务,并支持任务依赖、任务参数、任务参数校验、任务参数回填。 - -#### 特别鸣谢 - -- 感谢 [elunez](https://github.com/elunez/eladmin-mp) 大佬提供的基础框架 -- 感谢 [aizuda](https://mongoplus.com/) 大佬提供的Mongodb框架 - - 建表参考 'cutejava/doc/mongodb.md' +

CuteJava 后台管理系统

+ +#### 项目简介 + +一个基于 Spring Boot 2.7.18 、 Mybatis-Plus、 JWT、Spring Security、Redis、Vue2的前后端分离的后台管理系统 + +**账号密码:** `admin / 123456` + +#### 项目源码 + +https://github.com/odboy-tianjun/cutejava + +#### 编码规范 + +- 和数据库表一一对应的类, 以`Tb`结尾 +- API请求参数类名, 以`Args`结尾 +- API响应参数类名, 以`Vo`结尾 +- 事件驱动类名, 以`Event`结尾 +- 消息队列/Socket传输类名,以`Message`结尾 +- 常用的辅助类的类名, 以`Cs`开头 +- 查询分页、查询列表的方法,一律为同一个方法名 + - 查询分页:queryUser(args, page) + - 查询列表:queryUser(args) + - MapperXml:这样mapper.xml文件中的实现方法只需要写一个queryUser +- 枚举类名,以`Enum`结尾 +- 拒绝过度包装 + +#### 主要特性 + +- 使用最新技术栈,社区资源丰富。 +- 高效率开发,代码生成器可一键生成前后端代码 +- 支持数据字典,可方便地对一些状态进行管理 +- 支持接口限流,避免恶意请求导致服务层压力过大 +- 支持接口级别的功能权限与数据权限,可自定义操作 +- 自定义权限注解与匿名接口注解,可快速对接口拦截与放行 +- 对一些常用地前端组件封装:表格数据请求、数据字典等 +- 前后端统一异常拦截处理,统一输出异常,避免繁琐的判断 +- 支持在线用户管理与服务器性能监控,支持限制单用户登录 +- 支持一键复制菜单项,避免菜单繁琐配置 + +#### 系统功能 + +- 用户管理:提供用户的相关配置,新增用户后,默认密码为123456 +- 角色管理:对权限与菜单进行分配,可根据部门设置角色的数据权限 +- 菜单管理:已实现菜单动态路由,后端可配置化,支持多级菜单 +- 部门管理:可配置系统组织架构,树形表格展示 +- 岗位管理:配置各个部门的职位 +- 字典管理:可维护常用一些固定的数据,如:状态,性别等 +- SQL监控:采用druid 监控数据库访问性能,默认用户名admin,密码123456 +- 定时任务:整合Quartz做定时任务,加入任务日志,任务运行情况一目了然 +- 邮件工具:配合富文本,发送html格式的邮件 +- 存储管理:本地存储、Minio存储 +- 服务监控:监控服务器的负载情况 + +#### 前端基础组件 + +> 组件所在路径:cutejava-front/src/views/components/dev + +- CuteSimpleTable 简单表格 +- CuteDragTable 支持拖拽的表格 +- CuteFormDialog 支持表单的对话框 +- CuteFormDrawer 支持表单的抽屉 +- CuteRichTextEditor 富文本编辑器 +- CuteOneKeyCopy 一键复制 +- CuteMarkdown Markdown编辑器 +- CuteJavaEditor Java编辑器(已弃用) +- CuteYamlEditor Yaml编辑器(已弃用) +- CuteCodeEditor 多语言编辑器(支持yaml、java、go、swift、dockerfile、groovy、lua、perl、python、ruby、sql、xml、vue) + +#### 前端业务组件 + +> 组件所在路径:cutejava-front/src/views/components/business + +- CuteDeptTree 部门树 +- CuteProductLineSelect 产品线选择框 +- CuteProductLineSelectPro 产品线级联选择框 +- CuteUserSelect 用户多选框 + ![CuteBusiness](./cutejava-front/docs/images/CuteBusiness.png) +- CuteFileUpload 上传文件到OSS, 必须结合Minio使用(上传完成后必须销毁组件) + ![CuteFileUpload](./cutejava-front/docs/images/CuteFileUpload.png) +- CuteFileDragUpload 支持拖拽上传文件到OSS, 必须结合Minio使用(上传完成后必须销毁组件) + ![CuteFileDragUpload](./cutejava-front/docs/images/CuteFileDragUpload.png) +- CutePipelineNode 流水线节点组件 + ![CutePipelineNode](./cutejava-front/docs/images/CutePipelineNode.png) + +#### 系统模块 + +- cutejava-framework:系统基础框架。提供核心功能,如:权限、数据权限、异常处理、缓存、工具类、接口限流、接口防重、接口幂等。 +- cutejava-system:系统功能模块。提供用户、角色、菜单、部门、岗位、字典、定时任务、邮件、Minio存储、服务监控等功能 +- cutejava-devops:devops模块,已实现流水线功能。参考阿里云云效,提供流水线功能,可配置流水线任务,并支持任务依赖、任务参数、任务参数校验、任务参数回填。 + +#### 特别鸣谢 + +- 感谢 [elunez](https://github.com/elunez/eladmin-mp) 大佬提供的基础框架 +- 感谢 [aizuda](https://mongoplus.com/) 大佬提供的Mongodb框架 + - 建表参考 'cutejava/doc/mongodb.md' diff --git a/commit.sh b/commit.sh new file mode 100644 index 00000000..ce2dfad4 --- /dev/null +++ b/commit.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +is_weekend() { + day=$(date +%u) + [ "$day" -eq 6 ] || [ "$day" -eq 7 ] +} + +if is_weekend; then + # 如果是周末,使用当前时间 + git add . + git commit -m "$1" + git push +else + # 如果不是周末,设置为最近的周末时间 + day=$(date +%u) + if [ "$day" -le 5 ]; then + # 周一到周五,设置为即将到来的周六 + days_until_saturday=$((6 - day)) + weekend_date=$(date -d "$days_until_saturday days" "+%Y-%m-%d 12:00:00") + else + # 周日,使用昨天(周六) + weekend_date=$(date -d "yesterday" "+%Y-%m-%d 12:00:00") + fi + + export GIT_AUTHOR_DATE="$weekend_date" + export GIT_COMMITTER_DATE="$weekend_date" + + git add . + git commit -m "$1" + git push + + unset GIT_AUTHOR_DATE + unset GIT_COMMITTER_DATE +fi diff --git a/cutejava-front/.editorconfig b/cutejava-front/.editorconfig index 3454886e..d6da2515 100644 --- a/cutejava-front/.editorconfig +++ b/cutejava-front/.editorconfig @@ -1,14 +1,14 @@ -# https://editorconfig.org -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -insert_final_newline = false -trim_trailing_whitespace = false +# https://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/cutejava-front/.env.development b/cutejava-front/.env.development index d9a21321..67008828 100644 --- a/cutejava-front/.env.development +++ b/cutejava-front/.env.development @@ -1,8 +1,8 @@ -ENV = 'development' - -# 接口地址 -VUE_APP_BASE_API = 'http://localhost:8000' -VUE_APP_WS_API = 'ws://localhost:8000' - -# 是否启用 babel-plugin-dynamic-import-node插件 -VUE_CLI_BABEL_TRANSPILE_MODULES = true +ENV = 'development' + +# 接口地址 +VUE_APP_BASE_API = 'http://localhost:8000' +VUE_APP_WS_API = 'ws://localhost:8000' + +# 是否启用 babel-plugin-dynamic-import-node插件 +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/cutejava-front/.env.production b/cutejava-front/.env.production index d680afa7..6eb35d33 100644 --- a/cutejava-front/.env.production +++ b/cutejava-front/.env.production @@ -1,7 +1,7 @@ -ENV = 'production' - -# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 -# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http -VUE_APP_BASE_API = 'https://cutejava-api.odboy.cn' -# 如果接口是 http 形式, wss 需要改为 ws -VUE_APP_WS_API = 'wss://cutejava-api.odboy.cn' +ENV = 'production' + +# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 +# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http +VUE_APP_BASE_API = 'https://cutejava-api.odboy.cn' +# 如果接口是 http 形式, wss 需要改为 ws +VUE_APP_WS_API = 'wss://cutejava-api.odboy.cn' diff --git a/cutejava-front/.eslintignore b/cutejava-front/.eslintignore index e6529fc0..e3a871f3 100644 --- a/cutejava-front/.eslintignore +++ b/cutejava-front/.eslintignore @@ -1,4 +1,4 @@ -build/*.js -src/assets -public -dist +build/*.js +src/assets +public +dist diff --git a/cutejava-front/.eslintrc.js b/cutejava-front/.eslintrc.js index c9775054..2d44d7b5 100644 --- a/cutejava-front/.eslintrc.js +++ b/cutejava-front/.eslintrc.js @@ -1,198 +1,198 @@ -module.exports = { - root: true, - parserOptions: { - parser: 'babel-eslint', - sourceType: 'module' - }, - env: { - browser: true, - node: true, - es6: true, - }, - extends: ['plugin:vue/recommended', 'eslint:recommended'], - - // add your custom rules here - //it is base on https://github.com/vuejs/eslint-config-vue - rules: { - "vue/max-attributes-per-line": [2, { - "singleline": 10, - "multiline": { - "max": 1, - "allowFirstLine": false - } - }], - "vue/singleline-html-element-content-newline": "off", - "vue/multiline-html-element-content-newline":"off", - "vue/name-property-casing": ["error", "PascalCase"], - "vue/no-v-html": "off", - 'accessor-pairs': 2, - 'arrow-spacing': [2, { - 'before': true, - 'after': true - }], - 'block-spacing': [2, 'always'], - 'brace-style': [2, '1tbs', { - 'allowSingleLine': true - }], - 'camelcase': [0, { - 'properties': 'always' - }], - 'comma-dangle': [2, 'never'], - 'comma-spacing': [2, { - 'before': false, - 'after': true - }], - 'comma-style': [2, 'last'], - 'constructor-super': 2, - 'curly': [2, 'multi-line'], - 'dot-location': [2, 'property'], - 'eol-last': 2, - 'eqeqeq': ["error", "always", {"null": "ignore"}], - 'generator-star-spacing': [2, { - 'before': true, - 'after': true - }], - 'handle-callback-err': [2, '^(err|error)$'], - 'indent': [2, 2, { - 'SwitchCase': 1 - }], - 'jsx-quotes': [2, 'prefer-single'], - 'key-spacing': [2, { - 'beforeColon': false, - 'afterColon': true - }], - 'keyword-spacing': [2, { - 'before': true, - 'after': true - }], - 'new-cap': [2, { - 'newIsCap': true, - 'capIsNew': false - }], - 'new-parens': 2, - 'no-array-constructor': 2, - 'no-caller': 2, - 'no-console': 'off', - 'no-class-assign': 2, - 'no-cond-assign': 2, - 'no-const-assign': 2, - 'no-control-regex': 0, - 'no-delete-var': 2, - 'no-dupe-args': 2, - 'no-dupe-class-members': 2, - 'no-dupe-keys': 2, - 'no-duplicate-case': 2, - 'no-empty-character-class': 2, - 'no-empty-pattern': 2, - 'no-eval': 2, - 'no-ex-assign': 2, - 'no-extend-native': 2, - 'no-extra-bind': 2, - 'no-extra-boolean-cast': 2, - 'no-extra-parens': [2, 'functions'], - 'no-fallthrough': 2, - 'no-floating-decimal': 2, - 'no-func-assign': 2, - 'no-implied-eval': 2, - 'no-inner-declarations': [2, 'functions'], - 'no-invalid-regexp': 2, - 'no-irregular-whitespace': 2, - 'no-iterator': 2, - 'no-label-var': 2, - 'no-labels': [2, { - 'allowLoop': false, - 'allowSwitch': false - }], - 'no-lone-blocks': 2, - 'no-mixed-spaces-and-tabs': 2, - 'no-multi-spaces': 2, - 'no-multi-str': 2, - 'no-multiple-empty-lines': [2, { - 'max': 1 - }], - 'no-native-reassign': 2, - 'no-negated-in-lhs': 2, - 'no-new-object': 2, - 'no-new-require': 2, - 'no-new-symbol': 2, - 'no-new-wrappers': 2, - 'no-obj-calls': 2, - 'no-octal': 2, - 'no-octal-escape': 2, - 'no-path-concat': 2, - 'no-proto': 2, - 'no-redeclare': 2, - 'no-regex-spaces': 2, - 'no-return-assign': [2, 'except-parens'], - 'no-self-assign': 2, - 'no-self-compare': 2, - 'no-sequences': 2, - 'no-shadow-restricted-names': 2, - 'no-spaced-func': 2, - 'no-sparse-arrays': 2, - 'no-this-before-super': 2, - 'no-throw-literal': 2, - 'no-trailing-spaces': 2, - 'no-undef': 2, - 'no-undef-init': 2, - 'no-unexpected-multiline': 2, - 'no-unmodified-loop-condition': 2, - 'no-unneeded-ternary': [2, { - 'defaultAssignment': false - }], - 'no-unreachable': 2, - 'no-unsafe-finally': 2, - 'no-unused-vars': [2, { - 'vars': 'all', - 'args': 'none' - }], - 'no-useless-call': 2, - 'no-useless-computed-key': 2, - 'no-useless-constructor': 2, - 'no-useless-escape': 0, - 'no-whitespace-before-property': 2, - 'no-with': 2, - 'one-var': [2, { - 'initialized': 'never' - }], - 'operator-linebreak': [2, 'after', { - 'overrides': { - '?': 'before', - ':': 'before' - } - }], - 'padded-blocks': [2, 'never'], - 'quotes': [2, 'single', { - 'avoidEscape': true, - 'allowTemplateLiterals': true - }], - 'semi': [2, 'never'], - 'semi-spacing': [2, { - 'before': false, - 'after': true - }], - 'space-before-blocks': [2, 'always'], - 'space-before-function-paren': [2, 'never'], - 'space-in-parens': [2, 'never'], - 'space-infix-ops': 2, - 'space-unary-ops': [2, { - 'words': true, - 'nonwords': false - }], - 'spaced-comment': [2, 'always', { - 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] - }], - 'template-curly-spacing': [2, 'never'], - 'use-isnan': 2, - 'valid-typeof': 2, - 'wrap-iife': [2, 'any'], - 'yield-star-spacing': [2, 'both'], - 'yoda': [2, 'never'], - 'prefer-const': 2, - 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, - 'object-curly-spacing': [2, 'always', { - objectsInObjects: false - }], - 'array-bracket-spacing': [2, 'never'] - } -} +module.exports = { + root: true, + parserOptions: { + parser: 'babel-eslint', + sourceType: 'module' + }, + env: { + browser: true, + node: true, + es6: true, + }, + extends: ['plugin:vue/recommended', 'eslint:recommended'], + + // add your custom rules here + //it is base on https://github.com/vuejs/eslint-config-vue + rules: { + "vue/max-attributes-per-line": [2, { + "singleline": 10, + "multiline": { + "max": 1, + "allowFirstLine": false + } + }], + "vue/singleline-html-element-content-newline": "off", + "vue/multiline-html-element-content-newline":"off", + "vue/name-property-casing": ["error", "PascalCase"], + "vue/no-v-html": "off", + 'accessor-pairs': 2, + 'arrow-spacing': [2, { + 'before': true, + 'after': true + }], + 'block-spacing': [2, 'always'], + 'brace-style': [2, '1tbs', { + 'allowSingleLine': true + }], + 'camelcase': [0, { + 'properties': 'always' + }], + 'comma-dangle': [2, 'never'], + 'comma-spacing': [2, { + 'before': false, + 'after': true + }], + 'comma-style': [2, 'last'], + 'constructor-super': 2, + 'curly': [2, 'multi-line'], + 'dot-location': [2, 'property'], + 'eol-last': 2, + 'eqeqeq': ["error", "always", {"null": "ignore"}], + 'generator-star-spacing': [2, { + 'before': true, + 'after': true + }], + 'handle-callback-err': [2, '^(err|error)$'], + 'indent': [2, 2, { + 'SwitchCase': 1 + }], + 'jsx-quotes': [2, 'prefer-single'], + 'key-spacing': [2, { + 'beforeColon': false, + 'afterColon': true + }], + 'keyword-spacing': [2, { + 'before': true, + 'after': true + }], + 'new-cap': [2, { + 'newIsCap': true, + 'capIsNew': false + }], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-console': 'off', + 'no-class-assign': 2, + 'no-cond-assign': 2, + 'no-const-assign': 2, + 'no-control-regex': 0, + 'no-delete-var': 2, + 'no-dupe-args': 2, + 'no-dupe-class-members': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty-character-class': 2, + 'no-empty-pattern': 2, + 'no-eval': 2, + 'no-ex-assign': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-parens': [2, 'functions'], + 'no-fallthrough': 2, + 'no-floating-decimal': 2, + 'no-func-assign': 2, + 'no-implied-eval': 2, + 'no-inner-declarations': [2, 'functions'], + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': [2, { + 'allowLoop': false, + 'allowSwitch': false + }], + 'no-lone-blocks': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': [2, { + 'max': 1 + }], + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new-object': 2, + 'no-new-require': 2, + 'no-new-symbol': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + 'no-return-assign': [2, 'except-parens'], + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-shadow-restricted-names': 2, + 'no-spaced-func': 2, + 'no-sparse-arrays': 2, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-trailing-spaces': 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-unexpected-multiline': 2, + 'no-unmodified-loop-condition': 2, + 'no-unneeded-ternary': [2, { + 'defaultAssignment': false + }], + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'no-unused-vars': [2, { + 'vars': 'all', + 'args': 'none' + }], + 'no-useless-call': 2, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-escape': 0, + 'no-whitespace-before-property': 2, + 'no-with': 2, + 'one-var': [2, { + 'initialized': 'never' + }], + 'operator-linebreak': [2, 'after', { + 'overrides': { + '?': 'before', + ':': 'before' + } + }], + 'padded-blocks': [2, 'never'], + 'quotes': [2, 'single', { + 'avoidEscape': true, + 'allowTemplateLiterals': true + }], + 'semi': [2, 'never'], + 'semi-spacing': [2, { + 'before': false, + 'after': true + }], + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'never'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { + 'words': true, + 'nonwords': false + }], + 'spaced-comment': [2, 'always', { + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] + }], + 'template-curly-spacing': [2, 'never'], + 'use-isnan': 2, + 'valid-typeof': 2, + 'wrap-iife': [2, 'any'], + 'yield-star-spacing': [2, 'both'], + 'yoda': [2, 'never'], + 'prefer-const': 2, + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'object-curly-spacing': [2, 'always', { + objectsInObjects: false + }], + 'array-bracket-spacing': [2, 'never'] + } +} diff --git a/cutejava-front/.gitignore b/cutejava-front/.gitignore index 78a752d8..2c9b3a73 100644 --- a/cutejava-front/.gitignore +++ b/cutejava-front/.gitignore @@ -1,23 +1,23 @@ -.DS_Store -node_modules/ -dist/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* -**/*.log - -tests/**/coverage/ -tests/e2e/reports -selenium-debug.log - -# Editor directories and files -.idea -.vscode -*.suo -*.ntvs* -*.njsproj -*.sln -*.local - -package-lock.json -yarn.lock +.DS_Store +node_modules/ +dist/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.local + +package-lock.json +yarn.lock diff --git a/cutejava-front/.travis.yml b/cutejava-front/.travis.yml index f4be7a08..a95f7bb0 100644 --- a/cutejava-front/.travis.yml +++ b/cutejava-front/.travis.yml @@ -1,5 +1,5 @@ -language: node_js -node_js: 10 -script: npm run test -notifications: - email: false +language: node_js +node_js: 10 +script: npm run test +notifications: + email: false diff --git a/cutejava-front/LICENSE b/cutejava-front/LICENSE index aae98709..94343fa3 100644 --- a/cutejava-front/LICENSE +++ b/cutejava-front/LICENSE @@ -1,191 +1,191 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "{}" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright 2022 Odboy - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "{}" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright 2022 Odboy + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/cutejava-front/README.md b/cutejava-front/README.md index 5141af4b..ceee37df 100644 --- a/cutejava-front/README.md +++ b/cutejava-front/README.md @@ -1,51 +1,51 @@ -# cutejava-ui - -#### 前端模板 - -初始模板基于: [https://github.com/PanJiaChen/vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) - -模板文档: [https://panjiachen.github.io/vue-element-admin-site/zh/guide/](https://panjiachen.github.io/vue-element-admin-site/zh/guide/) - -## 快速开始 - -### 环境要求 - -**推荐 node 版本:12-16 LTS** - -### 安装依赖 - -``` bash -# 安装依赖(依赖python) -npm install --registry https://registry.npmmirror.com -``` - -### 启动服务 - -```bash -# 启动服务 localhost:8013 -npm run dev - -# (或) 启动服务 localhost:8013 -IDEA -> Current File -> Edit Configurations... -> Add New Configuration -> npm -> Script选dev -> Apply -> Ok - -# 构建生产环境 -npm run build:prod -``` - -#### 常见问题 - -1、linux 系统在安装依赖的时候会出现 node-sass 无法安装的问题 - -解决方案: -``` -1. 单独安装:npm install --unsafe-perm node-sass -2. 直接使用:npm install --unsafe-perm -``` - -2、加速node-sass安装 - -https://www.ydyno.com/archives/1219.html - -#### 特别鸣谢 - -- 感谢 [elunez](https://github.com/elunez/eladmin-mp) 大佬提供的基础框架 +# cutejava-ui + +#### 前端模板 + +初始模板基于: [https://github.com/PanJiaChen/vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) + +模板文档: [https://panjiachen.github.io/vue-element-admin-site/zh/guide/](https://panjiachen.github.io/vue-element-admin-site/zh/guide/) + +## 快速开始 + +### 环境要求 + +**推荐 node 版本:12-16 LTS** + +### 安装依赖 + +``` bash +# 安装依赖(依赖python) +npm install --registry https://registry.npmmirror.com +``` + +### 启动服务 + +```bash +# 启动服务 localhost:8013 +npm run dev + +# (或) 启动服务 localhost:8013 +IDEA -> Current File -> Edit Configurations... -> Add New Configuration -> npm -> Script选dev -> Apply -> Ok + +# 构建生产环境 +npm run build:prod +``` + +#### 常见问题 + +1、linux 系统在安装依赖的时候会出现 node-sass 无法安装的问题 + +解决方案: +``` +1. 单独安装:npm install --unsafe-perm node-sass +2. 直接使用:npm install --unsafe-perm +``` + +2、加速node-sass安装 + +https://www.ydyno.com/archives/1219.html + +#### 特别鸣谢 + +- 感谢 [elunez](https://github.com/elunez/eladmin-mp) 大佬提供的基础框架 diff --git a/cutejava-front/babel.config.js b/cutejava-front/babel.config.js index 804632a0..682b736f 100644 --- a/cutejava-front/babel.config.js +++ b/cutejava-front/babel.config.js @@ -1,11 +1,11 @@ -const plugins = ['@vue/babel-plugin-transform-vue-jsx'] -// 生产环境移除console -if (process.env.NODE_ENV === 'production') { - plugins.push('transform-remove-console') -} -module.exports = { - plugins: plugins, - presets: [ - '@vue/app' - ] -} +const plugins = ['@vue/babel-plugin-transform-vue-jsx'] +// 生产环境移除console +if (process.env.NODE_ENV === 'production') { + plugins.push('transform-remove-console') +} +module.exports = { + plugins: plugins, + presets: [ + '@vue/app' + ] +} diff --git a/cutejava-front/jest.config.js b/cutejava-front/jest.config.js index 143cdc86..ca6c565a 100644 --- a/cutejava-front/jest.config.js +++ b/cutejava-front/jest.config.js @@ -1,24 +1,24 @@ -module.exports = { - moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], - transform: { - '^.+\\.vue$': 'vue-jest', - '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': - 'jest-transform-stub', - '^.+\\.jsx?$': 'babel-jest' - }, - moduleNameMapper: { - '^@/(.*)$': '/src/$1' - }, - snapshotSerializers: ['jest-serializer-vue'], - testMatch: [ - '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' - ], - collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], - coverageDirectory: '/tests/unit/coverage', - // 'collectCoverage': true, - 'coverageReporters': [ - 'lcov', - 'text-summary' - ], - testURL: 'http://localhost/' -} +module.exports = { + moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], + transform: { + '^.+\\.vue$': 'vue-jest', + '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': + 'jest-transform-stub', + '^.+\\.jsx?$': 'babel-jest' + }, + moduleNameMapper: { + '^@/(.*)$': '/src/$1' + }, + snapshotSerializers: ['jest-serializer-vue'], + testMatch: [ + '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' + ], + collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], + coverageDirectory: '/tests/unit/coverage', + // 'collectCoverage': true, + 'coverageReporters': [ + 'lcov', + 'text-summary' + ], + testURL: 'http://localhost/' +} diff --git a/cutejava-front/package.json b/cutejava-front/package.json index 0b91b187..d0c24bd8 100644 --- a/cutejava-front/package.json +++ b/cutejava-front/package.json @@ -1,6 +1,6 @@ { "name": "cutejava-front", - "version": "1.3.0", + "version": "1.4.0", "description": "CuteJava 前端源码", "author": "Odboy", "license": "Apache-2.0", @@ -48,6 +48,7 @@ "element-ui": "^2.15.14", "file-saver": "1.3.8", "fuse.js": "3.4.4", + "html2canvas": "^1.4.1", "js-beautify": "^1.10.2", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", diff --git a/cutejava-front/plopfile.js b/cutejava-front/plopfile.js index 9f3147e2..725c51b4 100644 --- a/cutejava-front/plopfile.js +++ b/cutejava-front/plopfile.js @@ -1,7 +1,7 @@ -const viewGenerator = require('./plop-templates/view/prompt') -const componentGenerator = require('./plop-templates/component/prompt') - -module.exports = function(plop) { - plop.setGenerator('view', viewGenerator) - plop.setGenerator('component', componentGenerator) -} +const viewGenerator = require('./plop-templates/view/prompt') +const componentGenerator = require('./plop-templates/component/prompt') + +module.exports = function(plop) { + plop.setGenerator('view', viewGenerator) + plop.setGenerator('component', componentGenerator) +} diff --git a/cutejava-front/postcss.config.js b/cutejava-front/postcss.config.js index 961986e2..2be0631d 100644 --- a/cutejava-front/postcss.config.js +++ b/cutejava-front/postcss.config.js @@ -1,5 +1,5 @@ -module.exports = { - plugins: { - autoprefixer: {} - } -} +module.exports = { + plugins: { + autoprefixer: {} + } +} diff --git a/cutejava-front/public/index.html b/cutejava-front/public/index.html index e9185009..f1df85d6 100644 --- a/cutejava-front/public/index.html +++ b/cutejava-front/public/index.html @@ -1,15 +1,15 @@ - - - - - - - - - <%= webpackConfig.name %> - - -
- - - + + + + + + + + + <%= webpackConfig.name %> + + +
+ + + diff --git a/cutejava-front/public/robots.txt b/cutejava-front/public/robots.txt index 77470cb3..c2aab7e0 100644 --- a/cutejava-front/public/robots.txt +++ b/cutejava-front/public/robots.txt @@ -1,2 +1,2 @@ -User-agent: * +User-agent: * Disallow: / \ No newline at end of file diff --git a/cutejava-front/src/App.vue b/cutejava-front/src/App.vue index ec9032c1..df5e0ca2 100644 --- a/cutejava-front/src/App.vue +++ b/cutejava-front/src/App.vue @@ -1,11 +1,11 @@ - - - + + + diff --git a/cutejava-front/src/api/data.js b/cutejava-front/src/api/data.js index 196bd37e..fac4acb0 100644 --- a/cutejava-front/src/api/data.js +++ b/cutejava-front/src/api/data.js @@ -1,33 +1,33 @@ -import request from '@/utils/request' -import qs from 'qs' - -// export function initData(url, params) { -// return request({ -// url: url + '?' + qs.stringify(params, { indices: false }), -// method: 'get' -// }) -// } - -export function initData(url, params) { - return request({ - url: url, - method: 'post', - data: params - }) -} - -export function initDataByPost(url, params) { - return request({ - url: url, - method: 'post', - data: params - }) -} - -export function download(url, params) { - return request({ - url: url + '?' + qs.stringify(params, { indices: false }), - method: 'get', - responseType: 'blob' - }) -} +import request from '@/utils/request' +import qs from 'qs' + +// export function initData(url, params) { +// return request({ +// url: url + '?' + qs.stringify(params, { indices: false }), +// method: 'get' +// }) +// } + +export function initData(url, params) { + return request({ + url: url, + method: 'post', + data: params + }) +} + +export function initDataByPost(url, params) { + return request({ + url: url, + method: 'post', + data: params + }) +} + +export function download(url, params) { + return request({ + url: url + '?' + qs.stringify(params, { indices: false }), + method: 'get', + responseType: 'blob' + }) +} diff --git a/cutejava-front/src/api/login.js b/cutejava-front/src/api/login.js index 1a0bbd6c..d8309e9e 100644 --- a/cutejava-front/src/api/login.js +++ b/cutejava-front/src/api/login.js @@ -1,35 +1,35 @@ -import request from '@/utils/request' - -export function login(username, password, code, uuid) { - return request({ - url: 'auth/login', - method: 'post', - data: { - username, - password, - code, - uuid - } - }) -} - -export function getInfo() { - return request({ - url: 'auth/info', - method: 'post' - }) -} - -export function getCodeImg() { - return request({ - url: 'auth/captcha/getImage', - method: 'post' - }) -} - -export function logout() { - return request({ - url: 'auth/logout', - method: 'post' - }) -} +import request from '@/utils/request' + +export function login(username, password, code, uuid) { + return request({ + url: 'auth/login', + method: 'post', + data: { + username, + password, + code, + uuid + } + }) +} + +export function getInfo() { + return request({ + url: 'auth/info', + method: 'post' + }) +} + +export function getCodeImg() { + return request({ + url: 'auth/captcha/getImage', + method: 'post' + }) +} + +export function logout() { + return request({ + url: 'auth/logout', + method: 'post' + }) +} diff --git a/cutejava-front/src/api/pipeline/pipelineInstance.js b/cutejava-front/src/api/pipeline/pipelineInstance.js deleted file mode 100644 index b9413045..00000000 --- a/cutejava-front/src/api/pipeline/pipelineInstance.js +++ /dev/null @@ -1,53 +0,0 @@ -import request from '@/utils/request' - -export function startPipeline(data) { - return request({ - url: 'api/devops/pipelineInstance/start', - method: 'post', - data - }) -} - -export function stopPipeline(data) { - return request({ - url: 'api/devops/pipelineInstance/stop', - method: 'post', - data - }) -} - -export function retryPipeline(data) { - return request({ - url: 'api/devops/pipelineInstance/retry', - method: 'post', - data - }) -} - -export function restartPipeline(data) { - return request({ - url: 'api/devops/pipelineInstance/restart', - method: 'post', - data - }) -} - -export function queryLastPipelineDetail(instanceId) { - return request({ - url: 'api/devops/pipelineInstance/last', - method: 'post', - data: { - instanceId - } - }) -} - -export function queryLastPipelineDetailWs(instanceId) { - return request({ - url: 'api/devops/pipelineInstance/lastWs', - method: 'post', - data: { - instanceId - } - }) -} diff --git a/cutejava-front/src/api/pipeline/pipelineTemplate.js b/cutejava-front/src/api/pipeline/pipelineTemplate.js deleted file mode 100644 index fd372901..00000000 --- a/cutejava-front/src/api/pipeline/pipelineTemplate.js +++ /dev/null @@ -1,9 +0,0 @@ -import request from '@/utils/request' - -export function getPipelineTemplate(id) { - return request({ - url: 'api/devops/pipelineTemplate/getPipelineTemplate', - method: 'post', - data: { id } - }) -} diff --git a/cutejava-front/src/api/system/code.js b/cutejava-front/src/api/system/code.js index 8e0fd805..d122c406 100644 --- a/cutejava-front/src/api/system/code.js +++ b/cutejava-front/src/api/system/code.js @@ -1,28 +1,28 @@ -import request from '@/utils/request' - -export function sendResetEmailCaptcha(email) { - return request({ - url: 'api/captcha/sendResetEmailCaptcha?email=' + email, - method: 'post' - }) -} - -export function sendResetPasswordCaptcha(email) { - return request({ - url: 'api/captcha/sendResetPasswordCaptcha?email=' + email, - method: 'post' - }) -} - -export function checkEmailCaptcha(email, code, bizCode) { - const params = { - email: email, - code: code, - bizCode: bizCode - } - return request({ - url: 'api/captcha/checkEmailCaptcha', - method: 'post', - data: params - }) -} +import request from '@/utils/request' + +export function sendResetEmailCaptcha(email) { + return request({ + url: 'api/captcha/sendResetEmailCaptcha?email=' + email, + method: 'post' + }) +} + +export function sendResetPasswordCaptcha(email) { + return request({ + url: 'api/captcha/sendResetPasswordCaptcha?email=' + email, + method: 'post' + }) +} + +export function checkEmailCaptcha(email, code, bizCode) { + const params = { + email: email, + code: code, + bizCode: bizCode + } + return request({ + url: 'api/captcha/checkEmailCaptcha', + method: 'post', + data: params + }) +} diff --git a/cutejava-front/src/api/system/dept.js b/cutejava-front/src/api/system/dept.js index 089447b4..278ff12b 100644 --- a/cutejava-front/src/api/system/dept.js +++ b/cutejava-front/src/api/system/dept.js @@ -1,45 +1,45 @@ -import request from '@/utils/request' - -export function queryDeptList(params) { - return request({ - url: 'api/dept', - method: 'post', - data: params - }) -} - -export function queryDeptSuperiorTree(ids, exclude) { - exclude = exclude !== undefined ? exclude : false - const data = Array.isArray(ids) ? ids : [ids] - return request({ - url: 'api/dept/queryDeptSuperiorTree?exclude=' + exclude, - method: 'post', - data: data - }) -} - -export function add(data) { - return request({ - url: 'api/dept/saveDept', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/dept/removeDeptByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/dept/modifyDept', - method: 'post', - data: data - }) -} - -export default { add, edit, del, queryDeptList, queryDeptSuperiorTree } +import request from '@/utils/request' + +export function queryDeptList(params) { + return request({ + url: 'api/dept', + method: 'post', + data: params + }) +} + +export function queryDeptSuperiorTree(ids, exclude) { + exclude = exclude !== undefined ? exclude : false + const data = Array.isArray(ids) ? ids : [ids] + return request({ + url: 'api/dept/queryDeptSuperiorTree?exclude=' + exclude, + method: 'post', + data: data + }) +} + +export function add(data) { + return request({ + url: 'api/dept/saveDept', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/dept/removeDeptByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/dept/modifyDept', + method: 'post', + data: data + }) +} + +export default { add, edit, del, queryDeptList, queryDeptSuperiorTree } diff --git a/cutejava-front/src/api/system/dict.js b/cutejava-front/src/api/system/dict.js index e0baf34e..5dc359b0 100644 --- a/cutejava-front/src/api/system/dict.js +++ b/cutejava-front/src/api/system/dict.js @@ -1,35 +1,35 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/dict/saveDict', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/dict/removeDictByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/dict/modifyDictById', - method: 'post', - data: data - }) -} - -export function queryPageDict(data) { - return request({ - url: 'api/dict', - method: 'post', - data: data - }) -} - -export default { add, edit, del, queryPageDict } +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/dict/saveDict', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/dict/removeDictByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/dict/modifyDictById', + method: 'post', + data: data + }) +} + +export function queryPageDict(data) { + return request({ + url: 'api/dict', + method: 'post', + data: data + }) +} + +export default { add, edit, del, queryPageDict } diff --git a/cutejava-front/src/api/system/dictDetail.js b/cutejava-front/src/api/system/dictDetail.js index 9f83c667..6b77d5f7 100644 --- a/cutejava-front/src/api/system/dictDetail.js +++ b/cutejava-front/src/api/system/dictDetail.js @@ -1,42 +1,42 @@ -import request from '@/utils/request' - -export function get(dictName) { - const params = { - page: 1, - size: 9999999, - args: { - dictName: dictName - } - } - return request({ - url: 'api/dictDetail/queryDictDetailByArgs', - method: 'post', - data: params - }) -} - -export function add(data) { - return request({ - url: 'api/dictDetail/saveDictDetail', - method: 'post', - data: data - }) -} - -export function del(id) { - return request({ - url: 'api/dictDetail/removeDictDetailById', - method: 'post', - data: { id: id } - }) -} - -export function edit(data) { - return request({ - url: 'api/dictDetail/modifyDictDetailById', - method: 'post', - data: data - }) -} - -export default { add, edit, del } +import request from '@/utils/request' + +export function get(dictName) { + const params = { + page: 1, + size: 9999999, + args: { + dictName: dictName + } + } + return request({ + url: 'api/dictDetail/queryDictDetailByArgs', + method: 'post', + data: params + }) +} + +export function add(data) { + return request({ + url: 'api/dictDetail/saveDictDetail', + method: 'post', + data: data + }) +} + +export function del(id) { + return request({ + url: 'api/dictDetail/removeDictDetailById', + method: 'post', + data: { id: id } + }) +} + +export function edit(data) { + return request({ + url: 'api/dictDetail/modifyDictDetailById', + method: 'post', + data: data + }) +} + +export default { add, edit, del } diff --git a/cutejava-front/src/api/system/email.js b/cutejava-front/src/api/system/email.js index fa84a0f7..fb193340 100644 --- a/cutejava-front/src/api/system/email.js +++ b/cutejava-front/src/api/system/email.js @@ -1,24 +1,24 @@ -import request from '@/utils/request' - -export function getLastEmailConfig() { - return request({ - url: 'api/email/getLastEmailConfig', - method: 'post' - }) -} - -export function modifyEmailConfig(data) { - return request({ - url: 'api/email/modifyEmailConfig', - method: 'post', - data: data - }) -} - -export function sendEmail(data) { - return request({ - url: 'api/email/sendEmail', - method: 'post', - data: data - }) -} +import request from '@/utils/request' + +export function getLastEmailConfig() { + return request({ + url: 'api/email/getLastEmailConfig', + method: 'post' + }) +} + +export function modifyEmailConfig(data) { + return request({ + url: 'api/email/modifyEmailConfig', + method: 'post', + data: data + }) +} + +export function sendEmail(data) { + return request({ + url: 'api/email/sendEmail', + method: 'post', + data: data + }) +} diff --git a/cutejava-front/src/api/system/job.js b/cutejava-front/src/api/system/job.js index 8ed716d0..4fc34241 100644 --- a/cutejava-front/src/api/system/job.js +++ b/cutejava-front/src/api/system/job.js @@ -1,42 +1,42 @@ -import request from '@/utils/request' - -export function queryAllEnableJob() { - const params = { - page: 1, - size: 9999999, - args: { - enabled: true - } - } - return request({ - url: 'api/job/queryAllEnableJob', - method: 'post', - data: params - }) -} - -export function add(data) { - return request({ - url: 'api/job/saveJob', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/job/removeJobByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/job/modifyJobById', - method: 'post', - data: data - }) -} - -export default { add, edit, del } +import request from '@/utils/request' + +export function queryAllEnableJob() { + const params = { + page: 1, + size: 9999999, + args: { + enabled: true + } + } + return request({ + url: 'api/job/queryAllEnableJob', + method: 'post', + data: params + }) +} + +export function add(data) { + return request({ + url: 'api/job/saveJob', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/job/removeJobByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/job/modifyJobById', + method: 'post', + data: data + }) +} + +export default { add, edit, del } diff --git a/cutejava-front/src/api/system/localStorage.js b/cutejava-front/src/api/system/localStorage.js index c8f04d2b..e64c9440 100644 --- a/cutejava-front/src/api/system/localStorage.js +++ b/cutejava-front/src/api/system/localStorage.js @@ -1,27 +1,27 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/localStorage/uploadFile', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/localStorage/removeFileByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/localStorage/modifyLocalStorageById', - method: 'post', - data: data - }) -} - -export default { add, edit, del } +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/localStorage/uploadFile', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/localStorage/removeFileByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/localStorage/modifyLocalStorageById', + method: 'post', + data: data + }) +} + +export default { add, edit, del } diff --git a/cutejava-front/src/api/system/menu.js b/cutejava-front/src/api/system/menu.js index e4e20779..f7b5bdd3 100644 --- a/cutejava-front/src/api/system/menu.js +++ b/cutejava-front/src/api/system/menu.js @@ -1,65 +1,65 @@ -import request from '@/utils/request' - -export function queryMenuListByPid(pid) { - return request({ - url: 'api/menu/queryMenuListByPid?pid=' + pid, - method: 'post' - }) -} - -export function queryMenuByArgs(params) { - return request({ - url: 'api/menu/queryMenuByArgs', - method: 'post', - data: params - }) -} - -export function queryMenuSuperior(ids) { - const data = Array.isArray(ids) ? ids : [ids] - return request({ - url: 'api/menu/queryMenuSuperior', - method: 'post', - data: data - }) -} - -export function queryChildMenuSet(id) { - return request({ - url: 'api/menu/queryChildMenuSet?id=' + id, - method: 'post' - }) -} - -export function buildMenus() { - return request({ - url: 'api/menu/buildMenus', - method: 'post' - }) -} - -export function add(data) { - return request({ - url: 'api/menu/saveMenu', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/menu/removeMenuByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/menu/modifyMenuById', - method: 'post', - data: data - }) -} - -export default { add, edit, del, queryMenuListByPid, queryMenuSuperior, queryMenuByArgs, queryChildMenuSet } +import request from '@/utils/request' + +export function queryMenuListByPid(pid) { + return request({ + url: 'api/menu/queryMenuListByPid?pid=' + pid, + method: 'post' + }) +} + +export function queryMenuByArgs(params) { + return request({ + url: 'api/menu/queryMenuByArgs', + method: 'post', + data: params + }) +} + +export function queryMenuSuperior(ids) { + const data = Array.isArray(ids) ? ids : [ids] + return request({ + url: 'api/menu/queryMenuSuperior', + method: 'post', + data: data + }) +} + +export function queryChildMenuSet(id) { + return request({ + url: 'api/menu/queryChildMenuSet?id=' + id, + method: 'post' + }) +} + +export function buildMenus() { + return request({ + url: 'api/menu/buildMenus', + method: 'post' + }) +} + +export function add(data) { + return request({ + url: 'api/menu/saveMenu', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/menu/removeMenuByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/menu/modifyMenuById', + method: 'post', + data: data + }) +} + +export default { add, edit, del, queryMenuListByPid, queryMenuSuperior, queryMenuByArgs, queryChildMenuSet } diff --git a/cutejava-front/src/api/system/online.js b/cutejava-front/src/api/system/online.js index d9f7fccd..312ec091 100644 --- a/cutejava-front/src/api/system/online.js +++ b/cutejava-front/src/api/system/online.js @@ -1,9 +1,9 @@ -import request from '@/utils/request' - -export function kickOutUser(keys) { - return request({ - url: 'api/user/online/kickOutUser', - method: 'post', - data: keys - }) -} +import request from '@/utils/request' + +export function kickOutUser(keys) { + return request({ + url: 'api/user/online/kickOutUser', + method: 'post', + data: keys + }) +} diff --git a/cutejava-front/src/api/system/ossStorage.js b/cutejava-front/src/api/system/ossStorage.js index 8d26bd29..9ebb1754 100644 --- a/cutejava-front/src/api/system/ossStorage.js +++ b/cutejava-front/src/api/system/ossStorage.js @@ -1,19 +1,19 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/ossStorage/uploadFile', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/ossStorage/removeFileByIds', - method: 'post', - data: ids - }) -} - -export default { add, del } +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/ossStorage/uploadFile', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/ossStorage/removeFileByIds', + method: 'post', + data: ids + }) +} + +export default { add, del } diff --git a/cutejava-front/src/api/system/quartzJob.js b/cutejava-front/src/api/system/quartzJob.js index 41722e39..073e62ef 100644 --- a/cutejava-front/src/api/system/quartzJob.js +++ b/cutejava-front/src/api/system/quartzJob.js @@ -1,41 +1,41 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/quartzJob/createQuartzJob', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/quartzJob/removeJobByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/quartzJob', - method: 'put', - data: data - }) -} - -export function switchQuartzJobStatus(id) { - return request({ - url: 'api/quartzJob/switchQuartzJobStatus/' + id, - method: 'post' - }) -} - -export function startQuartzJob(id) { - return request({ - url: 'api/quartzJob/startQuartzJob/' + id, - method: 'post' - }) -} - -export default { add, edit, del, switchQuartzJobStatus, startQuartzJob } +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/quartzJob/createQuartzJob', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/quartzJob/removeJobByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/quartzJob', + method: 'put', + data: data + }) +} + +export function switchQuartzJobStatus(id) { + return request({ + url: 'api/quartzJob/switchQuartzJobStatus/' + id, + method: 'post' + }) +} + +export function startQuartzJob(id) { + return request({ + url: 'api/quartzJob/startQuartzJob/' + id, + method: 'post' + }) +} + +export default { add, edit, del, switchQuartzJobStatus, startQuartzJob } diff --git a/cutejava-front/src/api/system/role.js b/cutejava-front/src/api/system/role.js index c897d1e5..6320c14b 100644 --- a/cutejava-front/src/api/system/role.js +++ b/cutejava-front/src/api/system/role.js @@ -1,58 +1,58 @@ -import request from '@/utils/request' - -// 获取所有的Role -export function queryRoleList() { - return request({ - url: 'api/role/queryRoleList', - method: 'post' - }) -} - -export function add(data) { - return request({ - url: 'api/role/saveRole', - method: 'post', - data: data - }) -} - -export function get(id) { - return request({ - url: 'api/role/queryRoleById', - method: 'post', - data: { id: id } - }) -} - -export function getLevel() { - return request({ - url: 'api/role/queryRoleLevel', - method: 'post' - }) -} - -export function del(ids) { - return request({ - url: 'api/role/removeRoleByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/role/modifyRoleById', - method: 'post', - data: data - }) -} - -export function editMenu(data) { - return request({ - url: 'api/role/modifyBindMenuById', - method: 'post', - data - }) -} - -export default { add, edit, del, get, editMenu, getLevel } +import request from '@/utils/request' + +// 获取所有的Role +export function queryRoleList() { + return request({ + url: 'api/role/queryRoleList', + method: 'post' + }) +} + +export function add(data) { + return request({ + url: 'api/role/saveRole', + method: 'post', + data: data + }) +} + +export function get(id) { + return request({ + url: 'api/role/queryRoleById', + method: 'post', + data: { id: id } + }) +} + +export function getLevel() { + return request({ + url: 'api/role/queryRoleLevel', + method: 'post' + }) +} + +export function del(ids) { + return request({ + url: 'api/role/removeRoleByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/role/modifyRoleById', + method: 'post', + data: data + }) +} + +export function editMenu(data) { + return request({ + url: 'api/role/modifyBindMenuById', + method: 'post', + data + }) +} + +export default { add, edit, del, get, editMenu, getLevel } diff --git a/cutejava-front/src/api/system/user.js b/cutejava-front/src/api/system/user.js index 71314aa6..3364d7df 100644 --- a/cutejava-front/src/api/system/user.js +++ b/cutejava-front/src/api/system/user.js @@ -1,84 +1,84 @@ -import request from '@/utils/request' -import { encrypt } from '@/utils/CsRsaUtil' - -export function add(data) { - return request({ - url: 'api/user/saveUser', - method: 'post', - data: data - }) -} - -export function del(ids) { - return request({ - url: 'api/user/removeUserByIds', - method: 'post', - data: ids - }) -} - -export function resetPwd(ids) { - return request({ - url: 'api/user/resetUserPasswordByIds', - method: 'post', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/user/modifyUserById', - method: 'post', - data: data - }) -} - -export function editUser(data) { - return request({ - url: 'api/user/modifyUserCenterInfoById', - method: 'post', - data: data - }) -} - -export function updatePass(user) { - const data = { - oldPass: encrypt(user.oldPass), - newPass: encrypt(user.newPass) - } - return request({ - url: 'api/user/modifyUserPasswordByUsername', - method: 'post', - data: data - }) -} - -export function updateEmail(form) { - const data = { - password: encrypt(form.pass), - email: form.email - } - return request({ - url: 'api/user/modifyUserEmailByUsername/' + form.code, - method: 'post', - data: data - }) -} - -export function queryUserMetaPage(query) { - const params = { - page: 1, - size: 50, - args: { - blurry: query - } - } - return request({ - url: 'api/user/queryUserMetadataOptions', - method: 'post', - data: params - }) -} - -export default { add, edit, del, resetPwd, queryUserMetaPage } - +import request from '@/utils/request' +import { encrypt } from '@/utils/CsRsaUtil' + +export function add(data) { + return request({ + url: 'api/user/saveUser', + method: 'post', + data: data + }) +} + +export function del(ids) { + return request({ + url: 'api/user/removeUserByIds', + method: 'post', + data: ids + }) +} + +export function resetPwd(ids) { + return request({ + url: 'api/user/resetUserPasswordByIds', + method: 'post', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/user/modifyUserById', + method: 'post', + data: data + }) +} + +export function editUser(data) { + return request({ + url: 'api/user/modifyUserCenterInfoById', + method: 'post', + data: data + }) +} + +export function updatePass(user) { + const data = { + oldPass: encrypt(user.oldPass), + newPass: encrypt(user.newPass) + } + return request({ + url: 'api/user/modifyUserPasswordByUsername', + method: 'post', + data: data + }) +} + +export function updateEmail(form) { + const data = { + password: encrypt(form.pass), + email: form.email + } + return request({ + url: 'api/user/modifyUserEmailByUsername/' + form.code, + method: 'post', + data: data + }) +} + +export function queryUserMetaPage(query) { + const params = { + page: 1, + size: 50, + args: { + blurry: query + } + } + return request({ + url: 'api/user/queryUserMetadataOptions', + method: 'post', + data: params + }) +} + +export default { add, edit, del, resetPwd, queryUserMetaPage } + diff --git a/cutejava-front/src/assets/icons/index.js b/cutejava-front/src/assets/icons/index.js index 2c6b309c..d79e1646 100644 --- a/cutejava-front/src/assets/icons/index.js +++ b/cutejava-front/src/assets/icons/index.js @@ -1,9 +1,9 @@ -import Vue from 'vue' -import SvgIcon from '@/components/SvgIcon'// svg component - -// register globally -Vue.component('svg-icon', SvgIcon) - -const req = require.context('./svg', false, /\.svg$/) -const requireAll = requireContext => requireContext.keys().map(requireContext) -requireAll(req) +import Vue from 'vue' +import SvgIcon from '@/components/SvgIcon'// svg component + +// register globally +Vue.component('svg-icon', SvgIcon) + +const req = require.context('./svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys().map(requireContext) +requireAll(req) diff --git a/cutejava-front/src/assets/icons/svg/add.svg b/cutejava-front/src/assets/icons/svg/add.svg index 2ddbd0bf..7c5829a6 100644 --- a/cutejava-front/src/assets/icons/svg/add.svg +++ b/cutejava-front/src/assets/icons/svg/add.svg @@ -1,2 +1,2 @@ -{{ - item.meta.title - }} - {{ item.meta.title }} - - - - - - - - + + + + + diff --git a/cutejava-front/src/components/Crud/CRUD.operation.vue b/cutejava-front/src/components/Crud/CRUD.operation.vue index 87c4ebec..c33346fc 100644 --- a/cutejava-front/src/components/Crud/CRUD.operation.vue +++ b/cutejava-front/src/components/Crud/CRUD.operation.vue @@ -1,276 +1,276 @@ - - - - + + + + diff --git a/cutejava-front/src/components/Crud/Pagination.vue b/cutejava-front/src/components/Crud/Pagination.vue index 0cf3873e..82638d3a 100644 --- a/cutejava-front/src/components/Crud/Pagination.vue +++ b/cutejava-front/src/components/Crud/Pagination.vue @@ -1,19 +1,19 @@ - - - + + + diff --git a/cutejava-front/src/components/Crud/RR.operation.vue b/cutejava-front/src/components/Crud/RR.operation.vue index 1b8107b3..d25070b5 100644 --- a/cutejava-front/src/components/Crud/RR.operation.vue +++ b/cutejava-front/src/components/Crud/RR.operation.vue @@ -1,34 +1,34 @@ - - - + + + diff --git a/cutejava-front/src/components/Crud/UD.operation.vue b/cutejava-front/src/components/Crud/UD.operation.vue index ee40ee70..b41baf95 100644 --- a/cutejava-front/src/components/Crud/UD.operation.vue +++ b/cutejava-front/src/components/Crud/UD.operation.vue @@ -1,100 +1,101 @@ - - + + diff --git a/cutejava-front/src/components/Crud/crud.js b/cutejava-front/src/components/Crud/crud.js index f0eed075..5350fd85 100644 --- a/cutejava-front/src/components/Crud/crud.js +++ b/cutejava-front/src/components/Crud/crud.js @@ -1,873 +1,873 @@ -import { download, initData } from '@/api/data' -import Vue from 'vue' -import { DownloadFile } from '@/utils/CsDomUtil' - -/** - * CRUD配置 - * @author moxun - * @param {*} options
- * @return crud instance. - * @example - * 要使用多crud时,请在关联crud的组件处使用crud-tag进行标记,如: - */ -function CRUD(options) { - const defaultOptions = { - tag: 'default', - // id字段名 - idField: 'id', - // 标题 - title: '', - // 请求数据的url - url: '', - // 表格数据 - data: [], - // 选择项 - selections: [], - // 待查询的对象 - query: {}, - // 查询数据的参数 - params: {}, - // Form 表单 - form: {}, - // 重置表单 - defaultForm: () => { - }, - // 等待时间 - time: 50, - // CRUD Method - crudMethod: { - add: (form) => { - }, - del: (id) => { - }, - edit: (form) => { - }, - get: (id) => { - } - }, - // 主页操作栏显示哪些按钮 - optShow: { - add: true, - edit: true, - del: true, - download: true, - reset: true - }, - // 自定义一些扩展属性 - props: {}, - // 在主页准备 - queryOnPresenterCreated: true, - // 调试开关 - debug: false - } - options = mergeOptions(defaultOptions, options) - const data = { - ...options, - // 记录数据状态 - dataStatus: {}, - status: { - add: CRUD.STATUS.NORMAL, - edit: CRUD.STATUS.NORMAL, - // 添加或编辑状态 - get cu() { - if (this.add === CRUD.STATUS.NORMAL && this.edit === CRUD.STATUS.NORMAL) { - return CRUD.STATUS.NORMAL - } else if (this.add === CRUD.STATUS.PREPARED || this.edit === CRUD.STATUS.PREPARED) { - return CRUD.STATUS.PREPARED - } else if (this.add === CRUD.STATUS.PROCESSING || this.edit === CRUD.STATUS.PROCESSING) { - return CRUD.STATUS.PROCESSING - } - throw new Error('wrong crud\'s cu status') - }, - // 标题 - get title() { - return this.add > CRUD.STATUS.NORMAL ? `新增${crud.title}` : this.edit > CRUD.STATUS.NORMAL ? `编辑${crud.title}` : crud.title - } - }, - msg: { - submit: '提交成功', - add: '新增成功', - edit: '编辑成功', - del: '删除成功' - }, - page: { - // 页码 - page: 1, - // 每页数据条数 - size: 10, - // 总数据条数 - total: 0 - }, - // 整体loading - loading: false, - // 导出的 Loading - downloadLoading: false, - // 删除的 Loading - delAllLoading: false - } - const methods = { - /** - * 通用的提示 - */ - submitSuccessNotify() { - crud.notify(crud.msg.submit, CRUD.NOTIFICATION_TYPE.SUCCESS) - }, - addSuccessNotify() { - crud.notify(crud.msg.add, CRUD.NOTIFICATION_TYPE.SUCCESS) - }, - editSuccessNotify() { - crud.notify(crud.msg.edit, CRUD.NOTIFICATION_TYPE.SUCCESS) - }, - delSuccessNotify() { - crud.notify(crud.msg.del, CRUD.NOTIFICATION_TYPE.SUCCESS) - }, - // 搜索 - toQuery() { - crud.page.page = 1 - crud.refresh() - }, - // 刷新 - refresh() { - if (!callVmHook(crud, CRUD.HOOK.beforeRefresh)) { - return - } - return new Promise((resolve, reject) => { - crud.loading = true - // 请求数据 - initData(crud.url, crud.getQueryParams()).then(data => { - const table = crud.getTable() - if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据 - table.store.states.treeData = {} - table.store.states.lazyTreeNodeMap = {} - } - crud.page.total = data.totalElements - crud.data = data.content - crud.resetDataStatus() - // time 毫秒后显示表格 - setTimeout(() => { - crud.loading = false - callVmHook(crud, CRUD.HOOK.afterRefresh) - }, crud.time) - resolve(data) - }).catch(err => { - crud.loading = false - reject(err) - }) - }) - }, - /** - * 启动添加 - */ - toAdd() { - crud.resetForm() - if (!(callVmHook(crud, CRUD.HOOK.beforeToAdd, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { - return - } - crud.status.add = CRUD.STATUS.PREPARED - callVmHook(crud, CRUD.HOOK.afterToAdd, crud.form) - callVmHook(crud, CRUD.HOOK.afterToCU, crud.form) - }, - /** - * 启动编辑 - * @param {*} data 数据项 - */ - toEdit(data) { - crud.resetForm(JSON.parse(JSON.stringify(data))) - if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { - return - } - crud.status.edit = CRUD.STATUS.PREPARED - crud.getDataStatus(crud.getDataId(data)).edit = CRUD.STATUS.PREPARED - callVmHook(crud, CRUD.HOOK.afterToEdit, crud.form) - callVmHook(crud, CRUD.HOOK.afterToCU, crud.form) - }, - /** - * 启动删除 - * @param {*} data 数据项 - */ - toDelete(data) { - crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.PREPARED - }, - /** - * 取消删除 - * @param {*} data 数据项 - */ - cancelDelete(data) { - if (!callVmHook(crud, CRUD.HOOK.beforeDeleteCancel, data)) { - return - } - crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.NORMAL - callVmHook(crud, CRUD.HOOK.afterDeleteCancel, data) - }, - /** - * 取消新增/编辑 - */ - cancelCU() { - const addStatus = crud.status.add - const editStatus = crud.status.edit - if (addStatus === CRUD.STATUS.PREPARED) { - if (!callVmHook(crud, CRUD.HOOK.beforeAddCancel, crud.form)) { - return - } - crud.status.add = CRUD.STATUS.NORMAL - } - if (editStatus === CRUD.STATUS.PREPARED) { - if (!callVmHook(crud, CRUD.HOOK.beforeEditCancel, crud.form)) { - return - } - crud.status.edit = CRUD.STATUS.NORMAL - crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL - } - crud.resetForm() - if (addStatus === CRUD.STATUS.PREPARED) { - callVmHook(crud, CRUD.HOOK.afterAddCancel, crud.form) - } - if (editStatus === CRUD.STATUS.PREPARED) { - callVmHook(crud, CRUD.HOOK.afterEditCancel, crud.form) - } - // 清除表单验证 - if (crud.findVM('form').$refs['form']) { - crud.findVM('form').$refs['form'].clearValidate() - } - }, - /** - * 提交新增/编辑 - */ - submitCU() { - if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) { - return - } - crud.findVM('form').$refs['form'].validate(valid => { - if (!valid) { - return - } - if (!callVmHook(crud, CRUD.HOOK.afterValidateCU)) { - return - } - if (crud.status.add === CRUD.STATUS.PREPARED) { - crud.doAdd() - } else if (crud.status.edit === CRUD.STATUS.PREPARED) { - crud.doEdit() - } - }) - }, - /** - * 执行添加 - */ - doAdd() { - if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) { - return - } - crud.status.add = CRUD.STATUS.PROCESSING - crud.crudMethod.add(crud.form).then(() => { - crud.status.add = CRUD.STATUS.NORMAL - crud.resetForm() - crud.addSuccessNotify() - callVmHook(crud, CRUD.HOOK.afterSubmit) - crud.toQuery() - }).catch(() => { - crud.status.add = CRUD.STATUS.PREPARED - callVmHook(crud, CRUD.HOOK.afterAddError) - }) - }, - /** - * 执行编辑 - */ - doEdit() { - if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) { - return - } - crud.status.edit = CRUD.STATUS.PROCESSING - crud.crudMethod.edit(crud.form).then(() => { - crud.status.edit = CRUD.STATUS.NORMAL - crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL - crud.editSuccessNotify() - crud.resetForm() - callVmHook(crud, CRUD.HOOK.afterSubmit) - crud.refresh() - }).catch(() => { - crud.status.edit = CRUD.STATUS.PREPARED - callVmHook(crud, CRUD.HOOK.afterEditError) - }) - }, - /** - * 执行删除 - * @param {*} data 数据项 - */ - doDelete(data) { - let delAll = false - let dataStatus - const ids = [] - if (data instanceof Array) { - delAll = true - data.forEach(val => { - ids.push(this.getDataId(val)) - }) - } else { - ids.push(this.getDataId(data)) - dataStatus = crud.getDataStatus(this.getDataId(data)) - } - if (!callVmHook(crud, CRUD.HOOK.beforeDelete, data)) { - return - } - if (!delAll) { - dataStatus.delete = CRUD.STATUS.PROCESSING - } - return crud.crudMethod.del(ids).then(() => { - if (delAll) { - crud.delAllLoading = false - } else dataStatus.delete = CRUD.STATUS.PREPARED - crud.dleChangePage(1) - crud.delSuccessNotify() - callVmHook(crud, CRUD.HOOK.afterDelete, data) - crud.refresh() - }).catch(() => { - if (delAll) { - crud.delAllLoading = false - } else dataStatus.delete = CRUD.STATUS.PREPARED - }) - }, - /** - * 通用导出 - */ - doExport() { - crud.downloadLoading = true - download(crud.url + '/download', crud.getQueryParams()).then(result => { - DownloadFile(result, crud.title + '数据', 'xlsx') - crud.downloadLoading = false - }).catch(() => { - crud.downloadLoading = false - }) - }, - /** - * 获取查询参数 - */ - getQueryParams: function() { - // 清除参数无值的情况 - Object.keys(crud.query).length !== 0 && Object.keys(crud.query).forEach(item => { - if (crud.query[item] === null || crud.query[item] === '') crud.query[item] = undefined - }) - Object.keys(crud.params).length !== 0 && Object.keys(crud.params).forEach(item => { - if (crud.params[item] === null || crud.params[item] === '') crud.params[item] = undefined - }) - return { - page: crud.page.page, - size: crud.page.size, - args: { - ...crud.query, - ...crud.params - } - } - }, - // 当前页改变 - pageChangeHandler(e) { - crud.page.page = e - crud.refresh() - }, - // 每页条数改变 - sizeChangeHandler(e) { - crud.page.size = e - crud.page.page = 1 - crud.refresh() - }, - // 预防删除第二页最后一条数据时,或者多选删除第二页的数据时,页码错误导致请求无数据 - dleChangePage(size) { - if (crud.data.length === size && crud.page.page !== 1) { - crud.page.page -= 1 - } - }, - // 选择改变 - selectionChangeHandler(val) { - crud.selections = val - }, - /** - * 重置查询参数 - * @param {Boolean} toQuery 重置后进行查询操作 - */ - resetQuery(toQuery = true) { - const defaultQuery = JSON.parse(JSON.stringify(crud.defaultQuery)) - const query = crud.query - Object.keys(query).forEach(key => { - query[key] = defaultQuery[key] - }) - // 重置参数 - this.params = {} - if (toQuery) { - crud.toQuery() - } - }, - /** - * 重置表单 - * @param {Array} data 数据 - */ - resetForm(data) { - delete crud.form['createTime'] - delete crud.form['updateTime'] - delete crud.form['createBy'] - delete crud.form['updateBy'] - const form = data || (typeof crud.defaultForm === 'object' ? JSON.parse(JSON.stringify(crud.defaultForm)) : crud.defaultForm.apply(crud.findVM('form'))) - const crudFrom = crud.form - for (const key in form) { - if (crudFrom.hasOwnProperty(key)) { - crudFrom[key] = form[key] - } else { - Vue.set(crudFrom, key, form[key]) - } - } - // add by ghl 2020-10-04 页面重复添加信息时,下拉框的校验会存在,需要找工取消 - if (crud.findVM('form').$refs['form']) { - crud.findVM('form').$refs['form'].clearValidate() - } - }, - /** - * 重置数据状态 - */ - resetDataStatus() { - const dataStatus = {} - - function resetStatus(datas) { - datas.forEach(e => { - dataStatus[crud.getDataId(e)] = { - delete: 0, - edit: 0 - } - if (e.children) { - resetStatus(e.children) - } - }) - } - - resetStatus(crud.data) - crud.dataStatus = dataStatus - }, - /** - * 获取数据状态 - * @param {Number | String} id 数据项id - */ - getDataStatus(id) { - return crud.dataStatus[id] - }, - /** - * 用于树形表格多选, 选中所有 - * @param selection - */ - selectAllChange(selection) { - // 如果选中的数目与请求到的数目相同就选中子节点,否则就清空选中 - if (selection && selection.length === crud.data.length) { - selection.forEach(val => { - crud.selectChange(selection, val) - }) - } else { - crud.getTable().clearSelection() - } - }, - /** - * 用于树形表格多选,单选的封装 - * @param selection - * @param row - */ - selectChange(selection, row) { - // 如果selection中存在row代表是选中,否则是取消选中 - if (selection.find(val => { - return crud.getDataId(val) === crud.getDataId(row) - })) { - if (row.children) { - row.children.forEach(val => { - crud.getTable().toggleRowSelection(val, true) - selection.push(val) - if (val.children) { - crud.selectChange(selection, val) - } - }) - } - } else { - crud.toggleRowSelection(selection, row) - } - }, - /** - * 切换选中状态 - * @param selection - * @param data - */ - toggleRowSelection(selection, data) { - if (data.children) { - data.children.forEach(val => { - selection.splice(selection.findIndex(item => this.getDataId(item) === this.getDataId(val)), 1) - crud.getTable().toggleRowSelection(val, false) - if (val.children) { - crud.toggleRowSelection(selection, val) - } - }) - } - }, - findVM(type) { - return crud.vms.find(vm => vm && vm.type === type).vm - }, - notify(title, type = CRUD.NOTIFICATION_TYPE.INFO) { - crud.vms[0].vm.$notify({ - title, - type, - duration: 2500 - }) - }, - updateProp(name, value) { - Vue.set(crud.props, name, value) - }, - getDataId(data) { - return data[this.idField] - }, - getTable() { - return this.findVM('presenter').$refs.table - }, - attchTable() { - const table = this.getTable() - this.updateProp('table', table) - const that = this - table.$on('expand-change', (row, expanded) => { - if (!expanded) { - return - } - const lazyTreeNodeMap = table.store.states.lazyTreeNodeMap - row.children = lazyTreeNodeMap[crud.getDataId(row)] - if (row.children) { - row.children.forEach(ele => { - const id = crud.getDataId(ele) - if (that.dataStatus[id] === undefined) { - that.dataStatus[id] = { - delete: 0, - edit: 0 - } - } - }) - } - }) - } - } - const crud = Object.assign({}, data) - // 可观测化 - Vue.observable(crud) - // 附加方法 - Object.assign(crud, methods) - // 记录初始默认的查询参数,后续重置查询时使用 - Object.assign(crud, { - defaultQuery: JSON.parse(JSON.stringify(data.query)), - // 预留4位存储:组件 主页、头部、分页、表单,调试查看也方便找 - vms: Array(4), - /** - * 注册组件实例 - * @param {String} type 类型 - * @param {*} vm 组件实例 - * @param {Number} index 该参数内部使用 - */ - registerVM(type, vm, index = -1) { - const vmObj = { - type, - vm: vm - } - if (index < 0) { - this.vms.push(vmObj) - return - } - if (index < 4) { // 内置预留vm数 - this.vms[index] = vmObj - return - } - this.vms.length = Math.max(this.vms.length, index) - this.vms.splice(index, 1, vmObj) - }, - /** - * 取消注册组件实例 - * @param {*} vm 组件实例 - */ - unregisterVM(type, vm) { - for (let i = this.vms.length - 1; i >= 0; i--) { - if (this.vms[i] === undefined) { - continue - } - if (this.vms[i].type === type && this.vms[i].vm === vm) { - if (i < 4) { // 内置预留vm数 - this.vms[i] = undefined - } else { - this.vms.splice(i, 1) - } - break - } - } - } - }) - // 冻结处理,需要扩展数据的话,使用crud.updateProp(name, value),以crud.props.name形式访问,这个是响应式的,可以做数据绑定 - Object.freeze(crud) - return crud -} - -// hook VM -function callVmHook(crud, hook) { - if (crud.debug) { - console.log('callVmHook: ' + hook) - } - const tagHook = crud.tag ? hook + '$' + crud.tag : null - let ret = true - const nargs = [crud] - for (let i = 2; i < arguments.length; ++i) { - nargs.push(arguments[i]) - } - // 有些组件扮演了多个角色,调用钩子时,需要去重 - const vmSet = new Set() - crud.vms.forEach(vm => vm && vmSet.add(vm.vm)) - vmSet.forEach(vm => { - if (vm[hook]) { - ret = vm[hook].apply(vm, nargs) !== false && ret - } - if (tagHook && vm[tagHook]) { - ret = vm[tagHook].apply(vm, nargs) !== false && ret - } - }) - return ret -} - -function mergeOptions(src, opts) { - const optsRet = { - ...src - } - for (const key in src) { - if (opts.hasOwnProperty(key)) { - optsRet[key] = opts[key] - } - } - return optsRet -} - -/** - * 查找crud - * @param {*} vm - * @param {string} tag - */ -function lookupCrud(vm, tag) { - tag = tag || vm.$attrs['crud-tag'] || 'default' - // function lookupCrud(vm, tag) { - if (vm.$crud) { - const ret = vm.$crud[tag] - if (ret) { - return ret - } - } - return vm.$parent ? lookupCrud(vm.$parent, tag) : undefined -} - -/** - * crud主页 - */ -function presenter(crud) { - if (crud) { - console.warn('[CRUD warn]: ' + 'please use $options.cruds() { return CRUD(...) or [CRUD(...), ...] }') - } - return { - data() { - // 在data中返回crud,是为了将crud与当前实例关联,组件观测crud相关属性变化 - return { - crud: this.crud - } - }, - beforeCreate() { - this.$crud = this.$crud || {} - let cruds = this.$options.cruds instanceof Function ? this.$options.cruds() : crud - if (!(cruds instanceof Array)) { - cruds = [cruds] - } - cruds.forEach(ele => { - if (this.$crud[ele.tag]) { - console.error('[CRUD error]: ' + 'crud with tag [' + ele.tag + ' is already exist') - } - this.$crud[ele.tag] = ele - ele.registerVM('presenter', this, 0) - }) - this.crud = this.$crud['defalut'] || cruds[0] - }, - created() { - for (const k in this.$crud) { - if (this.$crud[k].queryOnPresenterCreated) { - this.$crud[k].toQuery() - } - } - }, - destroyed() { - for (const k in this.$crud) { - this.$crud[k].unregisterVM('presenter', this) - } - }, - mounted() { - // 如果table未实例化(例如使用了v-if),请稍后在适当时机crud.attchTable刷新table信息 - if (this.$refs.table !== undefined) { - this.crud.attchTable() - } - } - } -} - -/** - * 头部 - */ -function header() { - return { - data() { - return { - crud: this.crud, - query: this.crud.query - } - }, - beforeCreate() { - this.crud = lookupCrud(this) - this.crud.registerVM('header', this, 1) - }, - destroyed() { - this.crud.unregisterVM('header', this) - } - } -} - -/** - * 分页 - */ -function pagination() { - return { - data() { - return { - crud: this.crud, - page: this.crud.page - } - }, - beforeCreate() { - this.crud = lookupCrud(this) - this.crud.registerVM('pagination', this, 2) - }, - destroyed() { - this.crud.unregisterVM('pagination', this) - } - } -} - -/** - * 表单 - */ -function form(defaultForm) { - return { - data() { - return { - crud: this.crud, - form: this.crud.form - } - }, - beforeCreate() { - this.crud = lookupCrud(this) - this.crud.registerVM('form', this, 3) - }, - created() { - this.crud.defaultForm = defaultForm - this.crud.resetForm() - }, - destroyed() { - this.crud.unregisterVM('form', this) - } - } -} - -/** - * crud - */ -function crud(options = {}) { - const defaultOptions = { - type: undefined - } - options = mergeOptions(defaultOptions, options) - return { - data() { - return { - crud: this.crud - } - }, - beforeCreate() { - this.crud = lookupCrud(this) - this.crud.registerVM(options.type, this) - }, - destroyed() { - this.crud.unregisterVM(options.type, this) - } - } -} - -/** - * CRUD钩子 - */ -CRUD.HOOK = { - /** 刷新 - 之前 */ - beforeRefresh: 'beforeCrudRefresh', - /** 刷新 - 之后 */ - afterRefresh: 'afterCrudRefresh', - /** 删除 - 之前 */ - beforeDelete: 'beforeCrudDelete', - /** 删除 - 之后 */ - afterDelete: 'afterCrudDelete', - /** 删除取消 - 之前 */ - beforeDeleteCancel: 'beforeCrudDeleteCancel', - /** 删除取消 - 之后 */ - afterDeleteCancel: 'afterCrudDeleteCancel', - /** 新建 - 之前 */ - beforeToAdd: 'beforeCrudToAdd', - /** 新建 - 之后 */ - afterToAdd: 'afterCrudToAdd', - /** 编辑 - 之前 */ - beforeToEdit: 'beforeCrudToEdit', - /** 编辑 - 之后 */ - afterToEdit: 'afterCrudToEdit', - /** 开始 "新建/编辑" - 之前 */ - beforeToCU: 'beforeCrudToCU', - /** 开始 "新建/编辑" - 之后 */ - afterToCU: 'afterCrudToCU', - /** "新建/编辑" 验证 - 之前 */ - beforeValidateCU: 'beforeCrudValidateCU', - /** "新建/编辑" 验证 - 之后 */ - afterValidateCU: 'afterCrudValidateCU', - /** 添加取消 - 之前 */ - beforeAddCancel: 'beforeCrudAddCancel', - /** 添加取消 - 之后 */ - afterAddCancel: 'afterCrudAddCancel', - /** 编辑取消 - 之前 */ - beforeEditCancel: 'beforeCrudEditCancel', - /** 编辑取消 - 之后 */ - afterEditCancel: 'afterCrudEditCancel', - /** 提交 - 之前 */ - beforeSubmit: 'beforeCrudSubmitCU', - /** 提交 - 之后 */ - afterSubmit: 'afterCrudSubmitCU', - afterAddError: 'afterCrudAddError', - afterEditError: 'afterCrudEditError' -} - -/** - * CRUD状态 - */ -CRUD.STATUS = { - NORMAL: 0, - PREPARED: 1, - PROCESSING: 2 -} - -/** - * CRUD通知类型 - */ -CRUD.NOTIFICATION_TYPE = { - SUCCESS: 'success', - WARNING: 'warning', - INFO: 'info', - ERROR: 'error' -} - -export default CRUD - -export { - presenter, - header, - form, - pagination, - crud -} +import { download, initData } from '@/api/data' +import Vue from 'vue' +import { DownloadFile } from '@/utils/CsDomUtil' + +/** + * CRUD配置 + * @author moxun + * @param {*} options
+ * @return crud instance. + * @example + * 要使用多crud时,请在关联crud的组件处使用crud-tag进行标记,如: + */ +function CRUD(options) { + const defaultOptions = { + tag: 'default', + // id字段名 + idField: 'id', + // 标题 + title: '', + // 请求数据的url + url: '', + // 表格数据 + data: [], + // 选择项 + selections: [], + // 待查询的对象 + query: {}, + // 查询数据的参数 + params: {}, + // Form 表单 + form: {}, + // 重置表单 + defaultForm: () => { + }, + // 等待时间 + time: 50, + // CRUD Method + crudMethod: { + add: (form) => { + }, + del: (id) => { + }, + edit: (form) => { + }, + get: (id) => { + } + }, + // 主页操作栏显示哪些按钮 + optShow: { + add: true, + edit: true, + del: true, + download: true, + reset: true + }, + // 自定义一些扩展属性 + props: {}, + // 在主页准备 + queryOnPresenterCreated: true, + // 调试开关 + debug: false + } + options = mergeOptions(defaultOptions, options) + const data = { + ...options, + // 记录数据状态 + dataStatus: {}, + status: { + add: CRUD.STATUS.NORMAL, + edit: CRUD.STATUS.NORMAL, + // 添加或编辑状态 + get cu() { + if (this.add === CRUD.STATUS.NORMAL && this.edit === CRUD.STATUS.NORMAL) { + return CRUD.STATUS.NORMAL + } else if (this.add === CRUD.STATUS.PREPARED || this.edit === CRUD.STATUS.PREPARED) { + return CRUD.STATUS.PREPARED + } else if (this.add === CRUD.STATUS.PROCESSING || this.edit === CRUD.STATUS.PROCESSING) { + return CRUD.STATUS.PROCESSING + } + throw new Error('wrong crud\'s cu status') + }, + // 标题 + get title() { + return this.add > CRUD.STATUS.NORMAL ? `新增${crud.title}` : this.edit > CRUD.STATUS.NORMAL ? `编辑${crud.title}` : crud.title + } + }, + msg: { + submit: '提交成功', + add: '新增成功', + edit: '编辑成功', + del: '删除成功' + }, + page: { + // 页码 + page: 1, + // 每页数据条数 + size: 10, + // 总数据条数 + total: 0 + }, + // 整体loading + loading: false, + // 导出的 Loading + downloadLoading: false, + // 删除的 Loading + delAllLoading: false + } + const methods = { + /** + * 通用的提示 + */ + submitSuccessNotify() { + crud.notify(crud.msg.submit, CRUD.NOTIFICATION_TYPE.SUCCESS) + }, + addSuccessNotify() { + crud.notify(crud.msg.add, CRUD.NOTIFICATION_TYPE.SUCCESS) + }, + editSuccessNotify() { + crud.notify(crud.msg.edit, CRUD.NOTIFICATION_TYPE.SUCCESS) + }, + delSuccessNotify() { + crud.notify(crud.msg.del, CRUD.NOTIFICATION_TYPE.SUCCESS) + }, + // 搜索 + toQuery() { + crud.page.page = 1 + crud.refresh() + }, + // 刷新 + refresh() { + if (!callVmHook(crud, CRUD.HOOK.beforeRefresh)) { + return + } + return new Promise((resolve, reject) => { + crud.loading = true + // 请求数据 + initData(crud.url, crud.getQueryParams()).then(data => { + const table = crud.getTable() + if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据 + table.store.states.treeData = {} + table.store.states.lazyTreeNodeMap = {} + } + crud.page.total = data.totalElements + crud.data = data.content + crud.resetDataStatus() + // time 毫秒后显示表格 + setTimeout(() => { + crud.loading = false + callVmHook(crud, CRUD.HOOK.afterRefresh) + }, crud.time) + resolve(data) + }).catch(err => { + crud.loading = false + reject(err) + }) + }) + }, + /** + * 启动添加 + */ + toAdd() { + crud.resetForm() + if (!(callVmHook(crud, CRUD.HOOK.beforeToAdd, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { + return + } + crud.status.add = CRUD.STATUS.PREPARED + callVmHook(crud, CRUD.HOOK.afterToAdd, crud.form) + callVmHook(crud, CRUD.HOOK.afterToCU, crud.form) + }, + /** + * 启动编辑 + * @param {*} data 数据项 + */ + toEdit(data) { + crud.resetForm(JSON.parse(JSON.stringify(data))) + if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { + return + } + crud.status.edit = CRUD.STATUS.PREPARED + crud.getDataStatus(crud.getDataId(data)).edit = CRUD.STATUS.PREPARED + callVmHook(crud, CRUD.HOOK.afterToEdit, crud.form) + callVmHook(crud, CRUD.HOOK.afterToCU, crud.form) + }, + /** + * 启动删除 + * @param {*} data 数据项 + */ + toDelete(data) { + crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.PREPARED + }, + /** + * 取消删除 + * @param {*} data 数据项 + */ + cancelDelete(data) { + if (!callVmHook(crud, CRUD.HOOK.beforeDeleteCancel, data)) { + return + } + crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.NORMAL + callVmHook(crud, CRUD.HOOK.afterDeleteCancel, data) + }, + /** + * 取消新增/编辑 + */ + cancelCU() { + const addStatus = crud.status.add + const editStatus = crud.status.edit + if (addStatus === CRUD.STATUS.PREPARED) { + if (!callVmHook(crud, CRUD.HOOK.beforeAddCancel, crud.form)) { + return + } + crud.status.add = CRUD.STATUS.NORMAL + } + if (editStatus === CRUD.STATUS.PREPARED) { + if (!callVmHook(crud, CRUD.HOOK.beforeEditCancel, crud.form)) { + return + } + crud.status.edit = CRUD.STATUS.NORMAL + crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL + } + crud.resetForm() + if (addStatus === CRUD.STATUS.PREPARED) { + callVmHook(crud, CRUD.HOOK.afterAddCancel, crud.form) + } + if (editStatus === CRUD.STATUS.PREPARED) { + callVmHook(crud, CRUD.HOOK.afterEditCancel, crud.form) + } + // 清除表单验证 + if (crud.findVM('form').$refs['form']) { + crud.findVM('form').$refs['form'].clearValidate() + } + }, + /** + * 提交新增/编辑 + */ + submitCU() { + if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) { + return + } + crud.findVM('form').$refs['form'].validate(valid => { + if (!valid) { + return + } + if (!callVmHook(crud, CRUD.HOOK.afterValidateCU)) { + return + } + if (crud.status.add === CRUD.STATUS.PREPARED) { + crud.doAdd() + } else if (crud.status.edit === CRUD.STATUS.PREPARED) { + crud.doEdit() + } + }) + }, + /** + * 执行添加 + */ + doAdd() { + if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) { + return + } + crud.status.add = CRUD.STATUS.PROCESSING + crud.crudMethod.add(crud.form).then(() => { + crud.status.add = CRUD.STATUS.NORMAL + crud.resetForm() + crud.addSuccessNotify() + callVmHook(crud, CRUD.HOOK.afterSubmit) + crud.toQuery() + }).catch(() => { + crud.status.add = CRUD.STATUS.PREPARED + callVmHook(crud, CRUD.HOOK.afterAddError) + }) + }, + /** + * 执行编辑 + */ + doEdit() { + if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) { + return + } + crud.status.edit = CRUD.STATUS.PROCESSING + crud.crudMethod.edit(crud.form).then(() => { + crud.status.edit = CRUD.STATUS.NORMAL + crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL + crud.editSuccessNotify() + crud.resetForm() + callVmHook(crud, CRUD.HOOK.afterSubmit) + crud.refresh() + }).catch(() => { + crud.status.edit = CRUD.STATUS.PREPARED + callVmHook(crud, CRUD.HOOK.afterEditError) + }) + }, + /** + * 执行删除 + * @param {*} data 数据项 + */ + doDelete(data) { + let delAll = false + let dataStatus + const ids = [] + if (data instanceof Array) { + delAll = true + data.forEach(val => { + ids.push(this.getDataId(val)) + }) + } else { + ids.push(this.getDataId(data)) + dataStatus = crud.getDataStatus(this.getDataId(data)) + } + if (!callVmHook(crud, CRUD.HOOK.beforeDelete, data)) { + return + } + if (!delAll) { + dataStatus.delete = CRUD.STATUS.PROCESSING + } + return crud.crudMethod.del(ids).then(() => { + if (delAll) { + crud.delAllLoading = false + } else dataStatus.delete = CRUD.STATUS.PREPARED + crud.dleChangePage(1) + crud.delSuccessNotify() + callVmHook(crud, CRUD.HOOK.afterDelete, data) + crud.refresh() + }).catch(() => { + if (delAll) { + crud.delAllLoading = false + } else dataStatus.delete = CRUD.STATUS.PREPARED + }) + }, + /** + * 通用导出 + */ + doExport() { + crud.downloadLoading = true + download(crud.url + '/download', crud.getQueryParams()).then(result => { + DownloadFile(result, crud.title + '数据', 'xlsx') + crud.downloadLoading = false + }).catch(() => { + crud.downloadLoading = false + }) + }, + /** + * 获取查询参数 + */ + getQueryParams: function() { + // 清除参数无值的情况 + Object.keys(crud.query).length !== 0 && Object.keys(crud.query).forEach(item => { + if (crud.query[item] === null || crud.query[item] === '') crud.query[item] = undefined + }) + Object.keys(crud.params).length !== 0 && Object.keys(crud.params).forEach(item => { + if (crud.params[item] === null || crud.params[item] === '') crud.params[item] = undefined + }) + return { + page: crud.page.page, + size: crud.page.size, + args: { + ...crud.query, + ...crud.params + } + } + }, + // 当前页改变 + pageChangeHandler(e) { + crud.page.page = e + crud.refresh() + }, + // 每页条数改变 + sizeChangeHandler(e) { + crud.page.size = e + crud.page.page = 1 + crud.refresh() + }, + // 预防删除第二页最后一条数据时,或者多选删除第二页的数据时,页码错误导致请求无数据 + dleChangePage(size) { + if (crud.data.length === size && crud.page.page !== 1) { + crud.page.page -= 1 + } + }, + // 选择改变 + selectionChangeHandler(val) { + crud.selections = val + }, + /** + * 重置查询参数 + * @param {Boolean} toQuery 重置后进行查询操作 + */ + resetQuery(toQuery = true) { + const defaultQuery = JSON.parse(JSON.stringify(crud.defaultQuery)) + const query = crud.query + Object.keys(query).forEach(key => { + query[key] = defaultQuery[key] + }) + // 重置参数 + this.params = {} + if (toQuery) { + crud.toQuery() + } + }, + /** + * 重置表单 + * @param {Array} data 数据 + */ + resetForm(data) { + delete crud.form['createTime'] + delete crud.form['updateTime'] + delete crud.form['createBy'] + delete crud.form['updateBy'] + const form = data || (typeof crud.defaultForm === 'object' ? JSON.parse(JSON.stringify(crud.defaultForm)) : crud.defaultForm.apply(crud.findVM('form'))) + const crudFrom = crud.form + for (const key in form) { + if (crudFrom.hasOwnProperty(key)) { + crudFrom[key] = form[key] + } else { + Vue.set(crudFrom, key, form[key]) + } + } + // add by ghl 2020-10-04 页面重复添加信息时,下拉框的校验会存在,需要找工取消 + if (crud.findVM('form').$refs['form']) { + crud.findVM('form').$refs['form'].clearValidate() + } + }, + /** + * 重置数据状态 + */ + resetDataStatus() { + const dataStatus = {} + + function resetStatus(datas) { + datas.forEach(e => { + dataStatus[crud.getDataId(e)] = { + delete: 0, + edit: 0 + } + if (e.children) { + resetStatus(e.children) + } + }) + } + + resetStatus(crud.data) + crud.dataStatus = dataStatus + }, + /** + * 获取数据状态 + * @param {Number | String} id 数据项id + */ + getDataStatus(id) { + return crud.dataStatus[id] + }, + /** + * 用于树形表格多选, 选中所有 + * @param selection + */ + selectAllChange(selection) { + // 如果选中的数目与请求到的数目相同就选中子节点,否则就清空选中 + if (selection && selection.length === crud.data.length) { + selection.forEach(val => { + crud.selectChange(selection, val) + }) + } else { + crud.getTable().clearSelection() + } + }, + /** + * 用于树形表格多选,单选的封装 + * @param selection + * @param row + */ + selectChange(selection, row) { + // 如果selection中存在row代表是选中,否则是取消选中 + if (selection.find(val => { + return crud.getDataId(val) === crud.getDataId(row) + })) { + if (row.children) { + row.children.forEach(val => { + crud.getTable().toggleRowSelection(val, true) + selection.push(val) + if (val.children) { + crud.selectChange(selection, val) + } + }) + } + } else { + crud.toggleRowSelection(selection, row) + } + }, + /** + * 切换选中状态 + * @param selection + * @param data + */ + toggleRowSelection(selection, data) { + if (data.children) { + data.children.forEach(val => { + selection.splice(selection.findIndex(item => this.getDataId(item) === this.getDataId(val)), 1) + crud.getTable().toggleRowSelection(val, false) + if (val.children) { + crud.toggleRowSelection(selection, val) + } + }) + } + }, + findVM(type) { + return crud.vms.find(vm => vm && vm.type === type).vm + }, + notify(title, type = CRUD.NOTIFICATION_TYPE.INFO) { + crud.vms[0].vm.$notify({ + title, + type, + duration: 2500 + }) + }, + updateProp(name, value) { + Vue.set(crud.props, name, value) + }, + getDataId(data) { + return data[this.idField] + }, + getTable() { + return this.findVM('presenter').$refs.table + }, + attchTable() { + const table = this.getTable() + this.updateProp('table', table) + const that = this + table.$on('expand-change', (row, expanded) => { + if (!expanded) { + return + } + const lazyTreeNodeMap = table.store.states.lazyTreeNodeMap + row.children = lazyTreeNodeMap[crud.getDataId(row)] + if (row.children) { + row.children.forEach(ele => { + const id = crud.getDataId(ele) + if (that.dataStatus[id] === undefined) { + that.dataStatus[id] = { + delete: 0, + edit: 0 + } + } + }) + } + }) + } + } + const crud = Object.assign({}, data) + // 可观测化 + Vue.observable(crud) + // 附加方法 + Object.assign(crud, methods) + // 记录初始默认的查询参数,后续重置查询时使用 + Object.assign(crud, { + defaultQuery: JSON.parse(JSON.stringify(data.query)), + // 预留4位存储:组件 主页、头部、分页、表单,调试查看也方便找 + vms: Array(4), + /** + * 注册组件实例 + * @param {String} type 类型 + * @param {*} vm 组件实例 + * @param {Number} index 该参数内部使用 + */ + registerVM(type, vm, index = -1) { + const vmObj = { + type, + vm: vm + } + if (index < 0) { + this.vms.push(vmObj) + return + } + if (index < 4) { // 内置预留vm数 + this.vms[index] = vmObj + return + } + this.vms.length = Math.max(this.vms.length, index) + this.vms.splice(index, 1, vmObj) + }, + /** + * 取消注册组件实例 + * @param {*} vm 组件实例 + */ + unregisterVM(type, vm) { + for (let i = this.vms.length - 1; i >= 0; i--) { + if (this.vms[i] === undefined) { + continue + } + if (this.vms[i].type === type && this.vms[i].vm === vm) { + if (i < 4) { // 内置预留vm数 + this.vms[i] = undefined + } else { + this.vms.splice(i, 1) + } + break + } + } + } + }) + // 冻结处理,需要扩展数据的话,使用crud.updateProp(name, value),以crud.props.name形式访问,这个是响应式的,可以做数据绑定 + Object.freeze(crud) + return crud +} + +// hook VM +function callVmHook(crud, hook) { + if (crud.debug) { + console.log('callVmHook: ' + hook) + } + const tagHook = crud.tag ? hook + '$' + crud.tag : null + let ret = true + const nargs = [crud] + for (let i = 2; i < arguments.length; ++i) { + nargs.push(arguments[i]) + } + // 有些组件扮演了多个角色,调用钩子时,需要去重 + const vmSet = new Set() + crud.vms.forEach(vm => vm && vmSet.add(vm.vm)) + vmSet.forEach(vm => { + if (vm[hook]) { + ret = vm[hook].apply(vm, nargs) !== false && ret + } + if (tagHook && vm[tagHook]) { + ret = vm[tagHook].apply(vm, nargs) !== false && ret + } + }) + return ret +} + +function mergeOptions(src, opts) { + const optsRet = { + ...src + } + for (const key in src) { + if (opts.hasOwnProperty(key)) { + optsRet[key] = opts[key] + } + } + return optsRet +} + +/** + * 查找crud + * @param {*} vm + * @param {string} tag + */ +function lookupCrud(vm, tag) { + tag = tag || vm.$attrs['crud-tag'] || 'default' + // function lookupCrud(vm, tag) { + if (vm.$crud) { + const ret = vm.$crud[tag] + if (ret) { + return ret + } + } + return vm.$parent ? lookupCrud(vm.$parent, tag) : undefined +} + +/** + * crud主页 + */ +function presenter(crud) { + if (crud) { + console.warn('[CRUD warn]: ' + 'please use $options.cruds() { return CRUD(...) or [CRUD(...), ...] }') + } + return { + data() { + // 在data中返回crud,是为了将crud与当前实例关联,组件观测crud相关属性变化 + return { + crud: this.crud + } + }, + beforeCreate() { + this.$crud = this.$crud || {} + let cruds = this.$options.cruds instanceof Function ? this.$options.cruds() : crud + if (!(cruds instanceof Array)) { + cruds = [cruds] + } + cruds.forEach(ele => { + if (this.$crud[ele.tag]) { + console.error('[CRUD error]: ' + 'crud with tag [' + ele.tag + ' is already exist') + } + this.$crud[ele.tag] = ele + ele.registerVM('presenter', this, 0) + }) + this.crud = this.$crud['defalut'] || cruds[0] + }, + created() { + for (const k in this.$crud) { + if (this.$crud[k].queryOnPresenterCreated) { + this.$crud[k].toQuery() + } + } + }, + destroyed() { + for (const k in this.$crud) { + this.$crud[k].unregisterVM('presenter', this) + } + }, + mounted() { + // 如果table未实例化(例如使用了v-if),请稍后在适当时机crud.attchTable刷新table信息 + if (this.$refs.table !== undefined) { + this.crud.attchTable() + } + } + } +} + +/** + * 头部 + */ +function header() { + return { + data() { + return { + crud: this.crud, + query: this.crud.query + } + }, + beforeCreate() { + this.crud = lookupCrud(this) + this.crud.registerVM('header', this, 1) + }, + destroyed() { + this.crud.unregisterVM('header', this) + } + } +} + +/** + * 分页 + */ +function pagination() { + return { + data() { + return { + crud: this.crud, + page: this.crud.page + } + }, + beforeCreate() { + this.crud = lookupCrud(this) + this.crud.registerVM('pagination', this, 2) + }, + destroyed() { + this.crud.unregisterVM('pagination', this) + } + } +} + +/** + * 表单 + */ +function form(defaultForm) { + return { + data() { + return { + crud: this.crud, + form: this.crud.form + } + }, + beforeCreate() { + this.crud = lookupCrud(this) + this.crud.registerVM('form', this, 3) + }, + created() { + this.crud.defaultForm = defaultForm + this.crud.resetForm() + }, + destroyed() { + this.crud.unregisterVM('form', this) + } + } +} + +/** + * crud + */ +function crud(options = {}) { + const defaultOptions = { + type: undefined + } + options = mergeOptions(defaultOptions, options) + return { + data() { + return { + crud: this.crud + } + }, + beforeCreate() { + this.crud = lookupCrud(this) + this.crud.registerVM(options.type, this) + }, + destroyed() { + this.crud.unregisterVM(options.type, this) + } + } +} + +/** + * CRUD钩子 + */ +CRUD.HOOK = { + /** 刷新 - 之前 */ + beforeRefresh: 'beforeCrudRefresh', + /** 刷新 - 之后 */ + afterRefresh: 'afterCrudRefresh', + /** 删除 - 之前 */ + beforeDelete: 'beforeCrudDelete', + /** 删除 - 之后 */ + afterDelete: 'afterCrudDelete', + /** 删除取消 - 之前 */ + beforeDeleteCancel: 'beforeCrudDeleteCancel', + /** 删除取消 - 之后 */ + afterDeleteCancel: 'afterCrudDeleteCancel', + /** 新建 - 之前 */ + beforeToAdd: 'beforeCrudToAdd', + /** 新建 - 之后 */ + afterToAdd: 'afterCrudToAdd', + /** 编辑 - 之前 */ + beforeToEdit: 'beforeCrudToEdit', + /** 编辑 - 之后 */ + afterToEdit: 'afterCrudToEdit', + /** 开始 "新建/编辑" - 之前 */ + beforeToCU: 'beforeCrudToCU', + /** 开始 "新建/编辑" - 之后 */ + afterToCU: 'afterCrudToCU', + /** "新建/编辑" 验证 - 之前 */ + beforeValidateCU: 'beforeCrudValidateCU', + /** "新建/编辑" 验证 - 之后 */ + afterValidateCU: 'afterCrudValidateCU', + /** 添加取消 - 之前 */ + beforeAddCancel: 'beforeCrudAddCancel', + /** 添加取消 - 之后 */ + afterAddCancel: 'afterCrudAddCancel', + /** 编辑取消 - 之前 */ + beforeEditCancel: 'beforeCrudEditCancel', + /** 编辑取消 - 之后 */ + afterEditCancel: 'afterCrudEditCancel', + /** 提交 - 之前 */ + beforeSubmit: 'beforeCrudSubmitCU', + /** 提交 - 之后 */ + afterSubmit: 'afterCrudSubmitCU', + afterAddError: 'afterCrudAddError', + afterEditError: 'afterCrudEditError' +} + +/** + * CRUD状态 + */ +CRUD.STATUS = { + NORMAL: 0, + PREPARED: 1, + PROCESSING: 2 +} + +/** + * CRUD通知类型 + */ +CRUD.NOTIFICATION_TYPE = { + SUCCESS: 'success', + WARNING: 'warning', + INFO: 'info', + ERROR: 'error' +} + +export default CRUD + +export { + presenter, + header, + form, + pagination, + crud +} diff --git a/cutejava-front/src/components/DateRangePicker/index.vue b/cutejava-front/src/components/DateRangePicker/index.vue index 8feea56d..90da277f 100644 --- a/cutejava-front/src/components/DateRangePicker/index.vue +++ b/cutejava-front/src/components/DateRangePicker/index.vue @@ -1,45 +1,45 @@ - + diff --git a/cutejava-front/src/components/Dict/Dict.js b/cutejava-front/src/components/Dict/Dict.js index 48554de7..e0c21cb1 100644 --- a/cutejava-front/src/components/Dict/Dict.js +++ b/cutejava-front/src/components/Dict/Dict.js @@ -1,29 +1,29 @@ -import Vue from 'vue' -import { get as getDictDetail } from '@/api/system/dictDetail' - -export default class Dict { - constructor(dict) { - this.dict = dict - } - - async init(names, completeCallback) { - if (names === undefined || name === null) { - throw new Error('need Dict names') - } - const ps = [] - names.forEach(n => { - Vue.set(this.dict.dict, n, {}) - Vue.set(this.dict.label, n, {}) - Vue.set(this.dict, n, []) - ps.push(getDictDetail(n).then(data => { - this.dict[n].splice(0, 0, ...data.content) - data.content.forEach(d => { - Vue.set(this.dict.dict[n], d.value, d) - Vue.set(this.dict.label[n], d.value, d.label) - }) - })) - }) - await Promise.all(ps) - completeCallback() - } -} +import Vue from 'vue' +import { get as getDictDetail } from '@/api/system/dictDetail' + +export default class Dict { + constructor(dict) { + this.dict = dict + } + + async init(names, completeCallback) { + if (names === undefined || name === null) { + throw new Error('need Dict names') + } + const ps = [] + names.forEach(n => { + Vue.set(this.dict.dict, n, {}) + Vue.set(this.dict.label, n, {}) + Vue.set(this.dict, n, []) + ps.push(getDictDetail(n).then(data => { + this.dict[n].splice(0, 0, ...data.content) + data.content.forEach(d => { + Vue.set(this.dict.dict[n], d.value, d) + Vue.set(this.dict.label[n], d.value, d.label) + }) + })) + }) + await Promise.all(ps) + completeCallback() + } +} diff --git a/cutejava-front/src/components/Dict/index.js b/cutejava-front/src/components/Dict/index.js index 0952f439..7f6d94dd 100644 --- a/cutejava-front/src/components/Dict/index.js +++ b/cutejava-front/src/components/Dict/index.js @@ -1,29 +1,29 @@ -import Dict from './Dict' - -const install = function(Vue) { - Vue.mixin({ - data() { - if (this.$options.dicts instanceof Array) { - const dict = { - dict: {}, - label: {} - } - return { - dict - } - } - return {} - }, - created() { - if (this.$options.dicts instanceof Array) { - new Dict(this.dict).init(this.$options.dicts, () => { - this.$nextTick(() => { - this.$emit('dictReady') - }) - }) - } - } - }) -} - -export default { install } +import Dict from './Dict' + +const install = function(Vue) { + Vue.mixin({ + data() { + if (this.$options.dicts instanceof Array) { + const dict = { + dict: {}, + label: {} + } + return { + dict + } + } + return {} + }, + created() { + if (this.$options.dicts instanceof Array) { + new Dict(this.dict).init(this.$options.dicts, () => { + this.$nextTick(() => { + this.$emit('dictReady') + }) + }) + } + } + }) +} + +export default { install } diff --git a/cutejava-front/src/components/Echarts/BarChart.vue b/cutejava-front/src/components/Echarts/BarChart.vue index ff1b04f5..0b4fdac6 100644 --- a/cutejava-front/src/components/Echarts/BarChart.vue +++ b/cutejava-front/src/components/Echarts/BarChart.vue @@ -1,107 +1,107 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Category.vue b/cutejava-front/src/components/Echarts/Category.vue index 1ec8c048..172ecf6b 100644 --- a/cutejava-front/src/components/Echarts/Category.vue +++ b/cutejava-front/src/components/Echarts/Category.vue @@ -1,438 +1,438 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Funnel.vue b/cutejava-front/src/components/Echarts/Funnel.vue index 384875a3..8ca35bc0 100644 --- a/cutejava-front/src/components/Echarts/Funnel.vue +++ b/cutejava-front/src/components/Echarts/Funnel.vue @@ -1,120 +1,120 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Gauge.vue b/cutejava-front/src/components/Echarts/Gauge.vue index 500d1975..0f754dbe 100644 --- a/cutejava-front/src/components/Echarts/Gauge.vue +++ b/cutejava-front/src/components/Echarts/Gauge.vue @@ -1,74 +1,74 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Graph.vue b/cutejava-front/src/components/Echarts/Graph.vue index 3bd718c3..b7b8cb4e 100644 --- a/cutejava-front/src/components/Echarts/Graph.vue +++ b/cutejava-front/src/components/Echarts/Graph.vue @@ -1,101 +1,101 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/HeatMap.vue b/cutejava-front/src/components/Echarts/HeatMap.vue index 8cc19ecc..96055fb3 100644 --- a/cutejava-front/src/components/Echarts/HeatMap.vue +++ b/cutejava-front/src/components/Echarts/HeatMap.vue @@ -1,105 +1,105 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/PieChart.vue b/cutejava-front/src/components/Echarts/PieChart.vue index 648271e8..5e1cb7b0 100644 --- a/cutejava-front/src/components/Echarts/PieChart.vue +++ b/cutejava-front/src/components/Echarts/PieChart.vue @@ -1,85 +1,85 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Point.vue b/cutejava-front/src/components/Echarts/Point.vue index a44436c4..7d7236eb 100644 --- a/cutejava-front/src/components/Echarts/Point.vue +++ b/cutejava-front/src/components/Echarts/Point.vue @@ -1,149 +1,149 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/RadarChart.vue b/cutejava-front/src/components/Echarts/RadarChart.vue index a240d983..e287f018 100644 --- a/cutejava-front/src/components/Echarts/RadarChart.vue +++ b/cutejava-front/src/components/Echarts/RadarChart.vue @@ -1,121 +1,121 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Rich.vue b/cutejava-front/src/components/Echarts/Rich.vue index 3ed88030..aeab73f5 100644 --- a/cutejava-front/src/components/Echarts/Rich.vue +++ b/cutejava-front/src/components/Echarts/Rich.vue @@ -1,149 +1,149 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Sankey.vue b/cutejava-front/src/components/Echarts/Sankey.vue index 28fed816..75a6ed41 100644 --- a/cutejava-front/src/components/Echarts/Sankey.vue +++ b/cutejava-front/src/components/Echarts/Sankey.vue @@ -1,100 +1,100 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Scatter.vue b/cutejava-front/src/components/Echarts/Scatter.vue index bc213a04..834ddbdc 100644 --- a/cutejava-front/src/components/Echarts/Scatter.vue +++ b/cutejava-front/src/components/Echarts/Scatter.vue @@ -1,143 +1,143 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/Sunburst.vue b/cutejava-front/src/components/Echarts/Sunburst.vue index 275870eb..cdce6363 100644 --- a/cutejava-front/src/components/Echarts/Sunburst.vue +++ b/cutejava-front/src/components/Echarts/Sunburst.vue @@ -1,107 +1,107 @@ - - - + + + diff --git a/cutejava-front/src/components/Echarts/ThemeRiver.vue b/cutejava-front/src/components/Echarts/ThemeRiver.vue index e227ba30..1f9524df 100644 --- a/cutejava-front/src/components/Echarts/ThemeRiver.vue +++ b/cutejava-front/src/components/Echarts/ThemeRiver.vue @@ -1,148 +1,148 @@ - - - + + + diff --git a/cutejava-front/src/components/GithubCorner/index.vue b/cutejava-front/src/components/GithubCorner/index.vue index 31942a66..bf8bd3fd 100644 --- a/cutejava-front/src/components/GithubCorner/index.vue +++ b/cutejava-front/src/components/GithubCorner/index.vue @@ -1,60 +1,60 @@ - - - + + + diff --git a/cutejava-front/src/components/Hamburger/index.vue b/cutejava-front/src/components/Hamburger/index.vue index 27231c1f..8c772469 100644 --- a/cutejava-front/src/components/Hamburger/index.vue +++ b/cutejava-front/src/components/Hamburger/index.vue @@ -1,46 +1,46 @@ - - - - - + + + + + diff --git a/cutejava-front/src/components/HeaderSearch/index.vue b/cutejava-front/src/components/HeaderSearch/index.vue index 64d9c992..29ae9265 100644 --- a/cutejava-front/src/components/HeaderSearch/index.vue +++ b/cutejava-front/src/components/HeaderSearch/index.vue @@ -1,190 +1,190 @@ - - - - - + + + + + diff --git a/cutejava-front/src/components/IconSelect/index.vue b/cutejava-front/src/components/IconSelect/index.vue index ed2cfc4a..0080b720 100644 --- a/cutejava-front/src/components/IconSelect/index.vue +++ b/cutejava-front/src/components/IconSelect/index.vue @@ -1,78 +1,78 @@ - - - - - + + + + + diff --git a/cutejava-front/src/components/IconSelect/requireIcons.js b/cutejava-front/src/components/IconSelect/requireIcons.js index 877e5b73..12cca824 100644 --- a/cutejava-front/src/components/IconSelect/requireIcons.js +++ b/cutejava-front/src/components/IconSelect/requireIcons.js @@ -1,10 +1,10 @@ -const req = require.context('../../assets/icons/svg', false, /\.svg$/) -const requireAll = requireContext => requireContext.keys() - -const re = /\.\/(.*)\.svg/ - -const icons = requireAll(req).map(i => { - return i.match(re)[1] -}) - -export default icons +const req = require.context('../../assets/icons/svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys() + +const re = /\.\/(.*)\.svg/ + +const icons = requireAll(req).map(i => { + return i.match(re)[1] +}) + +export default icons diff --git a/cutejava-front/src/components/Iframe/index.vue b/cutejava-front/src/components/Iframe/index.vue index cdd612b4..920284d7 100644 --- a/cutejava-front/src/components/Iframe/index.vue +++ b/cutejava-front/src/components/Iframe/index.vue @@ -1,30 +1,30 @@ -