mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-10 20:53:47 +08:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b782b953a5 | ||
|
|
4fc2976624 | ||
|
|
c692d0e6d3 | ||
|
|
1204787cf3 | ||
|
|
2d61c21398 | ||
|
|
fe6ab3798a | ||
|
|
0c0da77ecd | ||
|
|
c530d8db15 | ||
|
|
a1357155b9 | ||
|
|
b072b9e758 | ||
|
|
355643ce86 | ||
|
|
5e43679c3c | ||
|
|
5249c2fdf5 | ||
|
|
8fc8338bfa | ||
|
|
111d930f98 | ||
|
|
835076c301 | ||
|
|
02560ea621 | ||
|
|
606e763126 | ||
|
|
21cd668943 | ||
|
|
ea0159ddb4 | ||
|
|
f7155ac4c2 | ||
|
|
063190c314 | ||
|
|
46645e5696 | ||
|
|
701d95653e |
29
.gitignore
vendored
29
.gitignore
vendored
@@ -1,6 +1,31 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
**/target/
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
**/node_modules/
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
14
README.md
14
README.md
@@ -1,3 +1,4 @@
|
||||
### SmartAdmin 2.0 (即 vue3 的 js版本和ts版本 )正在火热开发中,欢迎持续关注 !
|
||||
#### 简介
|
||||
SmartAdmin由河南·洛阳 [1024创新实验室](https://www.1024lab.net/)团队研发的一套互联网企业级的通用型中后台解决方案!使用最前沿的前后台技术栈SpringBoot和Vue,前后端分离,<font color="#DC143C">**我们开源一套漂亮的代码和一套整洁的代码规范**</font>,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,热爱生活。SmartAdmin 让你从认识到忘不了,绝对是你最想要的!
|
||||
|
||||
@@ -5,8 +6,8 @@ SmartAdmin由河南·洛阳 [1024创新实验室](https://www.1024lab.net/)团
|
||||
github: [https://github.com/1024-lab/smart-admin](https://github.com/1024-lab/smart-admin)
|
||||
gitee: [https://gitee.com/lab1024/smart-admin](https://gitee.com/lab1024/smart-admin)
|
||||
在线预览: [http://preview.smartadmin.1024lab.net](http://preview.smartadmin.1024lab.net)
|
||||
部署文档:[http://smartadmin.1024lab.net/doc/2/168](http://smartadmin.1024lab.net/doc/2/168)
|
||||
平滑升级:[http://smartadmin.1024lab.net/doc/2/173](http://smartadmin.1024lab.net/doc/2/173)
|
||||
部署文档:[http://smartadmin.1024lab.net](http://smartadmin.1024lab.net)
|
||||
|
||||
|
||||
#### 疑惑
|
||||
有人问:又是个“轮子”? 轮子靠谱吗?为什么要选择你这个轮子?
|
||||
@@ -106,6 +107,12 @@ ps:以上规范基础都是以团队出发,让团队开心快乐的写代码
|
||||
#### 联系我们
|
||||
|
||||
[1024创新实验室](https://www.1024lab.net/)
|
||||
公众号
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2021/0305/210257_cd96d824_5469596.jpeg"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
SmartAdmin微信群(**加我微信拉你入群!**)
|
||||
|
||||
@@ -116,6 +123,9 @@ SmartAdmin微信群(**加我微信拉你入群!**)
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### 捐赠
|
||||
开源不易,感谢捐赠
|
||||
>*佛祖保佑捐赠这些人写程序永无bug,工资翻倍,迎娶白富美,走上人生巅峰!*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
NODE_ENV = development
|
||||
VUE_APP_ENV = dev
|
||||
VUE_APP_URL = http://127.0.0.1:10086/smart-admin-api/
|
||||
|
||||
VUE_APP_URL = http://127.0.0.1:10086/smart-admin-api
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
NODE_ENV = development
|
||||
VUE_APP_ENV = local
|
||||
VUE_APP_URL=http://127.0.0.1:10086/smart-admin-api/
|
||||
VUE_APP_URL = http://127.0.0.1:10086/smart-admin-api
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
NODE_ENV = production
|
||||
VUE_APP_ENV = pre
|
||||
VUE_APP_URL = http://smartadmin.1024lab.net/api/
|
||||
VUE_APP_URL = http://smartadmin.1024lab.net/smart-admin-api
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
NODE_ENV = production
|
||||
VUE_APP_ENV = prod
|
||||
VUE_APP_URL = http://smartadmin.1024lab.net/api/
|
||||
VUE_APP_URL = http://smartadmin.1024lab.net/smart-admin-api
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
NODE_ENV = production
|
||||
VUE_APP_ENV = sit
|
||||
VUE_APP_URL=http://127.0.0.1:10086/smart-admin-api/
|
||||
VUE_APP_URL = http://smartadmin.1024lab.net/smart-admin-api
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// 详情请看 https://github.com/michael-ciniawsky/postcss-load-config
|
||||
module.exports = {
|
||||
plugins: {
|
||||
autoprefixer: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[defaults]
|
||||
url = https://sentry.1024lab.net/
|
||||
org = 1024lab
|
||||
org = 1024lab-sentry
|
||||
project = smart-admin-h5
|
||||
|
||||
[auth]
|
||||
token = 8bab45b9152d44b19d4e0a762a93dd34a1318ee8317f46a0a007c48da0e9888e
|
||||
token = 8dflijsldjkasdo3u49230948pkjdasoia8023jl3k4jr29o81029i40534p545ke
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# ren-min-yi-xue-manage-h5
|
||||
|
||||
#### Description
|
||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
@@ -1,39 +1,4 @@
|
||||
# ren-min-yi-xue-manage-h5
|
||||
# SmartAdmin-H5
|
||||
|
||||
#### 介绍
|
||||
{**以下是 Gitee 平台说明,您可以替换此简介**
|
||||
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
|
||||
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
SmartAdmin-H5 是SmartAdmin 平台的移动端web项目
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "smart-admin-h5",
|
||||
"version": "1.0.0",
|
||||
"description": "基于Smart-H5的SmartAdmin的H5端",
|
||||
"description": "基于vue和vant的h5模板",
|
||||
"author": "zhuoluodada@qq.com",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -26,12 +26,12 @@
|
||||
"moment": "^2.29.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"regenerator-runtime": "^0.13.5",
|
||||
"vant": "^2.10.2",
|
||||
"vue": "^2.6.11",
|
||||
"vant": "^2.11.1",
|
||||
"vue": "^2.6.12",
|
||||
"vue-enum": "^1.0.5",
|
||||
"vue-loading-overlay": "^3.4.2",
|
||||
"vue-router": "^3.2.0",
|
||||
"vuex": "^3.4.0"
|
||||
"vue-router": "^3.4.0",
|
||||
"vuex": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sentry/webpack-plugin": "^1.11.1",
|
||||
@@ -46,15 +46,13 @@
|
||||
"compression-webpack-plugin": "^3.1.0",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"less": "^3.11.2",
|
||||
"less-loader": "^6.1.0",
|
||||
"node-sass": "^4.14.1",
|
||||
"postcss-pxtorem": "^5.1.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"script-ext-html-webpack-plugin": "^2.1.4",
|
||||
"sass": "^1.3.0",
|
||||
"sass-loader": "^9.0.3",
|
||||
"script-ext-html-webpack-plugin": "^2.1.5",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"vconsole": "^3.3.4",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"webpack-bundle-analyzer": "^3.8.0"
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"webpack-bundle-analyzer": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
name: 'App'
|
||||
};
|
||||
</script>
|
||||
<style lang="less">
|
||||
<style lang="scss">
|
||||
#nprogress .bar {
|
||||
background: #1989fa !important;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { getAxios, postAxios } from '@/lib/http';
|
||||
|
||||
export const crmSchoolApi = {
|
||||
|
||||
// 分校列表 - 分校 by yandanyang
|
||||
querySchoolList: (data) => {
|
||||
return postAxios('/admin/crm/school/list', data);
|
||||
},
|
||||
// 分校跟进详列表 - 分校 by yandanyang
|
||||
querySchoolTrackList: data => {
|
||||
return postAxios('/admin/crm/school/track/list', data);
|
||||
},
|
||||
|
||||
// 分校跟进 - 分校 by yandanyang
|
||||
addSchoolTrack: data => {
|
||||
return postAxios('/admin/crm/school/track/add', data);
|
||||
},
|
||||
// 分校跟进 - 分校 by yandanyang
|
||||
getSchoolTrackDetail: schoolTrackId => {
|
||||
return getAxios(`/admin/crm/school/track/detail/${schoolTrackId}`);
|
||||
}
|
||||
};
|
||||
@@ -2,42 +2,42 @@ import { postAxios, getAxios } from '@/lib/http';
|
||||
export const employeeApi = {
|
||||
// 员工管理查询
|
||||
getEmployeeList: (data) => {
|
||||
return postAxios('/employee/query', data);
|
||||
return postAxios('admin/employee/query', data);
|
||||
},
|
||||
// 添加员工
|
||||
addEmployee: (data) => {
|
||||
return postAxios('/employee/add', data);
|
||||
return postAxios('admin/employee/add', data);
|
||||
},
|
||||
// 更新员工信息
|
||||
updateEmployee: (data) => {
|
||||
return postAxios('/employee/update', data);
|
||||
return postAxios('admin/employee/update', data);
|
||||
},
|
||||
// 禁用启用单个员工
|
||||
updateStatus: (employeeId, status) => {
|
||||
return getAxios('/employee/updateStatus/' + employeeId + '/' + status);
|
||||
return getAxios('admin/employee/updateStatus/' + employeeId + '/' + status);
|
||||
},
|
||||
// 批量禁用
|
||||
updateStatusBatch: (data) => {
|
||||
return postAxios('/employee/batchUpdateStatus', data);
|
||||
return postAxios('admin/employee/batchUpdateStatus', data);
|
||||
},
|
||||
// 单个员工角色授权
|
||||
updateRoles: (data) => {
|
||||
return postAxios('/employee/updateRoles', data);
|
||||
return postAxios('admin/employee/updateRoles', data);
|
||||
},
|
||||
// 修改密码
|
||||
updatePwd: (data) => {
|
||||
return postAxios('/employee/updatePwd', data);
|
||||
return postAxios('admin/employee/updatePwd', data);
|
||||
},
|
||||
// 重置密码
|
||||
resetPassword: (employeeId) => {
|
||||
return getAxios('/employee/resetPasswd/' + employeeId);
|
||||
return getAxios('admin/employee/resetPasswd/' + employeeId);
|
||||
},
|
||||
// 通过部门id获取当前部门的人员&没有部门的人
|
||||
getListEmployeeByDeptId: (departmentId) => {
|
||||
return getAxios('/employee/listEmployeeByDeptId/' + departmentId);
|
||||
return getAxios('admin/employee/listEmployeeByDeptId/' + departmentId);
|
||||
},
|
||||
// 删除员工
|
||||
deleteEmployee: (employeeId) => {
|
||||
return postAxios('/employee/delete/' + employeeId);
|
||||
return postAxios('admin/employee/delete/' + employeeId);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { getAxios, postAxios } from '@/lib/http';
|
||||
|
||||
export const loginApi = {
|
||||
getVerificationCode: () => {
|
||||
return getAxios('/verificationCode');
|
||||
},
|
||||
login: (data) => {
|
||||
return postAxios('/login', data);
|
||||
return postAxios('/session/login', data);
|
||||
},
|
||||
logout: (token) => {
|
||||
return getAxios(`/logout?x-access-token=${token}`);
|
||||
return getAxios(`/session/logOut?x-access-token=${token}`);
|
||||
}
|
||||
};
|
||||
|
||||
7
smart-admin-h5/src/api/user.js
Normal file
7
smart-admin-h5/src/api/user.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { getAxios } from '@/lib/http';
|
||||
|
||||
export const userApi = {
|
||||
getSession: () => {
|
||||
return getAxios('/session/get');
|
||||
}
|
||||
};
|
||||
@@ -1,13 +1,5 @@
|
||||
@import './variables.scss';
|
||||
@import './mixin.scss';
|
||||
|
||||
html,
|
||||
body .app {
|
||||
color: #333333;
|
||||
font-family: Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
|
||||
background-color: $background-color;
|
||||
}
|
||||
|
||||
.app-container {
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
$text-color: #323233;
|
||||
$border-color: #ebedf0;
|
||||
$active-color: #f2f3f5;
|
||||
$background-color: #f7f8fa;
|
||||
$background-color-light: #fafafa;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// mixin
|
||||
// 清除浮动
|
||||
@mixin clearfix {
|
||||
&:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
// 多行隐藏
|
||||
@mixin textoverflow($clamp:1) {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: $clamp;
|
||||
/*! autoprefixer: ignore next */
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
//flex box
|
||||
@mixin flexbox($jc:space-between, $ai:center, $fd:row, $fw:nowrap) {
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
flex: 1;
|
||||
justify-content: $jc;
|
||||
-webkit-justify-content: $jc;
|
||||
align-items: $ai;
|
||||
-webkit-align-items: $ai;
|
||||
flex-direction: $fd;
|
||||
-webkit-flex-direction: $fd;
|
||||
flex-wrap: $fw;
|
||||
-webkit-flex-wrap: $fw;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
// variables
|
||||
$background-color: #f8f8f8;
|
||||
@@ -1,54 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<van-tabbar fixed route v-model="active" @change="handleChange">
|
||||
<van-tabbar-item v-for="(item, index) in data" :to="item.to" :icon="item.icon" :key="index">
|
||||
{{ item.title }}
|
||||
</van-tabbar-item>
|
||||
</van-tabbar>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'TabBar',
|
||||
props: {
|
||||
defaultActive: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: this.defaultActive
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleChange(value) {
|
||||
this.$emit('change', value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @description:department-employee-selector
|
||||
* @author: zhuoda
|
||||
* @date: 2020/10/30 13:56
|
||||
*/
|
||||
|
||||
<template>
|
||||
|
||||
@@ -2,8 +2,8 @@ import cookie from '@/lib/cookie';
|
||||
import { userApi } from 'api/user';
|
||||
|
||||
/**
|
||||
* 此 mixin为登录以后的页面用的,因为所有的有效路由(排除登录、注册、404,500 这个几个特殊页面)都会走 other-main 或者 tabber-main两个父级组件。
|
||||
* 所以对于一些session的信息获取只能放到这个两个main组件上,故此mixin只用于两个main组件,起到全局的作用
|
||||
* 此 mixin为登录以后的页面用的,因为所有的有效路由(排除登录、注册、404,500 这个几个特殊页面)都会走 App.vue里的router
|
||||
* @author zhuoda
|
||||
*/
|
||||
export default {
|
||||
created: function() {
|
||||
@@ -12,12 +12,14 @@ module.exports = {
|
||||
*/
|
||||
baseUrl: {
|
||||
apiUrl: process.env.VUE_APP_URL,
|
||||
erpApiUrl: process.env.VUE_APP_ERP_URL,
|
||||
webSocketUrl: process.env.VUE_APP_SOCKET_URL
|
||||
},
|
||||
/**
|
||||
* 打包后静态资源地址;如果是走cdn的话,可以配置如下:
|
||||
* publicPath: isProd ? 'https://cdn.1024lab.net/static/smart-h5/' : '/'
|
||||
*/
|
||||
publicPath: isProductionEnv ? '/smart-admin-h5/' : '/',
|
||||
publicPath: isProductionEnv ? '/manage-h5/' : '/',
|
||||
|
||||
// ==================== cdn 相关 begin ====================
|
||||
cdn: {
|
||||
|
||||
165
smart-admin-h5/src/constants/erp/contact-company.js
Normal file
165
smart-admin-h5/src/constants/erp/contact-company.js
Normal file
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* 往来单位性质
|
||||
* @type {{ENTERPRISE: {value: number, desc: string}, PERSONAL: {value: number, desc: string}}}
|
||||
*/
|
||||
export const CONTACT_COMPANY_NATURE_ENUM =
|
||||
{
|
||||
ENTERPRISE: {
|
||||
value: 0,
|
||||
desc: '企业'
|
||||
},
|
||||
PERSONAL: {
|
||||
value: 1,
|
||||
desc: '个人'
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 往来机构类型
|
||||
* @type {{CUSTOMER: {value: number, desc: string}, SUPPLIER: {value: number, desc: string}}}
|
||||
*/
|
||||
export const
|
||||
CONTACT_COMPANY_TYPE_ENUM =
|
||||
{
|
||||
CUSTOMER: {
|
||||
value: 0,
|
||||
desc: '客户'
|
||||
},
|
||||
SUPPLIER: {
|
||||
value: 1,
|
||||
desc: '供应商'
|
||||
},
|
||||
SCHOOL: {
|
||||
value: 2,
|
||||
desc: '分校'
|
||||
},
|
||||
COOPERATIVE_ORG: {
|
||||
value: 3,
|
||||
desc: '合作机构'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 付款方式
|
||||
* @type {{BANK: {value: number, desc: string}, ZHI_FU_BAO: {value: number, desc: string}, WE_CHAT: {value: number, desc: string}}}
|
||||
*/
|
||||
export const
|
||||
PAYMENT_TYPE_ENUM =
|
||||
{
|
||||
BANK: {
|
||||
value: 0,
|
||||
desc: '银行卡'
|
||||
},
|
||||
WE_CHAT: {
|
||||
value: 1,
|
||||
desc: '微信'
|
||||
},
|
||||
ZHI_FU_BAO: {
|
||||
value: 2,
|
||||
desc: '支付宝'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 往来机构余额类型
|
||||
* @type {{RECEIVE_BALANCE: {value: number, desc: string}, PAY_BALANCE: {value: number, desc: string}}}
|
||||
*/
|
||||
export const
|
||||
CONTACT_COMPANY_BALANCE_TYPE =
|
||||
{
|
||||
PAY_BALANCE: {
|
||||
value: 0,
|
||||
desc: '应付款余额'
|
||||
},
|
||||
RECEIVE_BALANCE: {
|
||||
value: 1,
|
||||
desc: '应收款余额'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 往来单位等级
|
||||
* @type {{CORE: {value: number, desc: string}, POTENTIAL: {value: number, desc: string}, BAD: {value: number, desc: string}, GENERAL: {value: number, desc: string}}}
|
||||
*/
|
||||
export const CONTACT_COMPANY_GRADE_ENUM = {
|
||||
CORE: {
|
||||
value: 1,
|
||||
desc: '核心',
|
||||
color: 'green'
|
||||
},
|
||||
POTENTIAL: {
|
||||
value: 2,
|
||||
desc: '有潜力',
|
||||
color: 'cyan'
|
||||
},
|
||||
GENERAL: {
|
||||
value: 3,
|
||||
desc: '普通',
|
||||
color: 'blue'
|
||||
},
|
||||
BAD: {
|
||||
value: 4,
|
||||
desc: '较差',
|
||||
color: 'purple'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 往来单位等级
|
||||
* @type {{OWNER: {value: number, desc: string}, SHARER: {value: number, desc: string}, COMMON: {value: number, desc: string}}}
|
||||
*/
|
||||
export const CONTACT_COMPANY_SHARE_TYPE_ENUM = {
|
||||
OWNER: {
|
||||
value: 0,
|
||||
desc: '属于我的'
|
||||
},
|
||||
SHARER: {
|
||||
value: 1,
|
||||
desc: '共享的'
|
||||
},
|
||||
COMMON: {
|
||||
value: 2,
|
||||
desc: '公共的'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 往来单位标签
|
||||
* @type {{OWNER: {value: number, desc: string}, SHARER: {value: number, desc: string}, COMMON: {value: number, desc: string}}}
|
||||
*/
|
||||
export const CONTACT_COMPANY_TAG_ENUM = {
|
||||
POTENTIAL: {
|
||||
value: 0,
|
||||
desc: '潜在',
|
||||
color: 'green'
|
||||
},
|
||||
INTENTION: {
|
||||
value: 1,
|
||||
desc: '意向',
|
||||
color: 'cyan'
|
||||
},
|
||||
NEGOTIATION: {
|
||||
value: 2,
|
||||
desc: '洽谈',
|
||||
color: 'blue'
|
||||
},
|
||||
DEAL: {
|
||||
value: 3,
|
||||
desc: '成交',
|
||||
color: 'geekblue'
|
||||
},
|
||||
LOSS: {
|
||||
value: 4,
|
||||
desc: '流失',
|
||||
color: 'red'
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
CONTACT_COMPANY_NATURE_ENUM,
|
||||
CONTACT_COMPANY_TYPE_ENUM,
|
||||
PAYMENT_TYPE_ENUM,
|
||||
CONTACT_COMPANY_BALANCE_TYPE,
|
||||
CONTACT_COMPANY_GRADE_ENUM,
|
||||
CONTACT_COMPANY_SHARE_TYPE_ENUM,
|
||||
CONTACT_COMPANY_TAG_ENUM
|
||||
};
|
||||
6
smart-admin-h5/src/constants/erp/index.js
Normal file
6
smart-admin-h5/src/constants/erp/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import contactCompany from './contact-company';
|
||||
|
||||
export default {
|
||||
...contactCompany
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import file from './file';
|
||||
import school from '@/constants/school';
|
||||
import erp from './erp';
|
||||
|
||||
export default {
|
||||
...file,
|
||||
...school,
|
||||
...erp
|
||||
};
|
||||
|
||||
71
smart-admin-h5/src/constants/school.js
Normal file
71
smart-admin-h5/src/constants/school.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 分校标签
|
||||
*/
|
||||
export const SCHOOL_TAG_ENUM = {
|
||||
POTENTIAL: {
|
||||
value: 0,
|
||||
desc: '潜在'
|
||||
},
|
||||
INTENTION: {
|
||||
value: 1,
|
||||
desc: '意向'
|
||||
},
|
||||
NEGOTIATION: {
|
||||
value: 2,
|
||||
desc: '洽谈'
|
||||
},
|
||||
DEAL: {
|
||||
value: 3,
|
||||
desc: '成交'
|
||||
},
|
||||
LOSS: {
|
||||
value: 4,
|
||||
desc: '流失'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 分校等级
|
||||
*/
|
||||
export const SCHOOL_GRADE_ENUM = {
|
||||
CORE: {
|
||||
value: 1,
|
||||
desc: '核心'
|
||||
},
|
||||
POTENTIAL: {
|
||||
value: 2,
|
||||
desc: '有潜力'
|
||||
},
|
||||
GENERAL: {
|
||||
value: 3,
|
||||
desc: '普通'
|
||||
},
|
||||
BAD: {
|
||||
value: 4,
|
||||
desc: '较差'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 共享类型
|
||||
*/
|
||||
export const SCHOOL_SHARE_TYPE_ENUM = {
|
||||
OWNER: {
|
||||
value: 0,
|
||||
desc: '属于我的'
|
||||
},
|
||||
SHARER: {
|
||||
value: 1,
|
||||
desc: '共享的'
|
||||
},
|
||||
COMMON: {
|
||||
value: 2,
|
||||
desc: '公共的'
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
SCHOOL_TAG_ENUM,
|
||||
SCHOOL_GRADE_ENUM,
|
||||
SCHOOL_SHARE_TYPE_ENUM
|
||||
};
|
||||
65
smart-admin-h5/src/lib/erp-http.js
Normal file
65
smart-admin-h5/src/lib/erp-http.js
Normal file
@@ -0,0 +1,65 @@
|
||||
import Axios from 'axios';
|
||||
import config from '@/config';
|
||||
import cookie from '@/lib/cookie';
|
||||
import { Toast } from 'vant';
|
||||
|
||||
export const baseUrl = config.baseUrl.erpApiUrl;
|
||||
|
||||
const axios = Axios.create({
|
||||
baseURL: baseUrl,
|
||||
timeout: 30000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
}
|
||||
});
|
||||
|
||||
// 添加请求拦截器
|
||||
axios.interceptors.request.use(
|
||||
function(config) {
|
||||
const token = cookie.getToken();
|
||||
if (token) {
|
||||
config.headers['x-access-token'] = token;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
function(error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
// 添加响应拦截器
|
||||
axios.interceptors.response.use(
|
||||
res => {
|
||||
const { data } = res;
|
||||
if (data && data.code && data.code !== 1) {
|
||||
if (data.code === 121) {
|
||||
cookie.clearToken();
|
||||
localStorage.clear();
|
||||
window.location.href = window.location.pathname + '#/login';
|
||||
Toast.fail('未登录,或登录失效,请登录');
|
||||
return;
|
||||
} else if (data.code === 502) {
|
||||
window.location.href = window.location.pathname + '#/500';
|
||||
return;
|
||||
} else {
|
||||
Toast.fail(data.msg);
|
||||
return Promise.reject(res);
|
||||
}
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
},
|
||||
error => {
|
||||
Toast.fail('服务内部错误');
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
export const postAxios = (url, data, config) => {
|
||||
return axios.post(url, data, config);
|
||||
};
|
||||
|
||||
export const getAxios = (url, data) => {
|
||||
return axios.get(url, {
|
||||
params: data
|
||||
});
|
||||
};
|
||||
@@ -1,6 +1,9 @@
|
||||
/*
|
||||
* @Description:
|
||||
* @Author: zhuoda
|
||||
* @Author: hanyu
|
||||
* @Date: 2020-05-28 12:46:06
|
||||
* @LastEditTime: 2020-07-08 09:16:15
|
||||
* @LastEditors: hy
|
||||
*/
|
||||
// smart sentry
|
||||
import * as Sentry from '@sentry/browser';
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
// 处理table操作按钮
|
||||
const tableAction = (h, array) => {
|
||||
let btnArray = [];
|
||||
let btnMore = [];
|
||||
array.map((item, index) => {
|
||||
if (index < 2) {
|
||||
let btn = h(
|
||||
'a',
|
||||
{
|
||||
props: {
|
||||
type: !index ? 'primary' : 'info',
|
||||
size: 'small',
|
||||
to: item.to ? item.to : '',
|
||||
target: item.target ? item.target : '_self',
|
||||
ghost: true
|
||||
},
|
||||
style: {
|
||||
marginLeft: '5px'
|
||||
},
|
||||
directives: item.directives,
|
||||
on: {
|
||||
click: item.action
|
||||
}
|
||||
},
|
||||
item.title
|
||||
);
|
||||
btnArray.push(btn);
|
||||
} else {
|
||||
btnMore.push(
|
||||
h(
|
||||
'DropdownItem',
|
||||
{
|
||||
nativeOn: {
|
||||
click: item.action
|
||||
}
|
||||
},
|
||||
item.title
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
let dropdown = h(
|
||||
'Dropdown',
|
||||
{
|
||||
props: {
|
||||
transfer: true
|
||||
}
|
||||
},
|
||||
[
|
||||
h(
|
||||
'a',
|
||||
{
|
||||
props: {
|
||||
type: 'default',
|
||||
size: 'small'
|
||||
},
|
||||
style: {
|
||||
marginLeft: '5px'
|
||||
}
|
||||
},
|
||||
[
|
||||
h('span', '更多'),
|
||||
h('Icon', {
|
||||
props: {
|
||||
type: 'ios-arrow-down'
|
||||
}
|
||||
})
|
||||
]
|
||||
),
|
||||
h(
|
||||
'DropdownMenu',
|
||||
{
|
||||
slot: 'list'
|
||||
},
|
||||
btnMore
|
||||
)
|
||||
]
|
||||
);
|
||||
if (array.length > 2) {
|
||||
btnArray.push(dropdown);
|
||||
}
|
||||
return btnArray;
|
||||
};
|
||||
export default tableAction;
|
||||
@@ -12,7 +12,7 @@ import 'vant/lib/index.css';
|
||||
// 引入首个组件
|
||||
import App from './App.vue';
|
||||
// 引入自定义主题样式
|
||||
import './themes/index.less';
|
||||
import './themes/index.scss';
|
||||
// 引入过滤器
|
||||
import './filters';
|
||||
// 引入配置信息
|
||||
|
||||
42
smart-admin-h5/src/router/dashboard/index.js
Normal file
42
smart-admin-h5/src/router/dashboard/index.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
/**
|
||||
* dashboard首页
|
||||
*/
|
||||
export const dashboardRouter = [
|
||||
{
|
||||
path: '/',
|
||||
// redirect: '/dashboard/contact-company',
|
||||
redirect: '/dashboard/user',
|
||||
meta: {
|
||||
title: '首页',
|
||||
keepAlive: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/dashboard/dashboard'),
|
||||
children: [
|
||||
// {
|
||||
// path: '/dashboard/contact-company',
|
||||
// name: 'ContactCompany',
|
||||
// meta: {
|
||||
// title: '往来单位',
|
||||
// keepAlive: true,
|
||||
// showTabbar: true,
|
||||
// permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
// },
|
||||
// component: () => import('@/views/erp/contact-company/contact-company')
|
||||
// },
|
||||
{
|
||||
path: '/dashboard/user',
|
||||
name: 'Mine',
|
||||
meta: {
|
||||
title: '我的',
|
||||
keepAlive: false,
|
||||
showTabbar: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/user/index')
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
21
smart-admin-h5/src/router/develop/develop.js
Normal file
21
smart-admin-h5/src/router/develop/develop.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const developRouter = [
|
||||
{
|
||||
path: '/develop',
|
||||
component: () => import('@/views/dashboard/dashboard'),
|
||||
children: [
|
||||
{
|
||||
path: '/develop/config',
|
||||
name: 'DevelopConfig',
|
||||
meta: {
|
||||
title: '开发专用配置',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('views/develop/config')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 错误页
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const error = [
|
||||
export const errorRouter = [
|
||||
{
|
||||
path: '/404',
|
||||
name: 'Error404',
|
||||
@@ -10,7 +10,7 @@ export const error = [
|
||||
access: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
|
||||
},
|
||||
component: () => import('@/views/error/404.vue')
|
||||
component: () => import('views/error/404.vue')
|
||||
},
|
||||
{
|
||||
path: '/500',
|
||||
@@ -21,17 +21,6 @@ export const error = [
|
||||
noValidatePrivilege: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
|
||||
},
|
||||
component: () => import('@/views/error/404.vue')
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
name: 'http://localhost:8080/#employee/role-employee-manage',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true,
|
||||
noValidatePrivilege: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
|
||||
},
|
||||
component: () => import('@/views/error/404.vue')
|
||||
component: () => import('views/error/404.vue')
|
||||
}
|
||||
];
|
||||
@@ -10,6 +10,10 @@ const projectConfig = require('@/config/index.js');
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
/**
|
||||
* 导入所有的router
|
||||
* @type {VueRouter}
|
||||
*/
|
||||
const router = new Router({
|
||||
routes: routers
|
||||
});
|
||||
@@ -27,6 +31,8 @@ Router.prototype.push = function(location) {
|
||||
|
||||
const LOGIN_PAGE_NAME = 'Login';
|
||||
|
||||
// --------------------- router 守卫 begin ---------------------
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
// 加载进度条
|
||||
NProgress.start();
|
||||
@@ -77,6 +83,19 @@ router.afterEach(to => {
|
||||
}
|
||||
});
|
||||
|
||||
// --------------------- router 守卫 end ---------------------
|
||||
|
||||
/**
|
||||
* router 检测
|
||||
*
|
||||
* 如果存在相同的 path 或者 name 是一件非常恐怖的事情,所以在develop环境将所有router进行一次遍历<br>
|
||||
* 检测内容如下:<br>
|
||||
* 1、相同的router name
|
||||
* 2、相同的router name
|
||||
* 3、path没有以 / 开头
|
||||
*
|
||||
*/
|
||||
|
||||
const tempCheckObj = {
|
||||
checkRouterNameMap: new Map(),
|
||||
checkRouterPathMap: new Map()
|
||||
|
||||
15
smart-admin-h5/src/router/login/login.js
Normal file
15
smart-admin-h5/src/router/login/login.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const loginRouter = [
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
meta: {
|
||||
title: '登录',
|
||||
keepAlive: false,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
|
||||
},
|
||||
component: () => import('@/views/login/login.vue')
|
||||
}
|
||||
|
||||
];
|
||||
@@ -1,15 +0,0 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const develop = [
|
||||
{
|
||||
path: '/develop/config',
|
||||
name: 'DevelopConfig',
|
||||
meta: {
|
||||
title: '开发专用配置',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () =>
|
||||
import('@/views/develop/config')
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* 其他路由
|
||||
*/
|
||||
|
||||
import { user } from './user';
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
import { develop } from '@/router/other/develop';
|
||||
import { school } from '@/router/other/school';
|
||||
import { contactCompany } from '@/router/other/erp/contact-company';
|
||||
|
||||
export const otherRouter = [
|
||||
{
|
||||
path: '/other-main',
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
|
||||
},
|
||||
component: () => import('views/main/other-main'),
|
||||
children: [
|
||||
...user,
|
||||
...develop,
|
||||
...school,
|
||||
...contactCompany
|
||||
]
|
||||
}];
|
||||
@@ -1,41 +0,0 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const school = [
|
||||
{
|
||||
path: '/school/detail',
|
||||
name: 'SchoolDetail',
|
||||
meta: {
|
||||
title: '学校详情',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/crm/school/school-detail')
|
||||
},
|
||||
{
|
||||
path: '/school/track/add',
|
||||
name: 'SchoolTrackAdd',
|
||||
meta: {
|
||||
title: '学校拜访记录添加',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/crm/school/add-track')
|
||||
},
|
||||
{
|
||||
path: '/school/track/detail',
|
||||
name: 'SchoolTrackDetail',
|
||||
meta: {
|
||||
title: '学校拜访记录详情',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/crm/school/track-detail')
|
||||
},
|
||||
{
|
||||
path: '/school/update',
|
||||
name: 'SchoolUpdate',
|
||||
meta: {
|
||||
title: '更新学校',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/crm/school/update-school')
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const user = [
|
||||
{
|
||||
path: '/user/change-password',
|
||||
name: 'UserChangePassword',
|
||||
meta: {
|
||||
title: '修改密码',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () =>
|
||||
import('@/views/mine/change-password')
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
import { tabbarRouter } from './tabbar';
|
||||
import { otherRouter } from '@/router/other';
|
||||
import { error } from './other/error';
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
// 全局错误页面
|
||||
import { errorRouter } from './error/error';
|
||||
// 登录注册模块
|
||||
import { loginRouter } from './login/login';
|
||||
// tabbar dashboard 框架页面
|
||||
import { dashboardRouter } from './dashboard';
|
||||
// 用户相关
|
||||
import { userRouter } from './user/user';
|
||||
// 开发相关
|
||||
import { developRouter } from './develop/develop';
|
||||
|
||||
// 登录模块
|
||||
export const login = {
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
meta: {
|
||||
title: '登录',
|
||||
keepAlive: false,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NO_VALID.value
|
||||
},
|
||||
component: () => import('@/views/login/login.vue')
|
||||
};
|
||||
|
||||
// 全部路由
|
||||
/**
|
||||
* router meta 说明: <br>
|
||||
*
|
||||
* title: 为页面的title,会显示到浏览器的title上
|
||||
* permissionType: 具体使用 router-const.js中的 ROUTER_PERMISSION_TYPE 常量;情况有: 1)不验证 2)校验登录 3)登录后校验权限
|
||||
* keepAlive: true or false ; 是否进行页面keepalive, 如果想删除keepalive,可以使用vuex中的app module里有mutation
|
||||
* showTabbar: true or false ; 是否展示 tabbar, 如果是true, 则会展示tabbar
|
||||
*
|
||||
*/
|
||||
export const routers = [
|
||||
login,
|
||||
...tabbarRouter,
|
||||
...otherRouter,
|
||||
...error
|
||||
// 登录、注册
|
||||
...loginRouter,
|
||||
// 404、500、403等
|
||||
...errorRouter,
|
||||
// tab bar 页面
|
||||
...dashboardRouter,
|
||||
// 用户
|
||||
...userRouter,
|
||||
// 开发相关
|
||||
...developRouter
|
||||
];
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '../router-const';
|
||||
|
||||
/**
|
||||
* 主要用于 tabbar 的路由
|
||||
*/
|
||||
export const tabbarRouter = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/contact-company',
|
||||
meta: {
|
||||
title: '首页',
|
||||
keepAlive: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('views/main/tabbar-main'),
|
||||
children: [
|
||||
{
|
||||
path: '/home',
|
||||
name: 'Home',
|
||||
meta: {
|
||||
title: '首页',
|
||||
keepAlive: true,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/home/index')
|
||||
},
|
||||
{
|
||||
path: '/business',
|
||||
name: 'Business',
|
||||
meta: {
|
||||
title: '业务中心',
|
||||
keepAlive: false,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/business/index')
|
||||
},
|
||||
{
|
||||
path: '/mine',
|
||||
name: 'Mine',
|
||||
meta: {
|
||||
title: '关于我',
|
||||
keepAlive: false,
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () => import('@/views/mine/index')
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
21
smart-admin-h5/src/router/user/user.js
Normal file
21
smart-admin-h5/src/router/user/user.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ROUTER_PERMISSION_TYPE } from '@/router/router-const';
|
||||
|
||||
export const userRouter = [
|
||||
{
|
||||
path: '/user',
|
||||
component: () => import('@/views/dashboard/dashboard'),
|
||||
children: [
|
||||
{
|
||||
path: '/user/change-password',
|
||||
name: 'UserChangePassword',
|
||||
meta: {
|
||||
title: '修改密码',
|
||||
permissionType: ROUTER_PERMISSION_TYPE.NEED_LOGIN.value
|
||||
},
|
||||
component: () =>
|
||||
import('views/user/change-password')
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -2,6 +2,7 @@ import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
|
||||
import user from './module/user';
|
||||
import app from './module/app';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
@@ -16,6 +17,7 @@ export default new Vuex.Store({
|
||||
//
|
||||
},
|
||||
modules: {
|
||||
app,
|
||||
user
|
||||
}
|
||||
});
|
||||
|
||||
32
smart-admin-h5/src/store/module/app.js
Normal file
32
smart-admin-h5/src/store/module/app.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 整个应用相关的状态信息
|
||||
*
|
||||
* 比如: keepalive等
|
||||
*/
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
// 缓存路由
|
||||
keepAliveIncludes: []
|
||||
},
|
||||
|
||||
mutations: {
|
||||
// 加入keep-alive缓存
|
||||
pushKeepAliveIncludes(state, val) {
|
||||
if (state.keepAliveIncludes.length < 30) {
|
||||
const number = state.keepAliveIncludes.findIndex(e => e === val);
|
||||
if (number === -1) {
|
||||
state.keepAliveIncludes.push(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 删除缓存
|
||||
deleteKeepAliveIncludes(state, val) {
|
||||
const number = state.keepAliveIncludes.findIndex(e => e === val);
|
||||
if (number !== -1) {
|
||||
state.keepAliveIncludes.splice(number, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
@text-color: #323233;
|
||||
@border-color: #ebedf0;
|
||||
@active-color: #f2f3f5;
|
||||
@background-color: #f7f8fa;
|
||||
@background-color-light: #fafafa;
|
||||
6
smart-admin-h5/src/themes/index.scss
Normal file
6
smart-admin-h5/src/themes/index.scss
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
html,
|
||||
body {
|
||||
font-family: Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
|
||||
background-color: $background-color;
|
||||
}
|
||||
110
smart-admin-h5/src/utils/index.js
Normal file
110
smart-admin-h5/src/utils/index.js
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* Created by PanJiaChen on 16/11/18.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse the time to string
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string}
|
||||
*/
|
||||
export function parseTime(time, cFormat) {
|
||||
if (arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} time
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatTime(time, option) {
|
||||
if (('' + time).length === 10) {
|
||||
time = parseInt(time) * 1000
|
||||
} else {
|
||||
time = +time
|
||||
}
|
||||
const d = new Date(time)
|
||||
const now = Date.now()
|
||||
|
||||
const diff = (now - d) / 1000
|
||||
|
||||
if (diff < 30) {
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
// less 1 hour
|
||||
return Math.ceil(diff / 60) + '分钟前'
|
||||
} else if (diff < 3600 * 24) {
|
||||
return Math.ceil(diff / 3600) + '小时前'
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return '1天前'
|
||||
}
|
||||
if (option) {
|
||||
return parseTime(time, option)
|
||||
} else {
|
||||
return (
|
||||
d.getMonth() +
|
||||
1 +
|
||||
'月' +
|
||||
d.getDate() +
|
||||
'日' +
|
||||
d.getHours() +
|
||||
'时' +
|
||||
d.getMinutes() +
|
||||
'分'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function param2Obj(url) {
|
||||
const search = url.split('?')[1]
|
||||
if (!search) {
|
||||
return {}
|
||||
}
|
||||
return JSON.parse(
|
||||
'{"' +
|
||||
decodeURIComponent(search)
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/&/g, '","')
|
||||
.replace(/=/g, '":"')
|
||||
.replace(/\+/g, ' ') +
|
||||
'"}'
|
||||
)
|
||||
}
|
||||
58
smart-admin-h5/src/utils/request.js
Normal file
58
smart-admin-h5/src/utils/request.js
Normal file
@@ -0,0 +1,58 @@
|
||||
import axios from 'axios'
|
||||
import store from '@/store'
|
||||
import { Toast } from 'vant'
|
||||
// 根据环境不同引入不同api地址
|
||||
import { baseApi } from '@/config'
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
baseURL: baseApi, // url = base api url + request url
|
||||
withCredentials: true, // send cookies when cross-domain requests
|
||||
timeout: 5000 // request timeout
|
||||
})
|
||||
|
||||
// request拦截器 request interceptor
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// 不传递默认开启loading
|
||||
if (!config.hideloading) {
|
||||
// loading
|
||||
Toast.loading({
|
||||
forbidClick: true
|
||||
})
|
||||
}
|
||||
if (store.getters.token) {
|
||||
config.headers['X-Token'] = ''
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
// do something with request error
|
||||
console.log(error) // for debug
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
// respone拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
Toast.clear()
|
||||
const res = response.data
|
||||
if (res.status && res.status !== 200) {
|
||||
// 登录超时,重新登录
|
||||
if (res.status === 401) {
|
||||
store.dispatch('FedLogOut').then(() => {
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
return Promise.reject(res || 'error')
|
||||
} else {
|
||||
return Promise.resolve(res)
|
||||
}
|
||||
},
|
||||
error => {
|
||||
Toast.clear()
|
||||
console.log('err' + error) // for debug
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export default service
|
||||
20
smart-admin-h5/src/utils/validate.js
Normal file
20
smart-admin-h5/src/utils/validate.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Created by Sunnie on 19/06/04.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function isExternal(path) {
|
||||
return /^(https?:|mailto:|tel:)/.test(path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function validUsername(str) {
|
||||
const valid_map = ['admin', 'editor']
|
||||
return valid_map.indexOf(str.trim()) >= 0
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
<!-- home -->
|
||||
<template>
|
||||
<div>
|
||||
<van-nav-bar title="审批中心">
|
||||
<template #right>
|
||||
<van-icon name="search" size="18" style="margin-right: 20px" />
|
||||
<van-icon name="filter-o" size="18" />
|
||||
</template>
|
||||
</van-nav-bar>
|
||||
|
||||
<van-tabs v-model="bpmStatusActive" sticky>
|
||||
<van-tab title="标签 1">
|
||||
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
||||
<van-list
|
||||
v-model="loading"
|
||||
:finished="finished"
|
||||
finished-text="没有更多了"
|
||||
@load="onLoad"
|
||||
>
|
||||
|
||||
<van-cell title="单元格" value="内容" size="large" label="描述信息" />
|
||||
<van-cell title="单元格" value="内容" size="large" label="描述信息" />
|
||||
<van-cell title="单元格" value="内容" size="large" label="描述信息" />
|
||||
<van-cell title="单元格" value="内容" size="large" label="描述信息" />
|
||||
|
||||
</van-list>
|
||||
</van-pull-refresh>
|
||||
</van-tab>
|
||||
<van-tab title="标签 2">内容 2</van-tab>
|
||||
<van-tab title="标签 3">内容 3</van-tab>
|
||||
<van-tab title="标签 4">内容 4</van-tab>
|
||||
</van-tabs>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: ['asdasd', 'asdasd', 'asdasd'],
|
||||
bpmStatusActive: 0,
|
||||
finished: true,
|
||||
refreshing: true,
|
||||
loading: true
|
||||
};
|
||||
},
|
||||
|
||||
computed: {},
|
||||
|
||||
mounted() {
|
||||
},
|
||||
|
||||
methods: {
|
||||
onRefresh() {
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
this.finished = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.index-container {
|
||||
.warpper {
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
|
||||
.demo-home__title {
|
||||
margin: 0 0 6px;
|
||||
font-size: 32px;
|
||||
|
||||
.demo-home__title img,
|
||||
.demo-home__title span {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
span {
|
||||
margin-left: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-home__desc {
|
||||
margin: 0 0 20px;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,66 +0,0 @@
|
||||
<!-- home -->
|
||||
<template>
|
||||
<div class="index-container">
|
||||
<div class="warpper">
|
||||
<h2 class="demo-home__desc">
|
||||
业务
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Cell } from 'vant';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
[Cell.name]: Cell
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: []
|
||||
};
|
||||
},
|
||||
|
||||
computed: {},
|
||||
|
||||
mounted() {
|
||||
},
|
||||
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.index-container {
|
||||
.warpper {
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
|
||||
.demo-home__title {
|
||||
margin: 0 0 6px;
|
||||
font-size: 32px;
|
||||
|
||||
.demo-home__title img,
|
||||
.demo-home__title span {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
span {
|
||||
margin-left: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-home__desc {
|
||||
margin: 0 0 20px;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
99
smart-admin-h5/src/views/dashboard/dashboard.vue
Normal file
99
smart-admin-h5/src/views/dashboard/dashboard.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<!---------------- 页面内容 begin ---------------->
|
||||
<div class="main-content">
|
||||
<keep-alive :include="keepAliveIncludes">
|
||||
<router-view/>
|
||||
</keep-alive>
|
||||
</div>
|
||||
<!---------------- 页面内容 end ---------------->
|
||||
|
||||
<!---------------- 底部 tabbar begin ---------------->
|
||||
|
||||
<!---------------- 对于一些需要展示tabbar的页面,则进行展示 ---------------->
|
||||
<div class="main-footer" v-show="$route.meta && $route.meta.showTabbar">
|
||||
<van-tabbar
|
||||
fixed
|
||||
route
|
||||
v-model="active"
|
||||
>
|
||||
<van-tabbar-item
|
||||
v-for="(item, index) in tabbar"
|
||||
:to="item.to"
|
||||
:icon="item.icon"
|
||||
:name="item.name"
|
||||
:key="index">
|
||||
{{ item.title }}
|
||||
</van-tabbar-item>
|
||||
</van-tabbar>
|
||||
</div>
|
||||
<!---------------- 底部 tabbar end ---------------->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script type="text/javascript">
|
||||
import SessionMixin from 'components/mixin/session-mixin';
|
||||
import { mapMutations, mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'DashBoard',
|
||||
mixins: [SessionMixin],
|
||||
data() {
|
||||
return {
|
||||
active: 'Mine',
|
||||
tabbar: [
|
||||
// {
|
||||
// name: 'ContactCompany',
|
||||
// title: '首页',
|
||||
// icon: 'user-o',
|
||||
// badge: 0,
|
||||
// to: '/contact-company'
|
||||
// },
|
||||
{
|
||||
name: 'Mine',
|
||||
title: '我的',
|
||||
icon: 'user-o',
|
||||
to: '/user'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
keepAliveIncludes: state => state.app.keepAliveIncludes
|
||||
})
|
||||
},
|
||||
created() {
|
||||
// 通过路由跳转绑定Tabbar的选中
|
||||
this.updateTabbarSelected(this.$route.name);
|
||||
this.checkRouterKeepAlive(this.$route);
|
||||
},
|
||||
watch: {
|
||||
$route(newRoute) {
|
||||
this.checkRouterKeepAlive(newRoute);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('app', [
|
||||
'pushKeepAliveIncludes',
|
||||
'deleteKeepAliveIncludes'
|
||||
]),
|
||||
checkRouterKeepAlive(newRoute) {
|
||||
const { name, meta } = newRoute;
|
||||
if (meta && meta.keepAlive) {
|
||||
this.pushKeepAliveIncludes(name);
|
||||
} else {
|
||||
this.deleteKeepAliveIncludes(name);
|
||||
}
|
||||
},
|
||||
updateTabbarSelected(item) {
|
||||
console.log(item, 12222);
|
||||
this.active = item;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- home -->
|
||||
<template>
|
||||
<div>
|
||||
<router-nav-bar path="/mine" title="开发专用配置" left-text="返回" left-arrow />
|
||||
<router-nav-bar path="/dashboard/user" title="开发专用配置" left-text="返回" left-arrow />
|
||||
|
||||
<van-cell center title="VConsole">
|
||||
<van-switch v-model="vconsoleFlag" @change="switchVConsole" />
|
||||
@@ -13,6 +13,7 @@
|
||||
import RouterNavBar from 'components/van-bar/RouterNavBar';
|
||||
const VCONSOLE_ID = '__vconsole';
|
||||
export default {
|
||||
name: 'DevelopConfig',
|
||||
components: {
|
||||
RouterNavBar
|
||||
},
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<!-- home -->
|
||||
<template>
|
||||
<div>
|
||||
<div style="background-color: #1989fa;height: ">
|
||||
<h4>
|
||||
<center>首页</center>
|
||||
</h4>
|
||||
<van-row gutter="20">
|
||||
<van-col span="12">span: 8</van-col>
|
||||
<van-col span="12">span: 8</van-col>
|
||||
</van-row>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: []
|
||||
};
|
||||
},
|
||||
|
||||
computed: {},
|
||||
|
||||
mounted() {
|
||||
},
|
||||
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.index-container {
|
||||
.warpper {
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
|
||||
.demo-home__title {
|
||||
margin: 0 0 6px;
|
||||
font-size: 32px;
|
||||
|
||||
.demo-home__title img,
|
||||
.demo-home__title span {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
span {
|
||||
margin-left: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-home__desc {
|
||||
margin: 0 0 20px;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -38,26 +38,12 @@ export default {
|
||||
loginName: '',
|
||||
loginPwd: ''
|
||||
},
|
||||
codeUrl: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
// 获取验证码
|
||||
async getVerificationCode() {
|
||||
try {
|
||||
const res = await loginApi.getVerificationCode();
|
||||
const data = res.data;
|
||||
this.formData.codeUuid = data.uuid;
|
||||
this.codeUrl = data.code;
|
||||
this.formData.code = '';
|
||||
console.log(this.codeUrl);
|
||||
} catch (e) {
|
||||
this.$smartSentry.captureException(e);
|
||||
}
|
||||
},
|
||||
// 提交表单
|
||||
// 提交登录表单
|
||||
async onSubmit() {
|
||||
this.$smart.loading();
|
||||
try {
|
||||
@@ -66,9 +52,9 @@ export default {
|
||||
this.$store.commit('user/updateSession', loginInfo);
|
||||
cookie.setToken(loginInfo.xaccessToken);
|
||||
this.$toast.success('登录成功');
|
||||
this.$router.replace('/bpm');
|
||||
this.$router.replace('/dashboard/user');
|
||||
// this.$router.replace('/contact-company');
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
this.$smartSentry.captureException(e);
|
||||
await this.getVerificationCode();
|
||||
} finally {
|
||||
@@ -78,3 +64,5 @@ export default {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<!---------------- 頁面内容 begin ---------------->
|
||||
<div class="main-content">
|
||||
<keep-alive>
|
||||
<router-view v-if="$route.meta.keepAlive" />
|
||||
</keep-alive>
|
||||
<router-view v-if="!$route.meta.keepAlive" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script type="text/javascript">
|
||||
import mainMixin from './main-mixin';
|
||||
|
||||
export default {
|
||||
name: 'OtherMain',
|
||||
mixins: [mainMixin],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created() {
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
@@ -1,96 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<!---------------- 頁面内容 begin ---------------->
|
||||
<div class="main-content">
|
||||
<keep-alive>
|
||||
<router-view v-if="$route.meta.keepAlive" />
|
||||
</keep-alive>
|
||||
<router-view v-if="!$route.meta.keepAlive" />
|
||||
</div>
|
||||
<!---------------- 頁面内容 end ---------------->
|
||||
|
||||
<!---------------- 底部 tabbar begin ---------------->
|
||||
<div class="main-footer">
|
||||
<van-tabbar
|
||||
fixed
|
||||
route
|
||||
v-model="active"
|
||||
>
|
||||
<van-tabbar-item
|
||||
v-for="(item, index) in tabbar"
|
||||
:to="item.to"
|
||||
:icon="item.icon"
|
||||
:name="item.name"
|
||||
:key="index">
|
||||
{{ item.title }}
|
||||
</van-tabbar-item>
|
||||
</van-tabbar>
|
||||
</div>
|
||||
<!---------------- 底部 tabbar end ---------------->
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script type="text/javascript">
|
||||
import mainMixin from 'views/main/main-mixin';
|
||||
|
||||
export default {
|
||||
name: 'TabbarMain',
|
||||
mixins: [mainMixin],
|
||||
data() {
|
||||
return {
|
||||
active: 'ContactCompany',
|
||||
tabbar: [
|
||||
// {
|
||||
// name: 'Home',
|
||||
// title: '首页',
|
||||
// icon: 'wap-home-o',
|
||||
// to: '/home'
|
||||
// },
|
||||
// {
|
||||
// name: 'Business',
|
||||
// title: '业务中心',
|
||||
// icon: 'apps-o',
|
||||
// to: '/business'
|
||||
// },
|
||||
{
|
||||
name: 'ContactCompany',
|
||||
title: '往来机构',
|
||||
icon: 'user-o',
|
||||
badge: 0,
|
||||
to: '/contact-company'
|
||||
},
|
||||
{
|
||||
name: 'Mine',
|
||||
title: '我的',
|
||||
icon: 'user-o',
|
||||
to: '/mine'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// 通过路由跳转绑定Tabbar的选中
|
||||
this.updateTabbarSelected(this.$route.name);
|
||||
},
|
||||
watch: {
|
||||
// 监听路由变化,保证路由跳转Tabbar选中正常
|
||||
$route: {
|
||||
handler(val, oldval) {
|
||||
// this.updateTabbarSelected(val.name)
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
updateTabbarSelected(item) {
|
||||
console.log(item, 12222);
|
||||
this.active = item;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- home -->
|
||||
<template>
|
||||
<div>
|
||||
<router-nav-bar path="/mine" title="修改密码" left-text="返回" left-arrow />
|
||||
<router-nav-bar path="/dashboard/user" title="修改密码" left-text="返回" left-arrow />
|
||||
|
||||
<van-form @submit="onSubmit">
|
||||
<van-field
|
||||
@@ -22,6 +22,7 @@
|
||||
<van-field
|
||||
style="width: 60%;float:left"
|
||||
v-model="formData.code"
|
||||
type="password"
|
||||
name="新密码"
|
||||
label="新密码"
|
||||
placeholder="新密码"
|
||||
@@ -37,8 +38,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loginApi } from '@/api/login';
|
||||
import cookie from '@/lib/cookie';
|
||||
import RouterNavBar from 'components/van-bar/RouterNavBar';
|
||||
|
||||
export default {
|
||||
@@ -57,36 +56,17 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getVerificationCode();
|
||||
},
|
||||
methods: {
|
||||
// 获取验证码
|
||||
async getVerificationCode() {
|
||||
try {
|
||||
const res = await loginApi.getVerificationCode();
|
||||
const data = res.data;
|
||||
this.formData.codeUuid = data.uuid;
|
||||
this.codeUrl = data.code;
|
||||
this.formData.code = '';
|
||||
console.log(this.codeUrl);
|
||||
} catch (e) {
|
||||
this.$smartSentry.captureException(e);
|
||||
}
|
||||
},
|
||||
// 提交表单
|
||||
async onSubmit() {
|
||||
onSubmit() {
|
||||
this.$smart.loading();
|
||||
try {
|
||||
const res = await loginApi.login(this.formData);
|
||||
const loginInfo = res.data;
|
||||
this.$store.commit('user/updateSession', loginInfo);
|
||||
cookie.setToken(loginInfo.xaccessToken);
|
||||
this.$toast.success('登录成功');
|
||||
this.$router.replace('/home');
|
||||
this.$toast.success('暂未实现');
|
||||
this.$router.replace('/dashboard/user');
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
this.$smartSentry.captureException(e);
|
||||
await this.getVerificationCode();
|
||||
} finally {
|
||||
this.$smart.loadingClear();
|
||||
}
|
||||
@@ -8,10 +8,9 @@
|
||||
</van-grid>
|
||||
|
||||
<van-cell-group>
|
||||
<!-- <van-cell icon="user-o" title="订单" is-link />-->
|
||||
<!-- <van-cell icon="location-o" title="设置" is-link />-->
|
||||
<!-- <van-cell icon="location-o" to="/user/change-password" title="修改密码" is-link />-->
|
||||
<van-cell icon="bulb-o" title="更新权限" @click="updatePrivilege" is-link/>
|
||||
<van-cell icon="location-o" to="/user/change-password" title="修改密码" is-link />
|
||||
<van-cell icon="bulb-o" title="更新权限" @click="forceUpdatePrivilege" is-link/>
|
||||
<van-cell icon="delete" title="清空缓存" @click="clearCache" is-link/>
|
||||
<van-cell icon="apps-o" title="开发专用" is-link to="/develop/config"/>
|
||||
</van-cell-group>
|
||||
|
||||
@@ -30,6 +29,7 @@ import cookie from '@/lib/cookie';
|
||||
import { userApi } from 'api/user';
|
||||
|
||||
export default {
|
||||
name: 'Mine',
|
||||
data() {
|
||||
return {
|
||||
actualName: null
|
||||
@@ -43,7 +43,12 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async updatePrivilege() {
|
||||
// 清空缓存
|
||||
clearCache() {
|
||||
this.$toast('清空了!!');
|
||||
},
|
||||
// 更新权限
|
||||
async forceUpdatePrivilege() {
|
||||
this.$smart.loading();
|
||||
try {
|
||||
const res = await userApi.getSession();
|
||||
@@ -56,6 +61,7 @@ export default {
|
||||
this.$smart.loadingClear();
|
||||
}
|
||||
},
|
||||
// 退出
|
||||
async logout() {
|
||||
this.$smart.loading();
|
||||
try {
|
||||
@@ -51,10 +51,18 @@ module.exports = {
|
||||
// }
|
||||
},
|
||||
css: {
|
||||
// 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
|
||||
// 是否使用css分离插件 ExtractTextPlugin 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
|
||||
extract: isProductionEnv,
|
||||
// 开启 CSS source maps
|
||||
sourceMap: false,
|
||||
modules: false
|
||||
// 使用vw布局去掉这个
|
||||
requireModuleExtension: true,
|
||||
loaderOptions: {
|
||||
// 引入全局变量
|
||||
scss: {
|
||||
additionalData: `@import "@/assets/css/index";` // 全局引入
|
||||
}
|
||||
}
|
||||
},
|
||||
configureWebpack: config => {
|
||||
config.name = projectConfig.title;
|
||||
|
||||
@@ -11,3 +11,5 @@ sa/123456
|
||||
LoginService.getSession
|
||||
|
||||
5 test类中去掉代码生成run
|
||||
|
||||
6 前端百度统计
|
||||
@@ -85,6 +85,10 @@ public class ResponseDTO<T> {
|
||||
return new ResponseDTO<T>(codeConst, msg);
|
||||
}
|
||||
|
||||
public static <T> ResponseDTO<T> wrapMsg(ResponseCodeConst codeConst, String msg) {
|
||||
return new ResponseDTO<T>(codeConst, msg);
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import net.lab1024.smartadmin.common.domain.BaseEnum;
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 枚举类校验器
|
||||
@@ -15,9 +17,9 @@ import java.util.List;
|
||||
public class EnumValidator implements ConstraintValidator<CheckEnum, Object> {
|
||||
|
||||
/**
|
||||
* 枚举类的类对象
|
||||
* 枚举类实例集合
|
||||
*/
|
||||
private Class<? extends BaseEnum> enumClass;
|
||||
private List<Object> enumValList;
|
||||
|
||||
/**
|
||||
* 是否必须
|
||||
@@ -27,8 +29,9 @@ public class EnumValidator implements ConstraintValidator<CheckEnum, Object> {
|
||||
@Override
|
||||
public void initialize(CheckEnum constraintAnnotation) {
|
||||
// 获取注解传入的枚举类对象
|
||||
enumClass = constraintAnnotation.enumClazz();
|
||||
required = constraintAnnotation.required();
|
||||
Class<? extends BaseEnum> enumClass = constraintAnnotation.enumClazz();
|
||||
enumValList = Stream.of(enumClass.getEnumConstants()).map(BaseEnum::getValue).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,7 +47,7 @@ public class EnumValidator implements ConstraintValidator<CheckEnum, Object> {
|
||||
}
|
||||
|
||||
// 校验是否为合法的枚举值
|
||||
return this.hasEnum(value);
|
||||
return enumValList.contains(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,23 +61,11 @@ public class EnumValidator implements ConstraintValidator<CheckEnum, Object> {
|
||||
// 必须的情况下 list 不能为空
|
||||
return false;
|
||||
}
|
||||
for (Object obj : list) {
|
||||
boolean hasEnum = this.hasEnum(obj);
|
||||
if (!hasEnum) {
|
||||
return false;
|
||||
}
|
||||
// 校验是否重复
|
||||
long count = list.stream().distinct().count();
|
||||
if (count != list.size()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean hasEnum(Object value) {
|
||||
// 校验是否为合法的枚举值
|
||||
BaseEnum[] enums = enumClass.getEnumConstants();
|
||||
for (BaseEnum baseEnum : enums) {
|
||||
if (baseEnum.getValue().equals(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return enumValList.containsAll(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.lab1024.smartadmin.config;
|
||||
|
||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
@@ -9,6 +8,8 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
||||
import net.lab1024.smartadmin.interceptor.SmartAuthenticationInterceptor;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
@@ -23,8 +24,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.RequestHandler;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
@@ -89,9 +92,9 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
|
||||
private String groupName = "default";
|
||||
|
||||
private List<String> groupList = Lists.newArrayList();
|
||||
private final List<String> groupList = Lists.newArrayList();
|
||||
|
||||
private Map<String, List<String>> groupMap = Maps.newHashMap();
|
||||
private final Map<String, List<String>> groupMap = Maps.newHashMap();
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
@@ -108,7 +111,7 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
this.groupBuild();
|
||||
for (Map.Entry<String, List<String>> entry : groupMap.entrySet()) {
|
||||
String group = entry.getKey();
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(Docket.class, this :: baseDocket);
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(Docket.class, this::baseDocket);
|
||||
BeanDefinition beanDefinition = builder.getRawBeanDefinition();
|
||||
registry.registerBeanDefinition(group + "Api", beanDefinition);
|
||||
}
|
||||
@@ -137,6 +140,16 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
}
|
||||
|
||||
private Docket baseDocket() {
|
||||
// 配置全局参数 token
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
Parameter parameter = tokenPar.name(SmartAuthenticationInterceptor.TOKEN_NAME)
|
||||
.description("token")
|
||||
.modelRef(new ModelRef("string"))
|
||||
.parameterType("header")
|
||||
.defaultValue("")
|
||||
.required(false)
|
||||
.build();
|
||||
|
||||
// 请求类型过滤规则
|
||||
Predicate<RequestHandler> controllerPredicate = getControllerPredicate();
|
||||
// controller 包路径
|
||||
@@ -151,17 +164,18 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
.build()
|
||||
.apiInfo(this.serviceApiInfo())
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts());
|
||||
.securityContexts(securityContexts())
|
||||
.globalOperationParameters(Lists.newArrayList(parameter));
|
||||
}
|
||||
|
||||
private List<ApiKey> securitySchemes() {
|
||||
List<ApiKey> apiKeyList= new ArrayList<>();
|
||||
List<ApiKey> apiKeyList = new ArrayList<>();
|
||||
apiKeyList.add(new ApiKey("x-access-token", "x-access-token", "header"));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
private List<SecurityContext> securityContexts() {
|
||||
List<SecurityContext> securityContexts=new ArrayList<>();
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
@@ -174,7 +188,7 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences=new ArrayList<>();
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("x-access-token", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
@@ -196,9 +210,9 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
};
|
||||
groupIndex++;
|
||||
return Predicates.or(
|
||||
Predicates.and(RequestHandlerSelectors.withClassAnnotation(RestController.class),methodPredicate),
|
||||
Predicates.and(RequestHandlerSelectors.withClassAnnotation(RestController.class), methodPredicate),
|
||||
Predicates.and(
|
||||
RequestHandlerSelectors.withMethodAnnotation(ResponseBody.class),methodPredicate)
|
||||
RequestHandlerSelectors.withMethodAnnotation(ResponseBody.class), methodPredicate)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -219,6 +233,4 @@ public class SmartSwaggerDynamicGroupConfig implements EnvironmentAware, BeanDef
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
@Component
|
||||
public class SmartAuthenticationInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
private static final String TOKEN_NAME = "x-access-token";
|
||||
public static final String TOKEN_NAME = "x-access-token";
|
||||
|
||||
@Value("${access-control-allow-origin}")
|
||||
private String accessControlAllowOrigin;
|
||||
|
||||
@@ -59,15 +59,15 @@ public class DepartmentController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除部门", notes = "删除部门")
|
||||
@PostMapping("/department/delete/{departmentId}")
|
||||
public ResponseDTO<String> delDepartment(@PathVariable("departmentId") Long departmentId) {
|
||||
return departmentService.delDepartment(departmentId);
|
||||
@PostMapping("/department/delete/{deptId}")
|
||||
public ResponseDTO<String> delDepartment(@PathVariable Long deptId) {
|
||||
return departmentService.delDepartment(deptId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取部门信息", notes = "获取部门")
|
||||
@GetMapping("/department/query/{departmentId}")
|
||||
public ResponseDTO<DepartmentVO> getDepartment(@PathVariable("departmentId") Long departmentId) {
|
||||
return departmentService.getDepartmentById(departmentId);
|
||||
@GetMapping("/department/query/{deptId}")
|
||||
public ResponseDTO<DepartmentVO> getDepartment(@PathVariable Long deptId) {
|
||||
return departmentService.getDepartmentById(deptId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询部门列表", notes = "查询部门列表")
|
||||
@@ -78,21 +78,21 @@ public class DepartmentController {
|
||||
|
||||
|
||||
@ApiOperation(value = "上下移动")
|
||||
@GetMapping("/department/upOrDown/{departmentId}/{swapId}")
|
||||
public ResponseDTO<String> upOrDown(@PathVariable("departmentId") Long departmentId,@PathVariable("swapId") Long swapId) {
|
||||
return departmentService.upOrDown(departmentId,swapId);
|
||||
@GetMapping("/department/upOrDown/{deptId}/{swapId}")
|
||||
public ResponseDTO<String> upOrDown(@PathVariable Long deptId, @PathVariable Long swapId) {
|
||||
return departmentService.upOrDown(deptId, swapId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "升级")
|
||||
@GetMapping("/department/upgrade/{departmentId}")
|
||||
public ResponseDTO<String> upgrade(@PathVariable("departmentId") Long departmentId) {
|
||||
return departmentService.upgrade(departmentId);
|
||||
@GetMapping("/department/upgrade/{deptId}")
|
||||
public ResponseDTO<String> upgrade(@PathVariable Long deptId) {
|
||||
return departmentService.upgrade(deptId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "降级")
|
||||
@GetMapping("/department/downgrade/{departmentId}/{preId}")
|
||||
public ResponseDTO<String> downgrade(@PathVariable("departmentId") Long departmentId,@PathVariable("preId") Long preId) {
|
||||
return departmentService.downgrade(departmentId,preId);
|
||||
@GetMapping("/department/downgrade/{deptId}/{preId}")
|
||||
public ResponseDTO<String> downgrade(@PathVariable Long deptId, @PathVariable Long preId) {
|
||||
return departmentService.downgrade(deptId, preId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,14 +19,13 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DepartmentDao extends BaseMapper<DepartmentEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id,查询此部门子部门的数量
|
||||
* 根据部门id,查询此部门直接子部门的数量
|
||||
*
|
||||
* @param departmentId
|
||||
* @param deptId
|
||||
* @return int 子部门的数量
|
||||
*/
|
||||
Integer countSubDepartment(@Param("departmentId") Long departmentId);
|
||||
Integer countSubDepartment(@Param("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 获取全部部门列表
|
||||
|
||||
@@ -14,7 +14,7 @@ public class DepartmentResponseCodeConst extends ResponseCodeConst {
|
||||
/**
|
||||
* 部门不存在 1001
|
||||
*/
|
||||
public static final DepartmentResponseCodeConst DEPT_NOT_EXISTS = new DepartmentResponseCodeConst(2001, "部门不存在!");
|
||||
public static final DepartmentResponseCodeConst DEPT_NOT_EXISTS = new DepartmentResponseCodeConst(2001, "部门不存在");
|
||||
|
||||
/**
|
||||
* 当前部门有子级部门 不能删除 10003
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DepartmentService {
|
||||
departmentVOList = filterDepartment(departmentVOList, departmentName);
|
||||
}
|
||||
|
||||
Map<Long, DepartmentVO> departmentMap = departmentVOList.stream().collect(Collectors.toMap(DepartmentVO :: getId, Function.identity()));
|
||||
Map<Long, DepartmentVO> departmentMap = departmentVOList.stream().collect(Collectors.toMap(DepartmentVO::getId, Function.identity()));
|
||||
// 获取全部员工列表
|
||||
List<EmployeeDTO> employeeList = employeeDao.listAll();
|
||||
employeeList.forEach(employeeDTO -> {
|
||||
@@ -103,7 +103,7 @@ public class DepartmentService {
|
||||
List<DepartmentVO> filterResult = new ArrayList<>();
|
||||
getParentDepartment(departmentVOList, parentId, filterResult);
|
||||
for (DepartmentVO dto : filterResult) {
|
||||
if (! departmentMap.containsKey(dto.getId())) {
|
||||
if (!departmentMap.containsKey(dto.getId())) {
|
||||
departmentMap.put(dto.getId(), dto);
|
||||
}
|
||||
}
|
||||
@@ -165,23 +165,27 @@ public class DepartmentService {
|
||||
* 1、需要判断当前部门是否有子部门,有子部门则不允许删除
|
||||
* 2、需要判断当前部门是否有员工,有员工则不能删除
|
||||
*
|
||||
* @param departmentId
|
||||
* @return AjaxResult<String>
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseDTO<String> delDepartment(Long departmentId) {
|
||||
public ResponseDTO<String> delDepartment(Long deptId) {
|
||||
DepartmentEntity departmentEntity = departmentDao.selectById(deptId);
|
||||
if (null == departmentEntity) {
|
||||
return ResponseDTO.wrap(DepartmentResponseCodeConst.DEPT_NOT_EXISTS);
|
||||
}
|
||||
// 是否有子级部门
|
||||
int subDepartmentNum = departmentDao.countSubDepartment(departmentId);
|
||||
int subDepartmentNum = departmentDao.countSubDepartment(deptId);
|
||||
if (subDepartmentNum > 0) {
|
||||
return ResponseDTO.wrap(DepartmentResponseCodeConst.CANNOT_DEL_DEPARTMENT_WITH_CHILD);
|
||||
}
|
||||
|
||||
// 是否有员工
|
||||
int employeeNum = employeeDao.countByDepartmentId(departmentId);
|
||||
// 是否有未删除员工
|
||||
int employeeNum = employeeDao.countByDepartmentId(deptId, false);
|
||||
if (employeeNum > 0) {
|
||||
return ResponseDTO.wrap(DepartmentResponseCodeConst.CANNOT_DEL_DEPARTMENT_WITH_EMPLOYEE);
|
||||
}
|
||||
departmentDao.deleteById(departmentId);
|
||||
departmentDao.deleteById(deptId);
|
||||
return ResponseDTO.succ();
|
||||
}
|
||||
|
||||
@@ -278,5 +282,4 @@ public class DepartmentService {
|
||||
departmentDao.updateById(departmentEntity);
|
||||
return ResponseDTO.succ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
|
||||
/**
|
||||
* 不带分页查询员工列表
|
||||
*
|
||||
* @param queryDTO
|
||||
* @return
|
||||
*/
|
||||
@@ -84,10 +85,11 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
/**
|
||||
* 获取某个部门员工数
|
||||
*
|
||||
* @param departmentId
|
||||
* @param depId
|
||||
* @param deleteFlag 可以null
|
||||
* @return
|
||||
*/
|
||||
Integer countByDepartmentId(@Param("departmentId") Long departmentId);
|
||||
Integer countByDepartmentId(@Param("depId") Long depId, @Param("deleteFlag") Boolean deleteFlag);
|
||||
|
||||
/**
|
||||
* 获取一批员工
|
||||
@@ -99,6 +101,7 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
|
||||
|
||||
EmployeeDTO getEmployeeById(@Param("id") Long employeeId);
|
||||
|
||||
/**
|
||||
* 获取某个部门的员工
|
||||
*
|
||||
@@ -128,6 +131,7 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
|
||||
/**
|
||||
* 查询所有员工
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<EmployeeVO> selectAll();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.lab1024.smartadmin.module.system.employee;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.lab1024.smartadmin.common.constant.JudgeEnum;
|
||||
import net.lab1024.smartadmin.common.domain.PageResultDTO;
|
||||
import net.lab1024.smartadmin.common.domain.ResponseDTO;
|
||||
@@ -25,14 +26,12 @@ import net.lab1024.smartadmin.util.SmartBeanUtil;
|
||||
import net.lab1024.smartadmin.util.SmartDigestUtil;
|
||||
import net.lab1024.smartadmin.util.SmartPageUtil;
|
||||
import net.lab1024.smartadmin.util.SmartVerificationUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -75,7 +74,7 @@ public class EmployeeService {
|
||||
*/
|
||||
private static final ConcurrentHashMap<Long, EmployeeBO> employeeCache = new ConcurrentHashMap<>();
|
||||
|
||||
public List<EmployeeVO> getAllEmployee(){
|
||||
public List<EmployeeVO> getAllEmployee() {
|
||||
return employeeDao.selectAll();
|
||||
}
|
||||
|
||||
@@ -120,7 +119,7 @@ public class EmployeeService {
|
||||
|
||||
for (EmployeeDTO employeeDTO : employeeList) {
|
||||
List<PositionRelationResultDTO> relationResultDTOList = employeePositionMap.get(employeeDTO.getId());
|
||||
if(relationResultDTOList != null){
|
||||
if (relationResultDTOList != null) {
|
||||
employeeDTO.setPositionRelationList(relationResultDTOList);
|
||||
employeeDTO.setPositionName(relationResultDTOList.stream().map(PositionRelationResultDTO::getPositionName).collect(Collectors.joining(",")));
|
||||
}
|
||||
@@ -156,7 +155,7 @@ public class EmployeeService {
|
||||
return ResponseDTO.wrap(EmployeeResponseCodeConst.LOGIN_NAME_EXISTS);
|
||||
}
|
||||
//同电话员工
|
||||
EmployeeDTO samePhoneEmployee = employeeDao.getByPhone(entity.getLoginName(), EmployeeStatusEnum.NORMAL.getValue());
|
||||
EmployeeDTO samePhoneEmployee = employeeDao.getByPhone(entity.getPhone(), EmployeeStatusEnum.NORMAL.getValue());
|
||||
if (null != samePhoneEmployee) {
|
||||
return ResponseDTO.wrap(EmployeeResponseCodeConst.PHONE_EXISTS);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public class LoginController {
|
||||
return loginService.login(loginForm, request);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/session/get")
|
||||
@ApiOperation(value = "获取session", notes = "获取session")
|
||||
@NoValidPrivilege
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package net.lab1024.smartadmin.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.NumberFormat;
|
||||
@@ -34,12 +35,15 @@ public class SmartBigDecimalUtil {
|
||||
public static BigDecimal add(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.add(num2), PRICE_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.multiply(num2), PRICE_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.subtract(num2), PRICE_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.divide(num2, RoundingMode.HALF_UP), PRICE_DECIMAL_POINT);
|
||||
}
|
||||
@@ -53,12 +57,15 @@ public class SmartBigDecimalUtil {
|
||||
public static BigDecimal add(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.add(num2), SIX_PRICE_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.multiply(num2), SIX_PRICE_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.subtract(num2), SIX_PRICE_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.divide(num2, PRICE_DECIMAL_POINT, RoundingMode.HALF_UP);
|
||||
}
|
||||
@@ -72,12 +79,15 @@ public class SmartBigDecimalUtil {
|
||||
public static BigDecimal add(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.add(num2), WEIGHT_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.multiply(num2), WEIGHT_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.subtract(num2), WEIGHT_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.divide(num2, WEIGHT_DECIMAL_POINT, RoundingMode.HALF_UP);
|
||||
}
|
||||
@@ -176,7 +186,7 @@ public class SmartBigDecimalUtil {
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isLessThan(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) == - 1;
|
||||
return num1.compareTo(num2) == -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +237,7 @@ public class SmartBigDecimalUtil {
|
||||
if (num1 == null || num2 == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (num2.equals(Integer.valueOf(0))) {
|
||||
if (num2.equals(0)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal bigDecimalNum1 = new BigDecimal(num1);
|
||||
@@ -272,7 +282,7 @@ public class SmartBigDecimalUtil {
|
||||
* @return String
|
||||
*/
|
||||
public static Boolean isNotEmpty(BigDecimal num) {
|
||||
return ! isEmpty(num);
|
||||
return !isEmpty(num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,8 +293,7 @@ public class SmartBigDecimalUtil {
|
||||
* @return
|
||||
*/
|
||||
public static BigDecimal convertTenThousand(BigDecimal num, int point) {
|
||||
BigDecimal decimal = num.divide(new BigDecimal(10000), point, RoundingMode.HALF_UP);
|
||||
return decimal;
|
||||
return num.divide(new BigDecimal(10000), point, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,4 +309,25 @@ public class SmartBigDecimalUtil {
|
||||
return BigDecimal.ZERO.subtract(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1,num2 返回最大的值
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal max(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) > 0 ? num1 : num2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1,num2 返回最小的值
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal min(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) < 0 ? num1 : num2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,15 +18,6 @@
|
||||
d.create_time
|
||||
</sql>
|
||||
|
||||
<select id="countSubDepartment" resultType="integer">
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
t_department
|
||||
WHERE
|
||||
parent_id = #{departmentId}
|
||||
</select>
|
||||
|
||||
<select id="listAll" resultMap="DepartmentVO">
|
||||
SELECT
|
||||
<include refid="baseSql"></include>,
|
||||
@@ -50,5 +41,14 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="countSubDepartment" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
t_department
|
||||
WHERE
|
||||
parent_id = #{deptId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -106,7 +106,7 @@
|
||||
FROM
|
||||
t_employee e
|
||||
WHERE
|
||||
e.login_name = #{phone} and e.is_disabled = #{isDisabled}
|
||||
e.phone = #{phone} and e.is_disabled = #{isDisabled}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -124,7 +124,10 @@
|
||||
FROM
|
||||
t_employee e
|
||||
WHERE
|
||||
e.department_id = #{departmentId}
|
||||
e.department_id = #{depId}
|
||||
<if test="deleteFlag != null">
|
||||
AND e.is_delete = #{deleteFlag}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS `t_department` (
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `parent_id` (`parent_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='部门表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='部门表';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_department 的数据:~4 rows (大约)
|
||||
DELETE FROM `t_department`;
|
||||
@@ -154,7 +154,7 @@ CREATE TABLE IF NOT EXISTS `t_employee` (
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`is_delete` int NOT NULL DEFAULT '0' COMMENT '是否删除0否 1是',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='员工表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='员工表';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_employee 的数据:~28 rows (大约)
|
||||
DELETE FROM `t_employee`;
|
||||
@@ -207,7 +207,7 @@ CREATE TABLE IF NOT EXISTS `t_file` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `module_id_module_type` (`module_id`,`module_type`) USING BTREE,
|
||||
KEY `module_type` (`module_type`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_file 的数据:~23 rows (大约)
|
||||
DELETE FROM `t_file`;
|
||||
@@ -248,7 +248,7 @@ CREATE TABLE IF NOT EXISTS `t_heart_beat_record` (
|
||||
`process_start_time` datetime DEFAULT NULL COMMENT '进程开启时间',
|
||||
`heart_beat_time` datetime DEFAULT NULL COMMENT '心跳时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_heart_beat_record 的数据:~2 rows (大约)
|
||||
DELETE FROM `t_heart_beat_record`;
|
||||
@@ -274,7 +274,7 @@ CREATE TABLE IF NOT EXISTS `t_id_generator` (
|
||||
`update_time` datetime DEFAULT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
UNIQUE KEY `key_name` (`key_name`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='id生成器定义表';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='id生成器定义表';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_id_generator 的数据:~2 rows (大约)
|
||||
DELETE FROM `t_id_generator`;
|
||||
@@ -293,7 +293,7 @@ CREATE TABLE IF NOT EXISTS `t_id_generator_record` (
|
||||
`day` int NOT NULL,
|
||||
`last_number` int NOT NULL,
|
||||
PRIMARY KEY (`generator_id`,`year`,`month`,`day`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='id_generator记录表';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='id_generator记录表';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_id_generator_record 的数据:~5 rows (大约)
|
||||
DELETE FROM `t_id_generator_record`;
|
||||
@@ -400,7 +400,7 @@ CREATE TABLE IF NOT EXISTS `t_order_operate_log` (
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `order_id_order_type` (`order_id`,`order_type`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='各种单据操作记录\r\n';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='各种单据操作记录\r\n';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_order_operate_log 的数据:~0 rows (大约)
|
||||
DELETE FROM `t_order_operate_log`;
|
||||
@@ -720,7 +720,7 @@ CREATE TABLE IF NOT EXISTS `t_reload_item` (
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`tag`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_reload_item 的数据:~0 rows (大约)
|
||||
DELETE FROM `t_reload_item`;
|
||||
@@ -738,7 +738,7 @@ CREATE TABLE IF NOT EXISTS `t_reload_result` (
|
||||
`result` tinyint unsigned NOT NULL COMMENT '是否成功 ',
|
||||
`exception` text,
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_reload_result 的数据:~127 rows (大约)
|
||||
DELETE FROM `t_reload_result`;
|
||||
@@ -938,7 +938,7 @@ CREATE TABLE IF NOT EXISTS `t_role_employee` (
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色员工功能表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色员工功能表';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_role_employee 的数据:~25 rows (大约)
|
||||
DELETE FROM `t_role_employee`;
|
||||
@@ -980,7 +980,7 @@ CREATE TABLE IF NOT EXISTS `t_role_privilege` (
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10835 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色权限功能表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10835 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色权限功能表';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_role_privilege 的数据:~322 rows (大约)
|
||||
DELETE FROM `t_role_privilege`;
|
||||
@@ -1322,7 +1322,7 @@ CREATE TABLE IF NOT EXISTS `t_system_config` (
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '上次修改时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_system_config 的数据:~8 rows (大约)
|
||||
DELETE FROM `t_system_config`;
|
||||
@@ -1354,7 +1354,7 @@ CREATE TABLE IF NOT EXISTS `t_user_login_log` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customer_id` (`user_id`) USING BTREE,
|
||||
KEY `auditor_id` (`remote_browser`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1743 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户登录日志';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1743 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户登录日志';
|
||||
|
||||
-- 正在导出表 smart-admin-dev.t_user_login_log 的数据:~122 rows (大约)
|
||||
DELETE FROM `t_user_login_log`;
|
||||
|
||||
2
smart-admin-web/.gitignore
vendored
2
smart-admin-web/.gitignore
vendored
@@ -2,8 +2,6 @@
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
package-lock.json
|
||||
|
||||
/tests/e2e/videos/
|
||||
/tests/e2e/screenshots/
|
||||
|
||||
|
||||
15500
smart-admin-web/package-lock.json
generated
Normal file
15500
smart-admin-web/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@
|
||||
"cropperjs": "^1.2.2",
|
||||
"dayjs": "^1.7.7",
|
||||
"decimal.js": "^10.1.1",
|
||||
"core-js":"^2.0.0",
|
||||
"e-guide-layer": "^0.1.1",
|
||||
"echarts": "^4.0.4",
|
||||
"gq-plus": "^2.1.5",
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
<e-guide-layer
|
||||
:current-index.sync="guideActiveIndex"
|
||||
:guide-list="guideList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
formData: {
|
||||
code: '',
|
||||
codeUuid: '',
|
||||
loginName: 'demo',
|
||||
loginName: 'sa',
|
||||
loginPwd: '123456'
|
||||
},
|
||||
codeUrl: ''
|
||||
@@ -131,4 +131,4 @@ export default {
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<Col :lg="19" :md="16">
|
||||
<Card class="warp-card" dis-hover>
|
||||
<!--Row 顶部操作区 start-->
|
||||
@@ -73,8 +73,8 @@
|
||||
</Row>
|
||||
<!--Row 底部操作区 end-->
|
||||
</Card>
|
||||
</Col>
|
||||
<!--EmployeeTableAdd 添加成员弹窗 start-->
|
||||
|
||||
<!--EmployeeTableAdd 添加成员弹窗 start-->
|
||||
<EmployeeTableAdd
|
||||
:selectDepartment="selectDepartment"
|
||||
@addSuccess="getEmployeeList"
|
||||
@@ -101,7 +101,10 @@
|
||||
<!--EmployeeTableDetail 角色详情 start-->
|
||||
<EmployeeTableDetail ref="employeeTableDetail"></EmployeeTableDetail>
|
||||
<!--EmployeeTableDetail 角色详情 end-->
|
||||
</div>
|
||||
|
||||
</Col>
|
||||
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { departmentApi } from '@/api/department';
|
||||
|
||||
38
代码规范/api接口规范.md
Normal file
38
代码规范/api接口规范.md
Normal file
@@ -0,0 +1,38 @@
|
||||
### Restful接口规范
|
||||
1、不推荐使用 rest 命名 url, 只能使用 get/post 方法。url 命名上规范如下:虽然 Rest 大法好,但是有时并不能一眼根据 url看出来是什么操作。
|
||||
url 格式为:
|
||||
|
||||
/业务模块/子模块/动作
|
||||
|
||||
举例:
|
||||
```
|
||||
GET /department/get/{id} 查询某个部门详细信息
|
||||
POST /department/query 复杂查询
|
||||
POST /department/add 添加部门
|
||||
POST /department/update 更新部门
|
||||
GET /department/delete/{id} 删除部门
|
||||
```
|
||||
### controller 里接口 swagger 规范
|
||||
1、controller每个方法必须添加 swagger 文档注解 @ApiOperation ,并填写接口描述信息,描述最后必须加上作者信息 @author 哪吒
|
||||
比如:
|
||||
```java
|
||||
@ApiOperation("更新部门信息 @author 哪吒")
|
||||
@PostMapping("/department/update")
|
||||
public ResponseDTO<String> updateDepartment(@Valid @RequestBody DeptUpdateDTO deptUpdateDTO) {
|
||||
return departmentService.updateDepartment(deptUpdateDTO);
|
||||
}
|
||||
```
|
||||
|
||||
### controller 里 传入和返回 JavaBean 规范
|
||||
1、类中的每个字段添加注释
|
||||
2、对于枚举值的类型,要清楚标注清楚可能的值,以及每个值表示什么含义
|
||||
比如:
|
||||
```
|
||||
public class UserVO{
|
||||
|
||||
@ApiModelProperty("性别:0表示 女,1表示 男,2表示 未知")
|
||||
private Integer gender;
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user