Commit 006ea11b by wangql

aaa

2 parents 765877ac c2e97b11
Showing 120 changed files with 1674 additions and 718 deletions
...@@ -7,10 +7,12 @@ VUE_APP_TITLE=tFIMS ...@@ -7,10 +7,12 @@ VUE_APP_TITLE=tFIMS
VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 仓库地址 # 仓库地址
VUE_APP_REPO= VUE_APP_REPO=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 国际化配置 # 国际化配置
VUE_APP_I18N_LOCALE=zh-chs VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF
\ No newline at end of file \ No newline at end of file
VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_MAIN_COLOR=#3D6FE4
\ No newline at end of file \ No newline at end of file
...@@ -5,16 +5,13 @@ ...@@ -5,16 +5,13 @@
"serve": "vue-cli-service serve --open", "serve": "vue-cli-service serve --open",
"start": "npm run serve", "start": "npm run serve",
"dev": "npm run serve", "dev": "npm run serve",
"build": "vue-cli-service build", "build": "vue-cli-service build --mode nomock",
"build:nomock": "vue-cli-service build --mode nomock", "build:nomock": "vue-cli-service build --mode nomock",
"build:travis": "vue-cli-service build --mode travis", "build:travis": "vue-cli-service build --mode travis",
"lint": "vue-cli-service lint --fix", "lint": "vue-cli-service lint --fix",
"test:unit": "vue-cli-service test:unit" "test:unit": "vue-cli-service test:unit"
}, },
"dependencies": { "dependencies": {
"@d2-projects/d2-crud": "^2.1.1",
"@d2-projects/vue-table-export": "^1.0.1",
"@d2-projects/vue-table-import": "^1.0.0",
"axios": "^0.18.0", "axios": "^0.18.0",
"better-scroll": "^1.15.2", "better-scroll": "^1.15.2",
"core-js": "^2.6.5", "core-js": "^2.6.5",
...@@ -28,13 +25,11 @@ ...@@ -28,13 +25,11 @@
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
"mockjs": "^1.0.1-beta3",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qs": "^6.7.0", "qs": "^6.7.0",
"screenfull": "^4.2.0", "screenfull": "^4.2.0",
"ua-parser-js": "^0.7.19", "ua-parser-js": "^0.7.19",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-avatar": "^2.1.7",
"vue-i18n": "^8.14.0", "vue-i18n": "^8.14.0",
"vue-role-manager": "^1.2.0", "vue-role-manager": "^1.2.0",
"vue-router": "^3.0.3", "vue-router": "^3.0.3",
...@@ -57,6 +52,7 @@ ...@@ -57,6 +52,7 @@
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"svg-sprite-loader": "^4.1.3", "svg-sprite-loader": "^4.1.3",
"vue-template-compiler": "^2.5.21", "vue-template-compiler": "^2.5.21",
"webpack-bundle-analyzer": "^3.4.1",
"webpack-theme-color-replacer": "^1.2.15" "webpack-theme-color-replacer": "^1.2.15"
} }
} }
No preview for this file type
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="<%= BASE_URL %>icon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= VUE_APP_TITLE %></title> <link rel="icon" href="<%= BASE_URL %>icon.ico">
<style> <!-- 使用CDN的CSS文件 -->
html, body, #app { height: 100%; margin: 0px; padding: 0px; width: 100%; } <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
.d2-home { background-color:#000; height: 100%; display: flex; flex-direction: column; } <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
.d2-home__main { user-select: none; width: 100%; flex-grow: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; } <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
.d2-home__footer { width: 100%; flex-grow: 0; text-align: center; padding: 1em 0; } <% } %>
.d2-home__footer > a { font-size: 12px; color: #fff; text-decoration: none; } <!-- 使用CDN的JS文件 预加载 -->
.d2-home__loading { height: 32px; width: 32px; margin-bottom: 20px; } <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
.d2-home__title { color: #FFF; font-size: 20px; margin-bottom: 10px; } <link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
.d2-home__sub-title { color: #fff; font-size: 14px; } <% } %>
</style> <title><%= VUE_APP_TITLE %></title>
<!-- <script> <style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
.d2-home {
background-color: #2A343D;
height: 100%;
display: flex;
flex-direction: column;
}
.d2-home__main {
user-select: none;
width: 100%;
flex-grow: 1;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.d2-home__footer {
width: 100%;
flex-grow: 0;
text-align: center;
padding: 1em 0;
}
.d2-home__footer>a {
font-size: 12px;
color: #fff;
text-decoration: none;
}
.d2-home__loading {
height: 32px;
width: 32px;
margin-bottom: 20px;
}
.d2-home__title {
color: #FFF;
font-size: 20px;
margin-bottom: 10px;
}
.d2-home__sub-title {
color: #fff;
font-size: 14px;
}
</style>
<!-- <script>
var _hmt = _hmt || []; var _hmt = _hmt || [];
var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1"; var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1";
(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})(); (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();
</script> --> </script> -->
</head> </head>
<body>
<noscript> <body>
<strong> <noscript>
很抱歉,如果没有 JavaScript 支持,D2Admin 将不能正常工作。请启用浏览器的 JavaScript 然后继续。 <strong>
</strong> 很抱歉,如果没有 JavaScript 支持,系统 将不能正常工作。请启用浏览器的 JavaScript 然后继续。
</noscript> </strong>
<div id="app"> </noscript>
<div class="d2-home"> <div id="app">
<div class="d2-home__main"> <div class="d2-home">
<img <div class="d2-home__main">
class="d2-home__loading" <img class="d2-home__loading" src="./image/loading/loading-spin.svg" alt="loading">
src="./image/loading/loading-spin.svg" <div class="d2-home__title">
alt="loading"> 正在加载资源
<div class="d2-home__title">
正在加载资源
</div>
<div class="d2-home__sub-title">
初次加载资源可能需要较多时间 请耐心等待
</div>
</div> </div>
<div class="d2-home__footer"> <div class="d2-home__sub-title">
<a 初次加载资源可能需要较多时间 请耐心等待
href="https://github.com/d2-projects/d2-admin"
target="_blank">
https://github.com/d2-projects/d2-admin
</a>
</div> </div>
</div> </div>
<div class="d2-home__footer">
<a href="http://www.glsx.com.cn" target="_blank">
<!-- 版权所有&copy-2019 GLSX粤ICP备12020087号 -->
</a>
</div>
</div> </div>
</body> </div>
</html> <!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
\ No newline at end of file \ No newline at end of file
import request from './request'
const path = 'fims.device.'
function getListApi (data) {
data.method = `${path}list`
return request(data)
}
function editApi (data) {
data.method = `${path}edit`
return request(data)
}
function removeApi (data) {
data.method = `${path}remove`
return request(data)
}
function importApi (data) {
data.method = `${path}import`
return request(data)
}
function exportApi (data) {
data.method = `${path}export`
return request(data)
}
export {
getListApi,
editApi,
removeApi,
importApi,
exportApi
}
import request from './request'
const path = 'fims.maintain.'
function getListApi (data) {
data.method = `${path}search`
return request(data)
}
function removeApi (data) {
data.method = `${path}delete`
return request(data)
}
function exportApi (data) {
data.method = `${path}export`
return request(data)
}
export {
getListApi,
removeApi,
exportApi
}
import request from './request'
const path = 'fims.order.'
function getListApi (data) {
data.method = `${path}search`
return request(data)
}
function detailApi (data) {
data.method = `${path}detail`
return request(data)
}
function removeApi (data) {
data.method = `${path}delete`
return request(data)
}
function downloadApi (data) {
data.method = `${path}download`
return request(data)
}
export {
getListApi,
detailApi,
removeApi,
downloadApi
}
import request from './request'
const path = 'fims.material.'
function getListApi (data) {
data.method = `${path}list`
return request(data)
}
export {
getListApi
}
...@@ -2,22 +2,26 @@ ...@@ -2,22 +2,26 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:41 * @Date: 2019-08-26 18:02:41
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-08-28 15:04:32 * @Last Modified time: 2019-09-01 15:33:02
*/ */
import axios from '@/plugin/axios' import axios from '@/plugin/axios'
import sign from './sign' import sign from './sign'
const request = (params, method) => { import RequestMethods from './request.methods'
// import util from '@/libs/util'
const request = (params = {}, method = RequestMethods.GET) => {
// params = util.deepClone(params)
params.source = '' params.source = ''
params.app_key = '48e5e13229b82c1b4e6e8c96151f0637' params.app_key = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime() params.timestamp = new Date().getTime()
params.v = '1.0.0' params.v = '1.0.0'
params.format = 'json' params.format = 'json'
const url = process.env.NODE_ENV === 'production' ? 'router' : params.method // const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
// return axios.post(url, { 'params': sign(params) }) // return axios.post(url, { 'params': sign(params) })
const url = params.method
return axios({ return axios({
url, url,
method: method || 'get', method,
data: sign(params) data: sign(params)
}) })
} }
......
...@@ -2,27 +2,27 @@ import request from './request' ...@@ -2,27 +2,27 @@ import request from './request'
const path = 'fims.subsystem.' const path = 'fims.subsystem.'
const methods = { const methods = {
Add: `${path}add`, Add: `${path}add`,
Edit: `${path}edit` Edit: `${path}edit`
} }
function getListApi (data) { function getListApi (data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi (data) {
return request(data) return request(data)
} }
function removeApi (data) { function removeApi (data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
}
export {
getListApi,
methods,
editApi,
removeApi
} }
export {
getListApi,
methods,
editApi,
removeApi
}
\ No newline at end of file \ No newline at end of file
/*
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: limin
* @Last Modified time: 2019-09-01 17:18:41
*/
import request from './request'
import RequestMethods from './request.methods'
// 用户相关
const user_path = 'fims.user.'
/**
* 用户登录
* @param {*} data 参数
*/
export function AccountLogin (data) {
data.method = `${user_path}login`
return request(data, RequestMethods.POST)
}
/**
* 注册
* @param {*} data 参数
*/
export function Reg (data = {}) {
data.method = `${user_path}register`
return request(data, RequestMethods.GET)
}
/*
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: limin
* @Last Modified time: 2019-09-01 17:19:07
*/
import request from './request'
import RequestMethods from './request.methods'
// 基础数据
const path = 'fims.base.'
/**
* 获取站点列表
* @param {*} data 参数
*/
export function StationList (data = {}) {
data.method = `${path}station`
return request(data, RequestMethods.GET)
}
/**
* 获取公司列表
* @param {*} data 参数
*/
export function CompanyList (data = {}) {
data.method = `${path}company`
return request(data, RequestMethods.GET)
}
/**
* 获取部门列表
* @param {*} data 参数
*/
export function DepartList (data = {}) {
data.method = `${path}depart`
return request(data, RequestMethods.GET)
}
/**
* 获取角色列表
* @param {*} data 参数
*/
export function FetchRoleList (data = {}) {
data.method = `fims.role.list`
return request(data, RequestMethods.GET)
}
...@@ -2,13 +2,13 @@ import request from './request' ...@@ -2,13 +2,13 @@ import request from './request'
const path = 'fims.system.' const path = 'fims.system.'
function getListApi (data) { function getListApi (data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function reportApi (data) { function reportApi (data) {
data.method = `${path}report` data.method = `${path}report`
return request(data) return request(data)
} }
export { export {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
html, body { html, body {
margin: 0px; margin: 0px;
height: 100%; height: 100%;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
#app { #app {
@extend %full; @extend %full;
a { a {
......
...@@ -16,4 +16,10 @@ ...@@ -16,4 +16,10 @@
.el-tabs__item:focus.is-active.is-focus:not(:active) { .el-tabs__item:focus.is-active.is-focus:not(:active) {
box-shadow: none !important; box-shadow: none !important;
}
.el-tabs__nav-scroll{
padding-left: 20px;
}
.el-color-picker__trigger{
border-color:rgba(255,255,255,.1)
} }
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'blue';
// diff
$private-left-side-color:#652DED;
// diff
$private-menu-active-background-color:#521ADA;
$private-item-hover:rgba(#000,.05);
$private-menu-text-color:#C4D0DF;
// 主题背景颜色
$theme-bg-color: $private-left-side-color;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// 主区域背景色 --- limin diff
$theme-container-main-background-color:#F5F5F5;
// container组件
$theme-container-background-color: rgba(#FFF, 1);
$theme-container-header-footer-background-color: rgb(255, 255, 255);
$theme-container-border-inner: 1px solid $color-border-1;
$theme-container-border-outer: 1px solid #E7EAEC;
$theme-multiple-page-control-color: #888;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: $private-menu-text-color;
$theme-multiple-page-control-nav-next-color: $private-menu-text-color;
$theme-multiple-page-control-border-color: #E7EAEC;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .2);
$theme-multiple-page-control-background-color-active: #FFF;
// hamberg --limin diff
$theme-header-hamberg-color:#FFF;
$theme-header-hamberg-color-hover:$private-menu-active-background-color;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 头部背景色 --- limin
$theme-header-background-color:$private-left-side-color;
//logo 背景色 --- limin
$theme-header-logo-background-color:$private-left-side-color;
// 顶栏上的文字颜色 diff
$theme-header-item-color: $private-menu-text-color;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFF;
$theme-header-item-border-color-hover:rgba($theme-header-item-color-hover,.1);
$theme-header-item-background-color-hover: $private-item-hover;
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFF;
$theme-header-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFF;
$theme-header-item-background-color-active: rgba($private-menu-active-background-color, 1);
$theme-container-aside-background-color:linear-gradient(180deg, #6729ED 0%, #3E76E2 100%);
// 侧边栏上的文字颜色
$theme-aside-item-color: $private-menu-text-color;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFF;
$theme-aside-item-background-color-hover: $private-item-hover;
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFF;
$theme-aside-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFF;
$theme-aside-item-background-color-active: rgba($private-menu-active-background-color, 1);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #1F3147;
$theme-aside-menu-empty-text-color: #1F3147;
$theme-aside-menu-empty-background-color: rgba(#FFF, .1);
$theme-aside-menu-empty-icon-color-hover: #FFEBA4;
$theme-aside-menu-empty-text-color-hover: #FFEBA4;
$theme-aside-menu-empty-background-color-hover: rgba(#FFF, .2);
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'classic';
$private-left-side-color:#2A58AD;
$private-menu-active-background-color:#154190;
$private-item-hover:rgba(#000,.05);
$private-menu-text-color:#C4D0DF;
// 主题背景颜色
$theme-bg-color: $private-left-side-color;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// 主区域背景色 --- limin
$theme-container-main-background-color:#FFF;
// container组件
$theme-container-background-color: rgba(#FFF, 1);
$theme-container-header-footer-background-color: rgb(255, 255, 255);
$theme-container-border-inner: 1px solid $color-border-1;
$theme-container-border-outer: 1px solid #E7EAEC;
$theme-multiple-page-control-color: #888;
$theme-multiple-page-control-color-active: $color-text-normal;
// tab 页签 滚动条 左 箭头 按钮 颜色
$theme-multiple-page-control-nav-prev-color: $private-menu-text-color;
// tab 页签 滚动条 右 箭头 按钮 颜色
$theme-multiple-page-control-nav-next-color: $private-menu-text-color;
$theme-multiple-page-control-border-color: #E7EAEC;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .2);
$theme-multiple-page-control-background-color-active: #FFF;
// hamberg --limin
$theme-header-hamberg-color:$private-left-side-color;
$theme-header-hamberg-color-hover:$private-menu-active-background-color;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 头部背景色 --- limin
$theme-header-background-color:#F3F3F4;
//logo 背景色 --- limin
$theme-header-logo-background-color:$private-left-side-color;
// 顶栏上的文字颜色
$theme-header-item-color: #666;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFF;
$theme-header-item-border-color-hover:rgba($theme-header-item-color-hover,1);
$theme-header-item-background-color-hover: $private-item-hover;
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFF;
$theme-header-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFF;
$theme-header-item-background-color-active: rgba($private-menu-active-background-color, 1);
$theme-container-aside-background-color:'transparent';
// 侧边栏上的文字颜色
$theme-aside-item-color: $private-menu-text-color;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFF;
$theme-aside-item-background-color-hover: $private-item-hover;
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFF;
$theme-aside-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFF;
$theme-aside-item-background-color-active: rgba($private-menu-active-background-color, 1);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #1F3147;
$theme-aside-menu-empty-text-color: #1F3147;
$theme-aside-menu-empty-background-color: rgba(#FFF, .1);
$theme-aside-menu-empty-icon-color-hover: #FFEBA4;
$theme-aside-menu-empty-text-color-hover: #FFEBA4;
$theme-aside-menu-empty-background-color-hover: rgba(#FFF, .2);
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'd2';
// 主题背景颜色
$theme-bg-color: #ebf1f6;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// container组件
$theme-container-background-color: rgba(#FFF, 1);
$theme-container-header-footer-background-color: #FFF;
$theme-container-border-inner: 1px solid #cfd7e5;
$theme-container-border-outer: 1px solid #cfd7e5;
$theme-multiple-page-control-color: $color-text-normal;
$theme-multiple-page-control-color-active: #2f74ff;
$theme-multiple-page-control-nav-prev-color: #cfd7e5;
$theme-multiple-page-control-nav-next-color: #cfd7e5;
$theme-multiple-page-control-border-color: #cfd7e5;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#000, .03);
$theme-multiple-page-control-background-color-active: #FFF;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 顶栏上的文字颜色
$theme-header-item-color: $color-text-normal;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #2f74ff;
$theme-header-item-background-color-hover: rgba(#FFF, .5);
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #2f74ff;
$theme-header-item-background-color-focus: rgba(#FFF, .5);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #2f74ff;
$theme-header-item-background-color-active: rgba(#FFF, .5);
// 侧边栏上的文字颜色
$theme-aside-item-color: $color-text-normal;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #2f74ff;
$theme-aside-item-background-color-hover: rgba(#FFF, .5);
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #2f74ff;
$theme-aside-item-background-color-focus: rgba(#FFF, .5);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #2f74ff;
$theme-aside-item-background-color-active: rgba(#FFF, .5);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: $color-text-normal;
$theme-aside-menu-empty-text-color: $color-text-normal;
$theme-aside-menu-empty-background-color: rgba(#000, .03);
$theme-aside-menu-empty-icon-color-hover: $color-text-main;
$theme-aside-menu-empty-text-color-hover: $color-text-main;
$theme-aside-menu-empty-background-color-hover: rgba(#000, .05);
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'dark';
$private-left-side-color:#314256;
$private-menu-active-background-color:#1F3147;
$private-item-hover:rgba(#000,.05);
$private-menu-text-color:#C4D0DF;
// 主题背景颜色
$theme-bg-color: $private-left-side-color;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// 主区域背景色 --- limin
$theme-container-main-background-color:#F5F5F5;
// container组件
$theme-container-background-color: rgba(#FFF, 1);
$theme-container-header-footer-background-color: #FFF;
$theme-container-border-inner: 1px solid $color-border-1;
$theme-container-border-outer: 1px solid #E7EAEC;
$theme-multiple-page-control-color: #888;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: $private-menu-text-color;
$theme-multiple-page-control-nav-next-color: $private-menu-text-color;
$theme-multiple-page-control-border-color: #E7EAEC;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .2);
$theme-multiple-page-control-background-color-active: #FFF;
// hamberg --limin
$theme-header-hamberg-color:#FFF;
$theme-header-hamberg-color-hover:$private-menu-active-background-color;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 头部背景色 --- limin
$theme-header-background-color:#3B4F67;
//logo 背景色 --- limin
$theme-header-logo-background-color:$private-left-side-color;
// 顶栏上的文字颜色
$theme-header-item-color: $private-menu-text-color;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFF;
$theme-header-item-border-color-hover:rgba($theme-header-item-color-hover,.1);
$theme-header-item-background-color-hover: $private-item-hover;
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFF;
$theme-header-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFF;
$theme-header-item-background-color-active: rgba($private-menu-active-background-color, 1);
$theme-container-aside-background-color:'transparent';
// 侧边栏上的文字颜色
$theme-aside-item-color: $private-menu-text-color;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFF;
$theme-aside-item-background-color-hover: $private-item-hover;
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFF;
$theme-aside-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFF;
$theme-aside-item-background-color-active: rgba($private-menu-active-background-color, 1);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #1F3147;
$theme-aside-menu-empty-text-color: #1F3147;
$theme-aside-menu-empty-background-color: rgba(#FFF, .1);
$theme-aside-menu-empty-icon-color-hover: #FFEBA4;
$theme-aside-menu-empty-text-color-hover: #FFEBA4;
$theme-aside-menu-empty-background-color-hover: rgba(#FFF, .2);
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'line';
// 主题背景颜色
$theme-bg-color: #f8f8f9;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// container组件
$theme-container-background-color: rgba(#FFF, .8);
$theme-container-header-footer-background-color: #FFF;
$theme-container-border-inner: 1px solid $color-border-2;
$theme-container-border-outer: 1px solid #cfd7e5;
$theme-multiple-page-control-color: #FFF;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: #cfd7e5;
$theme-multiple-page-control-nav-next-color: #cfd7e5;
$theme-multiple-page-control-border-color: #cfd7e5;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: #cfd7e5;
$theme-multiple-page-control-background-color-active: #FFF;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #EFEFEF;
// 顶栏上的文字颜色
$theme-header-item-color: $color-text-normal;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: $color-text-main;
$theme-header-item-background-color-hover: rgba(#000, .02);
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: $color-text-main;
$theme-header-item-background-color-focus: rgba(#000, .02);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: $color-text-main;
$theme-header-item-background-color-active: rgba(#000, .03);
// 侧边栏上的文字颜色
$theme-aside-item-color: $color-text-normal;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: $color-text-main;
$theme-aside-item-background-color-hover: rgba(#000, .02);
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: $color-text-main;
$theme-aside-item-background-color-focus: rgba(#000, .02);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: $color-text-main;
$theme-aside-item-background-color-active: rgba(#000, .03);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: $color-text-normal;
$theme-aside-menu-empty-text-color: $color-text-normal;
$theme-aside-menu-empty-background-color: rgba(#000, .03);
$theme-aside-menu-empty-icon-color-hover: $color-text-main;
$theme-aside-menu-empty-text-color-hover: $color-text-main;
$theme-aside-menu-empty-background-color-hover: rgba(#000, .05);
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'plane';
// diff
$private-left-side-color:transparent;
// diff
$private-menu-active-background-color:#002253;
$private-item-hover:rgba(#000,.05);
$private-menu-text-color:#C4D0DF;
// 主题背景颜色
$theme-bg-color: $private-left-side-color;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// 主区域背景色 --- limin diff
$theme-container-main-background-color:transparent;
// container组件
$theme-container-background-color: rgba(#FFF, 1);
$theme-container-header-footer-background-color: rgb(255, 255, 255);
$theme-container-border-inner: 1px solid $color-border-1;
$theme-container-border-outer: 1px solid #E7EAEC;
$theme-multiple-page-control-color: #888;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: $private-menu-text-color;
$theme-multiple-page-control-nav-next-color: $private-menu-text-color;
$theme-multiple-page-control-border-color: #E7EAEC;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .8);
$theme-multiple-page-control-background-color-active: #FFF;
// hamberg --limin diff
$theme-header-hamberg-color:#FFF;
$theme-header-hamberg-color-hover:$private-menu-active-background-color;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 头部背景色 --- limin
$theme-header-background-color:$private-left-side-color;
//logo 背景色 --- limin
$theme-header-logo-background-color:$private-left-side-color;
// 顶栏上的文字颜色 diff
$theme-header-item-color: $private-menu-text-color;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFF;
$theme-header-item-border-color-hover:rgba($theme-header-item-color-hover,.1);
$theme-header-item-background-color-hover: $private-item-hover;
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFF;
$theme-header-item-background-color-focus: rgba($private-menu-active-background-color, .2);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFF;
$theme-header-item-background-color-active: rgba($private-menu-active-background-color, 1);
$theme-container-aside-background-color:'transparent';
// 侧边栏上的文字颜色
$theme-aside-item-color: $private-menu-text-color;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFF;
$theme-aside-item-background-color-hover: $private-item-hover;
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFF;
$theme-aside-item-background-color-focus: rgba($private-menu-active-background-color, 1);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFF;
$theme-aside-item-background-color-active: rgba($private-menu-active-background-color, 1);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #1F3147;
$theme-aside-menu-empty-text-color: #1F3147;
$theme-aside-menu-empty-background-color: rgba(#FFF, .1);
$theme-aside-menu-empty-icon-color-hover: #FFEBA4;
$theme-aside-menu-empty-text-color-hover: #FFEBA4;
$theme-aside-menu-empty-background-color-hover: rgba(#FFF, .2);
\ No newline at end of file \ No newline at end of file
@import '~@/assets/style/theme/theme-base.scss'; @import '~@/assets/style/theme/theme-base.scss';
@import '~@/assets/style/theme/d2/index.scss';
@import '~@/assets/style/theme/line/index.scss';
@import '~@/assets/style/theme/star/index.scss';
@import '~@/assets/style/theme/tomorrow-night-blue/index.scss';
@import '~@/assets/style/theme/violet/index.scss';
\ No newline at end of file \ No newline at end of file
// @import '~@/assets/style/theme/d2/index.scss';
// @import '~@/assets/style/theme/line/index.scss';
// @import '~@/assets/style/theme/star/index.scss';
// @import '~@/assets/style/theme/tomorrow-night-blue/index.scss';
// @import '~@/assets/style/theme/violet/index.scss';
@import '~@/assets/style/theme/classic/index.scss';
@import '~@/assets/style/theme/dark/index.scss';
@import '~@/assets/style/theme/blue/index.scss';
@import '~@/assets/style/theme/plane/index.scss';
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'star';
// 主题背景颜色
$theme-bg-color: #EFF4F8;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, .3);
// container组件
$theme-container-background-color: rgba(#FFF, .9);
$theme-container-header-footer-background-color: #FFF;
$theme-container-border-inner: 1px solid $color-border-1;
$theme-container-border-outer: 1px solid #114450;
$theme-multiple-page-control-color: #FFF;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: #FFF;
$theme-multiple-page-control-nav-next-color: #FFF;
$theme-multiple-page-control-border-color: #114450;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .5);
$theme-multiple-page-control-background-color-active: #FFF;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 顶栏上的文字颜色
$theme-header-item-color: #FFF;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFF;
$theme-header-item-background-color-hover: rgba(#000, .2);
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFF;
$theme-header-item-background-color-focus: rgba(#000, .2);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFF;
$theme-header-item-background-color-active: rgba(#000, .3);
// 侧边栏上的文字颜色
$theme-aside-item-color: #FFF;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFF;
$theme-aside-item-background-color-hover: rgba(#000, .2);
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFF;
$theme-aside-item-background-color-focus: rgba(#000, .2);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFF;
$theme-aside-item-background-color-active: rgba(#000, .3);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #FFF;
$theme-aside-menu-empty-text-color: #FFF;
$theme-aside-menu-empty-background-color: rgba(#FFF, .2);
$theme-aside-menu-empty-icon-color-hover: #FFF;
$theme-aside-menu-empty-text-color-hover: #FFF;
$theme-aside-menu-empty-background-color-hover: rgba(#FFF, .3);
\ No newline at end of file \ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
.d2-layout-header-aside-content { .d2-layout-header-aside-content {
@extend %full; @extend %full;
.d2-theme-header { .d2-theme-header {
height: 60px; height: 58px;
.d2-theme-header-menu { .d2-theme-header-menu {
overflow: hidden; overflow: hidden;
&.is-scrollable { &.is-scrollable {
...@@ -85,9 +85,10 @@ ...@@ -85,9 +85,10 @@
padding: 0px; padding: 0px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
transition: .1s ease;
.d2-theme-container-main-layer { .d2-theme-container-main-layer {
position: absolute; position: absolute;
top: 0px; top: 2px;
bottom: 0px; bottom: 0px;
left: 0px; left: 0px;
right: 0px; right: 0px;
...@@ -109,6 +110,7 @@ ...@@ -109,6 +110,7 @@
-o-filter: grayscale(100%); -o-filter: grayscale(100%);
filter: grayscale(100%); filter: grayscale(100%);
filter: gray; filter: gray;
transition: 3s ease;
} }
// 主体 // 主体
.d2-layout-header-aside-content { .d2-layout-header-aside-content {
...@@ -120,23 +122,14 @@ ...@@ -120,23 +122,14 @@
float: left; float: left;
text-align: center; text-align: center;
img { img {
height: 60px; height: 65px;
transform: translateX(-16px);
} }
} }
// 折叠侧边栏切换按钮 // 折叠侧边栏切换按钮
// .toggle-aside-btn { .toggle-aside-btn {
// float: left; margin-left: 26px;
// height: 60px; }
// width: 60px;
// display: flex;
// justify-content: center;
// align-items: center;
// @extend %unable-select;
// i {
// font-size: 20px;
// margin-top: 4px;
// }
// }
// [菜单] 顶栏 // [菜单] 顶栏
.el-menu { .el-menu {
float: left; float: left;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
background: $theme-bg-mask; background: $theme-bg-mask;
} }
} }
// 菜单项目 // 菜单项目
@mixin theme-menu-hover-style { @mixin theme-menu-hover-style {
color: $theme-menu-item-color-hover; color: $theme-menu-item-color-hover;
...@@ -63,6 +62,10 @@ ...@@ -63,6 +62,10 @@
// 顶栏 // 顶栏
.d2-theme-header { .d2-theme-header {
background-color: $theme-header-background-color;
.d2-theme-header-logo{
background-color: $theme-header-logo-background-color
}
// 顶栏菜单空间不足时显示的滚动控件 // 顶栏菜单空间不足时显示的滚动控件
.d2-theme-header-menu { .d2-theme-header-menu {
.d2-theme-header-menu__prev, .d2-theme-header-menu__next { .d2-theme-header-menu__prev, .d2-theme-header-menu__next {
...@@ -77,10 +80,10 @@ ...@@ -77,10 +80,10 @@
// 切换按钮 // 切换按钮
.toggle-aside-btn { .toggle-aside-btn {
// i { // i {
fill: $theme-header-item-color; fill: $theme-header-hamberg-color;
background: $theme-header-item-background-color; background: $theme-header-item-background-color;
&:hover { &:hover {
fill: $theme-header-item-color-hover; fill: $theme-header-hamberg-color-hover;
} }
// } // }
} }
...@@ -149,7 +152,8 @@ ...@@ -149,7 +152,8 @@
&.can-hover { &.can-hover {
&:hover { &:hover {
color: $theme-header-item-color-hover; color: $theme-header-item-color-hover;
background: $theme-header-item-background-color-hover; background-color: $theme-header-item-background-color-hover;
border-color:$theme-header-item-border-color-hover;
} }
} }
} }
...@@ -159,6 +163,7 @@ ...@@ -159,6 +163,7 @@
.d2-theme-container { .d2-theme-container {
// 侧边栏 // 侧边栏
.d2-theme-container-aside { .d2-theme-container-aside {
background: $theme-container-aside-background-color;
// 菜单为空的时候显示的信息 // 菜单为空的时候显示的信息
.d2-layout-header-aside-menu-empty { .d2-layout-header-aside-menu-empty {
background: $theme-aside-menu-empty-background-color; background: $theme-aside-menu-empty-background-color;
...@@ -236,6 +241,10 @@ ...@@ -236,6 +241,10 @@
} }
} }
.d2-theme-container-main { .d2-theme-container-main {
background-color: $theme-container-main-background-color;
&.is-search{
background-color: rgba($theme-header-background-color,.5)
}
// 主体部分分为多页面控制器 和主体 // 主体部分分为多页面控制器 和主体
.d2-theme-container-main-header { .d2-theme-container-main-header {
// 多页面控制器 // 多页面控制器
......
// 主题名称
$theme-name: 'tomorrow-night-blue';
// 主题背景颜色
$theme-bg-color: #002253;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// container组件
$theme-container-background-color: rgba(#FFF, 1);
$theme-container-header-footer-background-color: #FFF;
$theme-container-border-inner: 1px solid $color-border-1;
$theme-container-border-outer: 1px solid #002253;
$theme-multiple-page-control-color: #FFF;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: #FFF;
$theme-multiple-page-control-nav-next-color: #FFF;
$theme-multiple-page-control-border-color: #002253;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .2);
$theme-multiple-page-control-background-color-active: #FFF;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 顶栏上的文字颜色
$theme-header-item-color: #FF929A;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFEBA4;
$theme-header-item-background-color-hover: rgba(#FFF, .05);
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFB870;
$theme-header-item-background-color-focus: rgba(#FFF, .05);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFB870;
$theme-header-item-background-color-active: rgba(#FFF, .05);
// 侧边栏上的文字颜色
$theme-aside-item-color: #FF929A;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFEBA4;
$theme-aside-item-background-color-hover: rgba(#FFF, .05);
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFB870;
$theme-aside-item-background-color-focus: rgba(#FFF, .05);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFB870;
$theme-aside-item-background-color-active: rgba(#FFF, .05);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #FFB870;
$theme-aside-menu-empty-text-color: #FFB870;
$theme-aside-menu-empty-background-color: rgba(#FFF, .1);
$theme-aside-menu-empty-icon-color-hover: #FFEBA4;
$theme-aside-menu-empty-text-color-hover: #FFEBA4;
$theme-aside-menu-empty-background-color-hover: rgba(#FFF, .2);
\ No newline at end of file \ No newline at end of file
@import './setting.scss';
@import '../theme.scss';
.theme-#{$theme-name} {
.d2-layout-header-aside-group {
background: #bc00e3;
background: linear-gradient(120deg, #bc00e3 0%, #4EFFFB 100%);
}
}
\ No newline at end of file \ No newline at end of file
// 主题名称
$theme-name: 'violet';
// 主题背景颜色
$theme-bg-color: #000;
// 主题背景图片遮罩
$theme-bg-mask: rgba(#000, 0);
// container组件
$theme-container-background-color: #FFF;
$theme-container-header-footer-background-color: #FFF;
$theme-container-border-inner: 1px solid $color-border-2;
$theme-container-border-outer: 1px solid #8C40E2;
$theme-multiple-page-control-color: #FFF;
$theme-multiple-page-control-color-active: $color-text-normal;
$theme-multiple-page-control-nav-prev-color: #FFF;
$theme-multiple-page-control-nav-next-color: #FFF;
$theme-multiple-page-control-border-color: #8C40E2;
$theme-multiple-page-control-border-color-active: #FFF;
$theme-multiple-page-control-background-color: rgba(#FFF, .3);
$theme-multiple-page-control-background-color-active: #FFF;
// 顶栏和侧边栏中展开的菜单 hover 状态下
$theme-menu-item-color-hover: #293849;
$theme-menu-item-background-color-hover: #ecf5ff;
// 顶栏上的文字颜色
$theme-header-item-color: #FFF;
$theme-header-item-background-color: transparent;
// 顶栏上的项目在 hover 时
$theme-header-item-color-hover: #FFF;
$theme-header-item-background-color-hover: linear-gradient(-180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.12) 100%);
// 顶栏上的项目在 focus 时
$theme-header-item-color-focus: #FFF;
$theme-header-item-background-color-focus: linear-gradient(-180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.12) 100%);
// 顶栏上的项目在 active 时
$theme-header-item-color-active: #FFF;
$theme-header-item-background-color-active: linear-gradient(-180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.12) 100%);
// 侧边栏上的文字颜色
$theme-aside-item-color: #FFF;
$theme-aside-item-background-color: transparent;
// 侧边栏上的项目在 hover 时
$theme-aside-item-color-hover: #FFF;
$theme-aside-item-background-color-hover: linear-gradient(90deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.00) 100%);
// 侧边栏上的项目在 focus 时
$theme-aside-item-color-focus: #FFF;
$theme-aside-item-background-color-focus: linear-gradient(90deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.00) 100%);
// 侧边栏上的项目在 active 时
$theme-aside-item-color-active: #FFF;
$theme-aside-item-background-color-active: linear-gradient(90deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.00) 100%);
// 侧边栏菜单为空的时候显示的元素
$theme-aside-menu-empty-icon-color: #FFF;
$theme-aside-menu-empty-text-color: #FFF;
$theme-aside-menu-empty-background-color: rgba(#000, .1);
$theme-aside-menu-empty-icon-color-hover: #FFF;
$theme-aside-menu-empty-text-color-hover: #FFF;
$theme-aside-menu-empty-background-color-hover: rgba(#000, .15);
\ No newline at end of file \ No newline at end of file
/*
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @Last Modified by: limin
* @Last Modified time: 2019-09-01 19:06:01
*/
export const BaseData = {
ROLE: 'role',
COMPANY: 'company',
DEPART: 'depart',
STATION: 'station'
}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</template> </template>
<script> <script>
import {mapGetters} from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'AuthButton', name: 'AuthButton',
props: { props: {
...@@ -43,20 +43,18 @@ export default { ...@@ -43,20 +43,18 @@ export default {
}, },
data () { data () {
return { return {
isInRole:false isInRole: false
} }
}, },
created () { created () {
// this.$vrm.setRoles(this.btnIdAll) // this.$vrm.setRoles(this.btnIdAll)
const {action,operation} = this.curBtns const { action, operation } = this.curBtns
this.isInRole = [...action,...operation].find(obj=>obj.id===this.id||obj.label===this.label) this.isInRole = [...action, ...operation].find(obj => obj.id === this.id || obj.label === this.label)
}, },
methods: { methods: {
handleClick: function () { handleClick: function () {
this.$emit('e-auth-click', {}) this.$emit('e-auth-click', {})
} }
},
mounted () {
} }
} }
</script> </script>
......
...@@ -5,7 +5,7 @@ import d2ContainerGhost from './components/d2-container-ghost.vue' ...@@ -5,7 +5,7 @@ import d2ContainerGhost from './components/d2-container-ghost.vue'
import d2ContainerGhostBs from './components/d2-container-ghost-bs.vue' import d2ContainerGhostBs from './components/d2-container-ghost-bs.vue'
import d2ContainerCard from './components/d2-container-card.vue' import d2ContainerCard from './components/d2-container-card.vue'
import d2ContainerCardBs from './components/d2-container-card-bs.vue' import d2ContainerCardBs from './components/d2-container-card-bs.vue'
import d2Source from './components/d2-source.vue' // import d2Source from './components/d2-source.vue'
export default { export default {
name: 'd2-container', name: 'd2-container',
...@@ -51,8 +51,8 @@ export default { ...@@ -51,8 +51,8 @@ export default {
on: { on: {
scroll: e => this.$emit('scroll', e) scroll: e => this.$emit('scroll', e)
} }
}, slots), }, slots)
h(d2Source) // h(d2Source)
]) ])
}, },
methods: { methods: {
......
/*
* @Author: limin
* @Date: 2019-08-31 12:44:16
* @Last Modified by: limin
* @Last Modified time: 2019-08-31 12:44:16
*/
import Vue from 'vue'
import focus from './src/focus'
Vue.directive(focus.name, focus)
/*
* @Author: limin
* @Date: 2019-08-31 12:44:08
* @Last Modified by: limin
* @Last Modified time: 2019-08-31 12:44:08
*/
export default {
name: 'focus',
inserted: function (el) {
el.querySelector('input').focus()
}
}
...@@ -15,26 +15,24 @@ export default { ...@@ -15,26 +15,24 @@ export default {
data () { data () {
return { return {
predefine: [ predefine: [
'#ff4500', '#FF0000', '#008000', '#0000FF'
'#ff8c00',
'#ffd700',
'#90ee90',
'#00ced1',
'#1e90ff',
'#c71585'
] ]
} }
}, },
computed: { computed: {
...mapState('d2admin/color', [ ...mapState('d2admin', {
'value' value: state => state.color.value,
]) listTheme: state => state.theme.list
})
}, },
watch: { watch: {
value (value) { value (value) {
this.set(value) this.set(value)
} }
}, },
mounted () {
this.predefine = [...this.predefine, ...this.listTheme.map(theme => theme.color)]
},
methods: { methods: {
...mapActions('d2admin/color', [ ...mapActions('d2admin/color', [
'set' 'set'
......
...@@ -39,12 +39,12 @@ export default { ...@@ -39,12 +39,12 @@ export default {
}), }),
handleChange (value) { handleChange (value) {
this.sizeSet(value) this.sizeSet(value)
this.$notify({ // this.$notify({
title: '提示', // title: '提示',
dangerouslyUseHTMLString: true, // dangerouslyUseHTMLString: true,
message: '已更新页面内 <b>组件</b> 的 <b>默认尺寸</b><br/>例如按钮大小,<b>非字号</b>', // message: '已更新页面内 <b>组件</b> 的 <b>默认尺寸</b><br/>例如按钮大小,<b>非字号</b>',
type: 'success' // type: 'success'
}) // })
}, },
iconName (name) { iconName (name) {
return name === this.value ? 'dot-circle-o' : 'circle-o' return name === this.value ? 'dot-circle-o' : 'circle-o'
......
...@@ -23,15 +23,16 @@ ...@@ -23,15 +23,16 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if="activeName === scope.row.name" v-if="activeName === scope.row.name"
type="success" type="primary"
icon="el-icon-check" icon="el-icon-check"
class="btn-active-success"
round> round>
已激活 已激活
</el-button> </el-button>
<el-button <el-button
v-else v-else
round round
@click="handleSelectTheme(scope.row.name)"> @click="handleSelectTheme(scope.row)">
使用 使用
</el-button> </el-button>
</template> </template>
...@@ -61,8 +62,11 @@ export default { ...@@ -61,8 +62,11 @@ export default {
...mapActions('d2admin/theme', [ ...mapActions('d2admin/theme', [
'set' 'set'
]), ]),
handleSelectTheme (name) { ...mapActions('d2admin/color', { setColor: 'set' }),
handleSelectTheme (row) {
const { name, color } = row
this.set(name) this.set(name)
this.setColor(color)
} }
} }
} }
...@@ -77,3 +81,10 @@ export default { ...@@ -77,3 +81,10 @@ export default {
border: 1px solid $color-border-1; border: 1px solid $color-border-1;
} }
</style> </style>
<style lang="scss">
.btn-active-success{
&:hover{
background-color: "#67C23A" !important;
}
}
</style>
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown>--> </el-dropdown>-->
<div v-popover:popover-personal class="d2-mr"> <div v-popover:popover-personal class="d2-mr personal-wrap">
<span class="btn-text">{{info.name ? `你好 ${info.name}` : '未登录'}}</span> <span class="btn-text">{{info.name ? `${info.name}` : '未登录'}}</span>
<el-popover ref="popover-personal" placement="bottom-end" trigger="hover"> <el-popover ref="popover-personal" placement="bottom-end" trigger="hover">
<personal-panel :user="info"></personal-panel> <personal-panel :user="info"></personal-panel>
</el-popover> </el-popover>
...@@ -66,3 +66,11 @@ export default { ...@@ -66,3 +66,11 @@ export default {
} }
} }
</script> </script>
<style lang="scss" scoped>
.personal-wrap{
transform: translateY(-3px);
.btn-text{
text-shadow: 0 1px 1px#666;
}
}
</style>
...@@ -121,13 +121,6 @@ export default { ...@@ -121,13 +121,6 @@ export default {
// } // }
// } // }
}, },
watch: {
// passwordDialogVisible(val) {
// this.$validator.errors.clear()
// }
},
mounted () {
},
methods: { methods: {
// 修改密码 // 修改密码
......
...@@ -121,8 +121,6 @@ export default { ...@@ -121,8 +121,6 @@ export default {
// } // }
// } // }
}, },
mounted () {
},
methods: { methods: {
// getPersonalType() { // getPersonalType() {
// const params = {} // const params = {}
......
...@@ -9,8 +9,7 @@ export default { ...@@ -9,8 +9,7 @@ export default {
menuMixin menuMixin
], ],
render (createElement) { render (createElement) {
return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } }, [
}, [
createElement('el-menu', { createElement('el-menu', {
props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active }, props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active },
ref: 'menu', ref: 'menu',
...@@ -71,9 +70,6 @@ export default { ...@@ -71,9 +70,6 @@ export default {
// } // }
}) })
}, },
test () {
alert(111)
},
scrollDestroy () { scrollDestroy () {
// https://github.com/d2-projects/d2-admin/issues/75 // https://github.com/d2-projects/d2-admin/issues/75
try { try {
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
flex-box="0" flex-box="0"
flex="dir:top main:center cross:center" flex="dir:top main:center cross:center"
@click.self="handlePanelClick"> @click.self="handlePanelClick">
<d2-icon-svg <!-- <d2-icon-svg
class="panel-search__logo" class="panel-search__logo"
name="d2-admin-text"/> name="d2-admin-text"/> -->
<img src="./image/logo.png" alt="">
<el-autocomplete <el-autocomplete
class="panel-search__input" class="panel-search__input"
ref="input" ref="input"
......
<template> <template>
<div class="personal-panel"> <div class="personal-panel">
<div class="personal-desc" > <div class="personal-desc">
<div class="avatar-container"> <div class="avatar-container">
<avatar :username="user.name"></avatar> <el-avatar
<!-- <img class="avatar" :src="require('@/assets/user.png')" /> --> :size="'large'"
</div> :src="'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'"
<div class="name-role"> ></el-avatar>
<span class="sender">{{ user.name }} - {{ user.role||'超级管理员' }}</span> </div>
</div> <div class="name-role">
<div class="registe-info"> <span class="sender">{{ user.name }} - {{ user.role||'超级管理员' }}</span>
<span class="registe-info"> </div>
<li class="fa fa-clock-o"></li> <div class="registe-info">
注册时间:{{ user.registeInfo|| '2019-08-08' }} <span class="registe-info">
</span> <li class="fa fa-clock-o"></li>
</div> 注册时间:{{ user.registeInfo|| '2019-08-08' }}
</span>
</div>
</div> </div>
<!-- <div class="personal-relation"> <!-- <div class="personal-relation">
<span class="relation-item">followers</span> <span class="relation-item">followers</span>
<span class="relation-item">watches</span> <span class="relation-item">watches</span>
<span class="relation-item">friends</span> <span class="relation-item">friends</span>
</div> --> </div>-->
<div class="main-operation"> <div class="main-operation">
<span class="main-operation-item"> <span class="main-operation-item">
<el-button size="small" icon="fa fa-male" @click="openUserMsgDialog()"> 个人中心</el-button> <el-button size="small" icon="fa fa-male" @click="openUserMsgDialog()">个人中心</el-button>
</span> </span>
<span class="main-operation-item"> <span class="main-operation-item">
<el-button size="small" icon="fa fa-key"> 修改密码</el-button> <el-button size="small" icon="fa fa-key">修改密码</el-button>
</span> </span>
</div> </div>
<div class="other-operation"> <div class="other-operation" @click="clear">
<div class="other-operation-item"> <div class="other-operation-item">
<li class="fa fa-eraser"></li> <i class="fa fa-eraser"></i>
清除缓存 清除缓存
</div> </div>
<!-- <div class="other-operation-item">
<li class="fa fa-user"></li>
在线人数
</div>
<div class="other-operation-item">
<li class="fa fa-bell"></li>
访问次数
</div>
<div class="other-operation-item" @click="showBackupDialog">
<li class="fa fa-undo"></li>
{{$t("common.backupRestore")}}
</div> -->
</div> </div>
<div class="personal-footer" @click="logout"> <div class="personal-footer" @click="logOut">
<li class="fa fa-sign-out"></li> <i class="fa fa-sign-out"></i>
注销 注销
</div> </div>
<!--备份还原界面--> <!--备份还原界面-->
<!-- <backup ref="backupDialog" @afterRestore="afterRestore"></backup> --> <!-- <backup ref="backupDialog" @afterRestore="afterRestore"></backup> -->
</div> </div>
</template> </template>
<script> <script>
import Cookies from 'js-cookie' import { mapState, mapActions } from 'vuex'
// import Backup from "@/views/Backup/Backup" import { Message, MessageBox } from 'element-ui'
import Avatar from 'vue-avatar'
export default { export default {
name: 'PersonalPanel', name: 'PersonalPanel',
components: {
// Backup
Avatar
},
props: { props: {
user: { user: {
type: Object, type: Object,
...@@ -77,51 +61,78 @@ export default { ...@@ -77,51 +61,78 @@ export default {
} }
} }
}, },
computed: {
...mapState('d2admin/user', ['info'])
},
data () { data () {
return { return {}
}
}, },
methods: { methods: {
// 退出登录 ...mapActions('d2admin/account', ['logout']),
logout: function () { /**
this.$confirm('确认退出吗?', '提示', { * @description 登出
*/
logOut () {
this.$store.commit('d2admin/gray/set', true)
MessageBox.confirm('确定要注销当前用户吗', '注销用户', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(async () => {
await this.$store.commit('d2admin/gray/set', false)
// await this.$store.dispatch('d2admin/user/set', {})
await this.logout()
this.$router.push('/login')
}) })
.then(() => { .catch(() => {
sessionStorage.removeItem('user') this.$store.commit('d2admin/gray/set', false)
this.deleteCookie('token') Message({
this.$router.push('/login') message: '取消注销操作'
this.$api.login.logout().then((res) => {
}).catch(function (res) {
}) })
}) })
.catch(() => {})
}, },
// 删除cookie clear () {
deleteCookie: function (name) { this.$store.commit('d2admin/gray/set', true)
Cookies.remove(name) MessageBox.confirm('清空缓存将重置所有个性化设置并退出到登录界面', '清空缓存', {
}, confirmButtonText: '确定',
// 打开备份还原界面 cancelButtonText: '取消',
showBackupDialog: function () { type: 'warning'
this.$refs.backupDialog.setBackupVisible(true) }).then(async () => {
await this.$store.commit('d2admin/gray/set', false)
localStorage.clear();
window.location.reload()
})
.catch(() => {
this.$store.commit('d2admin/gray/set', false)
Message({
message: '取消清除缓存操作'
})
})
}, },
// 成功还原之后,重新登录 comfirm (text, title, cancleText) {
afterRestore: function () { return new Promise((reject, resolve) => {
this.$refs.backupDialog.setBackupVisible(false) this.$store.commit('d2admin/gray/set', true)
sessionStorage.removeItem('user') MessageBox.confirm(text, title, {
this.deleteCookie('token') confirmButtonText: '确定',
this.$router.push('/login') cancelButtonText: '取消',
this.$api.login.logout().then((res) => { type: 'warning'
}).catch(function (res) { }).then(async () => {
await this.$store.commit('d2admin/gray/set', false)
resolve(true)
})
.catch(() => {
this.$store.commit('d2admin/gray/set', false)
Message({
message: cancleText
})
reject()
})
}) })
}, },
// 打开个人信息弹出框 // 打开个人信息弹出框
openUserMsgDialog: function () { openUserMsgDialog: function () {
console.log('aaaa') console.log('aaaa')
} }
},
mounted () {
} }
} }
</script> </script>
...@@ -147,9 +158,9 @@ export default { ...@@ -147,9 +158,9 @@ export default {
height: 80px; height: 80px;
border-radius: 90px; border-radius: 90px;
} }
.avatar-container{ .avatar-container {
display:inline-block; display: inline-block;
align:center; text-align: center;
} }
.name-role { .name-role {
font-size: 14px; font-size: 14px;
...@@ -180,7 +191,7 @@ export default { ...@@ -180,7 +191,7 @@ export default {
margin: 4px; margin: 4px;
} }
.other-operation { .other-operation {
padding: 15px; padding: 10px;
margin-right: 1px; margin-right: 1px;
text-align: left; text-align: left;
border-color: rgba(180, 190, 190, 0.2); border-color: rgba(180, 190, 190, 0.2);
...@@ -188,7 +199,7 @@ export default { ...@@ -188,7 +199,7 @@ export default {
border-top-style: solid; border-top-style: solid;
} }
.other-operation-item { .other-operation-item {
padding:0 12px; padding: 4px 8px;
} }
.other-operation-item:hover { .other-operation-item:hover {
cursor: pointer; cursor: pointer;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
}" }"
flex-box="0" flex-box="0"
flex> flex>
<div class="logo-group" :style="{width: asideCollapse ? asideWidthCollapse : asideWidth}" flex-box="0"> <div class="logo-group d2-theme-header-logo" :class="asideCollapse ? 'logo-only' : 'logo-all'" flex-box="0">
<img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`"> <img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
<img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`"> <img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
</div> </div>
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<div class="d2-header-right" flex-box="0"> <div class="d2-header-right" flex-box="0">
<!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" --> <!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" -->
<d2-header-search @click="handleSearchClick"/> <d2-header-search @click="handleSearchClick"/>
<d2-header-log /> <d2-header-log v-if="$env === 'development'"/>
<!-- <d2-header-size /> --> <d2-header-size/>
<d2-header-fullscreen/> <d2-header-fullscreen/>
<d2-header-locales /> <d2-header-locales v-if="$env === 'development'"/>
<d2-header-theme/> <d2-header-theme/>
<d2-header-color/> <d2-header-color/>
<d2-header-user/> <d2-header-user/>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<d2-menu-side/> <d2-menu-side/>
</div> </div>
<!-- 主体 --> <!-- 主体 -->
<div class="d2-theme-container-main" flex-box="1" flex> <div class="d2-theme-container-main" :class="this.searchActive ? 'is-search' : ''" flex-box="1" flex>
<!-- 搜索 --> <!-- 搜索 -->
<transition name="fade-scale"> <transition name="fade-scale">
<div v-if="searchActive" class="d2-theme-container-main-layer" flex> <div v-if="searchActive" class="d2-theme-container-main-layer" flex>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</div> </div>
<!-- 页面 --> <!-- 页面 -->
<div class="d2-theme-container-main-body" flex-box="1"> <div class="d2-theme-container-main-body" flex-box="1">
<transition :name="transitionActive ? 'fade-transverse' : ''" mode="in-out"> <transition :name="transitionActive ? 'el-fade-in' : ''" mode="linear">
<keep-alive :include="keepAlive"> <keep-alive :include="keepAlive">
<router-view/> <router-view/>
</keep-alive> </keep-alive>
...@@ -125,6 +125,8 @@ export default { ...@@ -125,6 +125,8 @@ export default {
asideWidthCollapse: '65px' asideWidthCollapse: '65px'
} }
}, },
mounted () {
},
computed: { computed: {
...mapState('d2admin', { ...mapState('d2admin', {
keepAlive: state => state.page.keepAlive, keepAlive: state => state.page.keepAlive,
...@@ -163,4 +165,20 @@ export default { ...@@ -163,4 +165,20 @@ export default {
<style lang="scss"> <style lang="scss">
// 注册主题 // 注册主题
@import '~@/assets/style/theme/register.scss'; @import '~@/assets/style/theme/register.scss';
.d2-theme-header-logo{
}
.logo-all{
width: 200px;
img{
height: 75px !important;
transform: translate3d(-8px, -6px, 0) !important;
}
}
.logo-only{
width:65px;
img{
height: 35px !important;
transform: translate3d(0px,12px,0) !important;
}
}
</style> </style>
...@@ -82,28 +82,28 @@ util.deepFind = function (menus, id) { ...@@ -82,28 +82,28 @@ util.deepFind = function (menus, id) {
* @param {*} alpha 透明度 * @param {*} alpha 透明度
*/ */
util.colorToRgb = (sColor, alpha) => { util.colorToRgb = (sColor, alpha) => {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
sColor = sColor.toLowerCase() sColor = sColor.toLowerCase()
if (sColor && reg.test(sColor)) { if (sColor && reg.test(sColor)) {
if (sColor.length === 4) { if (sColor.length === 4) {
var sColorNew = '#' var sColorNew = '#'
for (var i = 1; i < 4; i += 1) { for (var i = 1; i < 4; i += 1) {
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1)) sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
} }
sColor = sColorNew sColor = sColorNew
} }
// 处理六位的颜色值 // 处理六位的颜色值
var sColorChange = [] var sColorChange = []
for (let i = 1; i < 7; i += 2) { for (let i = 1; i < 7; i += 2) {
sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2))) sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
} }
if (alpha || alpha === 0 || alpha === '0') { if (alpha || alpha === 0 || alpha === '0') {
return `rgba(${sColorChange.join(',')} ,${alpha})` return `rgba(${sColorChange.join(',')} ,${alpha})`
} }
return `rgb(${sColorChange.join(',')})` return `rgb(${sColorChange.join(',')})`
} else { } else {
return sColor return sColor
} }
} }
export default util export default util
...@@ -14,23 +14,23 @@ permision.packRoutesBtns = function (resources, idsInPermision) { ...@@ -14,23 +14,23 @@ permision.packRoutesBtns = function (resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) { if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误') throw new Error('参数错误')
} }
let __aRouteInPermision = [], let __aRouteInPermision = []
__oBtnInPermision = {}, let __oBtnInPermision = {}
// __aBtnIdAll=[], // __aBtnIdAll=[],
__objResource = null let __objResource = null
idsInPermision.forEach(obj => { idsInPermision.forEach(obj => {
__objResource = resources[obj.id] __objResource = resources[obj.id]
if(__objResource){//直接能取到的为路由 (也可以在routes 中定标识变量) if (__objResource) { // 直接能取到的为路由 (也可以在routes 中定标识变量)
__aRouteInPermision.push(resources[obj.id])//push 进 路由数组 __aRouteInPermision.push(resources[obj.id])// push 进 路由数组
}else{ //如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量) } else { // 如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量)
__objResource = resources[obj.pid] __objResource = resources[obj.pid]
if(__objResource && __objResource.auth && !__oBtnInPermision[obj.pid]){ if (__objResource && __objResource.auth && !__oBtnInPermision[obj.pid]) {
__oBtnInPermision[obj.pid]=__objResource.auth __oBtnInPermision[obj.pid] = __objResource.auth
// __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)]) // __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)])
} }
} }
}) })
return {'route':__aRouteInPermision,'btn':__oBtnInPermision} return { 'route': __aRouteInPermision, 'btn': __oBtnInPermision }
} }
/** /**
...@@ -49,12 +49,12 @@ permision.packAsideMenus = function (resources, idsInPermision) { ...@@ -49,12 +49,12 @@ permision.packAsideMenus = function (resources, idsInPermision) {
*/ */
idsInPermision.forEach(obj => { idsInPermision.forEach(obj => {
const __oMenu = permision.format2Menu(resources[obj.id]) const __oMenu = permision.format2Menu(resources[obj.id])
if(!__oMenu){ //不存在 可能是 按钮 直接继续循环 if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true return true
} }
if (obj.pid === '0') {//取出1级菜单 if (obj.pid === '0') { // 取出1级菜单
__aMenusInPermision.push(__oMenu) __aMenusInPermision.push(__oMenu)
} else {//取出子菜单 } else { // 取出子菜单
__aSub.push(__oMenu) __aSub.push(__oMenu)
} }
}) })
...@@ -77,7 +77,7 @@ permision.packAsideMenus = function (resources, idsInPermision) { ...@@ -77,7 +77,7 @@ permision.packAsideMenus = function (resources, idsInPermision) {
* 格式化菜单 封装成系统所需格式 * 格式化菜单 封装成系统所需格式
*/ */
permision.format2Menu = function (oMenu) { permision.format2Menu = function (oMenu) {
if(!oMenu) return null if (!oMenu) return null
const { icon, path, meta } = oMenu const { icon, path, meta } = oMenu
const { title, id, pid } = meta const { title, id, pid } = meta
return { title, icon, path, id, pid } return { title, icon, path, id, pid }
......
...@@ -7,39 +7,37 @@ import d2Admin from '@/plugin/d2admin' ...@@ -7,39 +7,37 @@ import d2Admin from '@/plugin/d2admin'
// store // store
import store from '@/store/index' import store from '@/store/index'
import D2Crud from '@d2-projects/d2-crud' // import D2Crud from '@d2-projects/d2-crud'
// 菜单和路由设置 // 菜单和路由设置
import router from './router' import router from './router'
// import menuHeader from '@/menu/header' // import menuHeader from '@/menu/header'
// import menuAside from '@/menu/aside' // import menuAside from '@/menu/aside'
// import { frameInRoutes } from '@/router/routes' // import { frameInRoutes } from '@/router/routes'
import echarts from 'echarts'
import VRM from 'vue-role-manager' // import VRM from 'vue-role-manager'
Vue.use(VRM, { // Vue.use(VRM, {
router, // router,
redirect: '403', // redirect: '403',
enabled: false // enabled: false
}) // })
// 核心插件 // 核心插件
Vue.use(d2Admin) Vue.use(d2Admin)
Vue.use(D2Crud) // Vue.use(D2Crud)
Vue.prototype.$echarts = echarts
new Vue({ new Vue({
router, router,
store, store,
i18n, i18n,
render: h => h(App), render: h => h(App),
created () { // created () {
// 处理路由 得到每一级的路由设置 // 处理路由 得到每一级的路由设置
// this.$store.commit('d2admin/page/init', frameInRoutes) // this.$store.commit('d2admin/page/init', frameInRoutes)
// 设置顶栏菜单 (暂时不需要) // 设置顶栏菜单 (暂时不需要)
// this.$store.commit('d2admin/menu/headerSet', menuHeader) // this.$store.commit('d2admin/menu/headerSet', menuHeader)
// 设置侧边栏菜单 (TODO 进行过滤) // 设置侧边栏菜单 (TODO 进行过滤)
// this.$store.commit('d2admin/menu/asideSet', menuAside) // this.$store.commit('d2admin/menu/asideSet', menuAside)
// 初始化菜单搜索功能 // 初始化菜单搜索功能
// this.$store.commit('d2admin/search/init', menuHeader) // this.$store.commit('d2admin/search/init', menuHeader)
}, // },
mounted () { mounted () {
// 展示系统信息 // 展示系统信息
this.$store.commit('d2admin/releases/versionShow') this.$store.commit('d2admin/releases/versionShow')
......
// Element // Element
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' // import 'element-ui/lib/theme-chalk/index.css'
// flex 布局库 // flex 布局库
import 'flex.css' import 'flex.css'
// 组件 // 组件
import '@/components' import '@/components'
// svg 图标 // svg 图标
import '@/assets/svg-icons' import '@/assets/svg-icons'
// 指令
import '@/directives'
// 功能插件 // 功能插件
import pluginError from '@/plugin/error' import pluginError from '@/plugin/error'
...@@ -29,7 +31,7 @@ export default { ...@@ -29,7 +31,7 @@ export default {
// 事件传递 // 事件传递
Vue.prototype.$event = new Vue() Vue.prototype.$event = new Vue()
// Element // Element
Vue.use(ElementUI) Vue.use(ElementUI, { size: 'medium', zIndex: 3000 })
// 插件 // 插件
Vue.use(pluginError) Vue.use(pluginError)
Vue.use(pluginLog) Vue.use(pluginLog)
......
...@@ -14,7 +14,7 @@ import routes from './routes' ...@@ -14,7 +14,7 @@ import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push (location) { VueRouter.prototype.push = function push (location) {
return originalPush.call(this, location).catch(err => err) return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err)
} }
Vue.use(VueRouter) Vue.use(VueRouter)
...@@ -39,6 +39,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -39,6 +39,7 @@ router.beforeEach(async (to, from, next) => {
store.commit('d2admin/search/set', false) store.commit('d2admin/search/set', false)
if (from.name === null && to.path !== '/login' && !source) { // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏 if (from.name === null && to.path !== '/login' && !source) { // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
await store.dispatch('d2admin/auth/init') await store.dispatch('d2admin/auth/init')
await store.dispatch('d2admin/account/load')
next(to.path) next(to.path)
} else if (to.matched.some(r => r.meta.auth)) { // 验证当前路由所有的匹配中是否需要有登录验证的 } else if (to.matched.some(r => r.meta.auth)) { // 验证当前路由所有的匹配中是否需要有登录验证的
// 这里暂时将cookie里是否存有token作为验证是否登录的条件 // 这里暂时将cookie里是否存有token作为验证是否登录的条件
...@@ -55,7 +56,6 @@ router.beforeEach(async (to, from, next) => { ...@@ -55,7 +56,6 @@ router.beforeEach(async (to, from, next) => {
redirect: to.fullPath redirect: to.fullPath
} }
}) })
// https://github.com/d2-projects/d2-admin/issues/138
NProgress.done() NProgress.done()
} }
} else { } else {
......
...@@ -17,7 +17,7 @@ const frameIn = [{ ...@@ -17,7 +17,7 @@ const frameIn = [{
* 首页 * 首页
*/ */
export const home = { export const home = {
path: 'index', path: '/index',
name: 'index', name: 'index',
icon: 'desktop', icon: 'desktop',
meta: { meta: {
...@@ -28,10 +28,10 @@ export const home = { ...@@ -28,10 +28,10 @@ export const home = {
}, },
component: _import('systemMonitor') component: _import('systemMonitor')
} }
export const sys =[ export const sys = [
// 系统 前端日志 // 系统 前端日志
{ {
path: 'log', path: '/log',
name: 'log', name: 'log',
meta: { meta: {
title: '前端日志', title: '前端日志',
...@@ -41,7 +41,7 @@ export const sys =[ ...@@ -41,7 +41,7 @@ export const sys =[
}, },
// 刷新页面 必须保留 // 刷新页面 必须保留
{ {
path: 'refresh', path: '/refresh',
name: 'refresh', name: 'refresh',
hidden: true, hidden: true,
component: _import('system/function/refresh') component: _import('system/function/refresh')
...@@ -60,45 +60,48 @@ export const sys =[ ...@@ -60,45 +60,48 @@ export const sys =[
*/ */
export const resources = { export const resources = {
'102': { '102': {
path: 'page', path: '/page',
icon: 'folder-o', icon: 'folder-o',
name: '页面', name: '页面',
meta: { meta: {
auth: true, auth: true,
title: '页面', title: '页面',
id: '102', id: '102',
pid: '0' pid: '0',
cache: true
} }
}, },
'10201': { '10201': {
path: '/page1', path: '/page1',
name: '页面 1', name: 'page1',
meta: { meta: {
auth: true, auth: true,
title: '页面 1', title: '页面 1',
id: '10201', id: '10201',
pid: '102' pid: '102',
cache: true
}, },
component: _import('demo/page1') component: _import('demo/page1')
}, },
'10202': { '10202': {
path: '/page2', path: '/page2',
name: '页面 2', name: 'page2',
meta: { meta: {
auth: true, auth: true,
title: '页面 2', title: '页面 2',
id: '10202', id: '10202',
pid: '102' pid: '102',
cache: true
}, },
component: _import('demo/page2'), component: _import('demo/page2'),
auth: { auth: {
'operation': [{ // 列表操作 'operation': [{ // 列表操作
id: '1020201', id: '1020201',
pid:'10202', pid: '10202',
label: '查看' label: '查看'
}, { // }, { //
id: '1020202', id: '1020202',
pid:'10202', pid: '10202',
label: '编辑' label: '编辑'
}], }],
'action': [] // 按钮操作 'action': [] // 按钮操作
...@@ -116,11 +119,11 @@ export const resources = { ...@@ -116,11 +119,11 @@ export const resources = {
auth: { auth: {
'operation': [{ // 列表操作 'operation': [{ // 列表操作
id: '1020301', id: '1020301',
pid:'10203', pid: '10203',
label: '查看' label: '查看'
}, { // }, { //
id: '1020302', id: '1020302',
pid:'10203', pid: '10203',
label: '编辑' label: '编辑'
}], }],
'action': [] // 按钮操作 'action': [] // 按钮操作
...@@ -129,7 +132,7 @@ export const resources = { ...@@ -129,7 +132,7 @@ export const resources = {
}, },
// '102': { // '102': {
// path: 'trafficManagement', // path: 'trafficManagement',
// icon: 'folder-o', // icon: 'train',
// name: '车辆管理', // name: '车辆管理',
// meta: { // meta: {
// auth: true, // auth: true,
...@@ -140,8 +143,8 @@ export const resources = { ...@@ -140,8 +143,8 @@ export const resources = {
// component: _import('trafficManagement') // component: _import('trafficManagement')
// }, // },
'103': { '103': {
path: 'subSysManagement', path: '/subSysManagement',
icon: 'folder-o', icon: 'th-list',
name: '子系统管理', name: '子系统管理',
meta: { meta: {
auth: true, auth: true,
...@@ -152,55 +155,55 @@ export const resources = { ...@@ -152,55 +155,55 @@ export const resources = {
component: _import('subSysManagement') component: _import('subSysManagement')
}, },
'104': { '104': {
path: 'trafficManagement', path: '/trafficManagement',
icon: 'folder-o', icon: 'train',
name: '车辆管理', name: '车辆管理',
meta: { meta: {
auth: true, auth: true,
title: '车辆管理', title: '物料管理',
id: '104', id: '104',
pid: '0' pid: '0'
}, },
component: _import('trafficManagement') component: _import('deviceManagement')
}, },
'105': { '105': {
path: 'bb', path: '/bb',
icon: 'folder-o', icon: 'file-text-o',
name: '单据管理', name: '单据管理',
meta: { meta: {
auth: true, auth: true,
title: '单据管理', title: '单据管理',
id: '105', id: '106',
pid: '0' pid: '0'
} }
}, },
'10501': { '10601': {
path: '/cc', path: '/materiaOrderManagement',
icon: 'folder-o', icon: 'archive',
name: '物料订单管理', name: '物料订单管理',
meta: { meta: {
auth: true, auth: true,
title: '物料订单管理', title: '物料订单管理',
id: '10501', id: '10601',
pid: '105' pid: '106'
}, },
component: _import('trafficManagement') component: _import('materiaOrderManagement')
}, },
'10502': { '10602': {
path: '/dd', path: '/maintainManagement',
icon: 'folder-o', icon: 'list-ol',
name: '作业单管理', name: '作业单管理',
meta: { meta: {
auth: true, auth: true,
title: '作业单管理', title: '作业单管理',
id: '10502', id: '10602',
pid: '105' pid: '106'
}, },
component: _import('trafficManagement') component: _import('maintainManagement')
}, },
'107': { '107': {
path: 'user', path: '/user',
icon: 'folder-o', icon: 'users',
name: '用户管理', name: '用户管理',
meta: { meta: {
auth: true, auth: true,
...@@ -212,6 +215,7 @@ export const resources = { ...@@ -212,6 +215,7 @@ export const resources = {
'10701': { '10701': {
path: '/userManage', path: '/userManage',
name: '用户管理', name: '用户管理',
icon: 'user',
meta: { meta: {
auth: true, auth: true,
title: '用户管理', title: '用户管理',
...@@ -223,6 +227,7 @@ export const resources = { ...@@ -223,6 +227,7 @@ export const resources = {
'10702': { '10702': {
path: '/jurisdictionManage', path: '/jurisdictionManage',
name: '权限管理', name: '权限管理',
icon: 'sitemap',
meta: { meta: {
auth: true, auth: true,
title: '权限管理', title: '权限管理',
...@@ -234,6 +239,7 @@ export const resources = { ...@@ -234,6 +239,7 @@ export const resources = {
'10703': { '10703': {
path: '/loginLogs', path: '/loginLogs',
name: '登录日志', name: '登录日志',
icon: 'file-text',
meta: { meta: {
auth: true, auth: true,
title: '登录日志', title: '登录日志',
...@@ -243,8 +249,8 @@ export const resources = { ...@@ -243,8 +249,8 @@ export const resources = {
component: _import('userManage/loginLogs') component: _import('userManage/loginLogs')
}, },
'108': { '108': {
path: 'reportingLogs', path: '/reportingLogs',
icon: 'folder-o', icon: 'upload',
name: '上报日志', name: '上报日志',
meta: { meta: {
auth: true, auth: true,
......
...@@ -32,32 +32,57 @@ export default { ...@@ -32,32 +32,57 @@ export default {
theme: { theme: {
list: [ list: [
{ {
title: 'd2admin 经典', title: 'classic',
name: 'd2', name: 'classic',
preview: 'image/theme/d2/preview@2x.png' color: '#2A58AD',
preview: 'image/theme/classic/preview@2x.png'
}, },
{ {
title: '紫罗兰', title: 'dark',
name: 'violet', name: 'dark',
preview: 'image/theme/violet/preview@2x.png' color: '#314256',
preview: 'image/theme/dark/preview@2x.png'
}, },
{ {
title: '简约线条', title: 'blue',
name: 'line', name: 'blue',
backgroundImage: 'image/theme/line/bg.jpg', color: '#652DED',
preview: 'image/theme/line/preview@2x.png' preview: 'image/theme/blue/preview@2x.png'
}, },
{ {
title: '流星', title: 'plane',
name: 'star', name: 'plane',
backgroundImage: 'image/theme/star/bg.jpg', color: '#377DE7',
preview: 'image/theme/star/preview@2x.png' backgroundImage: 'image/theme/plane/bg.jpg',
}, preview: 'image/theme/plane/preview@2x.png'
{
title: 'Tomorrow Night Blue (vsCode)',
name: 'tomorrow-night-blue',
preview: 'image/theme/tomorrow-night-blue/preview@2x.png'
} }
// {
// title: 'd2admin 经典',
// name: 'd2',
// preview: 'image/theme/d2/preview@2x.png'
// },
// {
// title: '紫罗兰',
// name: 'violet',
// preview: 'image/theme/violet/preview@2x.png'
// },
// {
// title: '简约线条',
// name: 'line',
// backgroundImage: 'image/theme/line/bg.jpg',
// preview: 'image/theme/line/preview@2x.png'
// },
// {
// title: '流星',
// name: 'star',
// backgroundImage: 'image/theme/star/bg.jpg',
// preview: 'image/theme/star/preview@2x.png'
// },
// {
// title: 'Tomorrow Night Blue (vsCode)',
// name: 'tomorrow-night-blue',
// preview: 'image/theme/tomorrow-night-blue/preview@2x.png'
// }
] ]
}, },
// 是否默认开启页面切换动画 // 是否默认开启页面切换动画
......
import { Message, MessageBox } from 'element-ui'
import util from '@/libs/util.js' import util from '@/libs/util.js'
import router from '@/router' import router from '@/router'
import { AccountLogin } from '@api/sys.login' import { AccountLogin } from '@api/sys.account'
export default { export default {
namespaced: true, namespaced: true,
actions: { actions: {
...@@ -32,17 +31,13 @@ export default { ...@@ -32,17 +31,13 @@ export default {
util.cookies.set('uuid', res.uuid) util.cookies.set('uuid', res.uuid)
util.cookies.set('token', res.token) util.cookies.set('token', res.token)
const { user, resources } = res const { user, resources } = res
// const __aRoutesInPermisions= util.permision.packRoutes(sources,resources)
// frameInRoutes[0].children=[dashboard,...__aRoutesInPermisions];
// router.addRoutes(frameInRoutes)
// const __aMenusInPermisions = util.permision.packAsideMenus(sources,resources)
// await commit('d2admin/page/init', frameInRoutes, { root: true })
// await commit('d2admin/menu/asideSet', [dashboard,...__aMenusInPermisions], { root: true })
await dispatch('d2admin/auth/set', resources, { root: true }) await dispatch('d2admin/auth/set', resources, { root: true })
// 设置 vuex 用户信息 // 设置 vuex 用户信息
await dispatch('d2admin/user/set', { await dispatch('d2admin/user/set', {
name: user.name name: user.name
}, { root: true }) }, { root: true })
// 强制初始化基础数据
await dispatch('d2admin/base/init', null, { root: true })
// 用户登录后从持久化数据加载一系列的设置 // 用户登录后从持久化数据加载一系列的设置
await dispatch('load') await dispatch('load')
// 结束 // 结束
...@@ -63,38 +58,15 @@ export default { ...@@ -63,38 +58,15 @@ export default {
/** /**
* @description 注销 * @description 注销
*/ */
async function logout () { return new Promise(async resolve => {
// 删除cookie // 删除cookie
util.cookies.remove('token') util.cookies.remove('token')
util.cookies.remove('uuid') util.cookies.remove('uuid')
// 清空 vuex 用户信息 // 清空 vuex 用户信息
await dispatch('d2admin/user/set', {}, { root: true }) // await dispatch('d2admin/user/clear', null, { root: true })
// 跳转路由 // 跳转路由
router.push({ resolve()
name: 'login' })
})
}
// 判断是否需要确认
if (confirm) {
commit('d2admin/gray/set', true, { root: true })
MessageBox.confirm('确定要注销当前用户吗', '注销用户', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
commit('d2admin/gray/set', false, { root: true })
logout()
})
.catch(() => {
commit('d2admin/gray/set', false, { root: true })
Message({
message: '取消注销操作'
})
})
} else {
logout()
}
}, },
/** /**
* @description 用户登录后从持久化数据加载一系列的设置 * @description 用户登录后从持久化数据加载一系列的设置
...@@ -112,8 +84,13 @@ export default { ...@@ -112,8 +84,13 @@ export default {
await dispatch('d2admin/page/openedLoad', null, { root: true }) await dispatch('d2admin/page/openedLoad', null, { root: true })
// DB -> store 持久化数据加载侧边栏折叠状态 // DB -> store 持久化数据加载侧边栏折叠状态
await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true }) await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true })
// await dispatch('d2admin/size/set', 'medium', { root: true })
// DB -> store 持久化数据加载全局尺寸 // DB -> store 持久化数据加载全局尺寸
await dispatch('d2admin/size/load', null, { root: true }) await dispatch('d2admin/size/load', null, { root: true })
// DB - > 初始化 基础数据
// await dispatch('d2admin/base/init', null, { root: true })
// // store 设置系统主色
// await dispatch('d2admin/color/set', process.env.VUE_APP_MAIN_COLOR)
// 后台接口 -> store // 后台接口 -> store
// await dispatch('d2admin/auth/init', null, { root: true }) // await dispatch('d2admin/auth/init', null, { root: true })
// end // end
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-27 17:25:12 * @Date: 2019-08-27 17:25:12
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-08-29 00:53:59 * @Last Modified time: 2019-09-01 19:00:46
*/ */
import util from '@/libs/util.js' import util from '@/libs/util.js'
import router from '@/router' import router from '@/router'
import { resources as sources, home, frameInRoutes,sys } from '@/router/routes' import { resources as sources, home, frameInRoutes, sys } from '@/router/routes'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
source:null, source: null,
meta:{}, meta: {},
btns:{}, btns: {},
btnIdAll:[] btnIdAll: []
}, },
getters: { getters: {
/** /**
...@@ -39,16 +39,16 @@ export default { ...@@ -39,16 +39,16 @@ export default {
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
curBtns(state){ curBtns (state) {
return state.btns[state.meta.id] return state.btns[state.meta.id]
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
btnIdAll(state){ btnIdAll (state) {
return state.btnIdAll return state.btnIdAll
} }
}, },
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
return new Promise(async resolve => { return new Promise(async resolve => {
// 设置数据 // 设置数据
dispatch('d2admin/db/set', { dispatch('d2admin/db/set', {
dbName: 'sys', dbName: 'database',
path: 'source', path: 'source',
value: state.source, value: state.source,
user: true user: true
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
return new Promise(async resolve => { return new Promise(async resolve => {
if (!state.source) { if (!state.source) {
state.source = await dispatch('d2admin/db/get', { state.source = await dispatch('d2admin/db/get', {
dbName: 'sys', dbName: 'database',
path: 'source', path: 'source',
user: true user: true
}, { root: true }) }, { root: true })
...@@ -118,8 +118,8 @@ export default { ...@@ -118,8 +118,8 @@ export default {
// 获取权限资源点 // 获取权限资源点
const __source = await dispatch('load') const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由 // 过滤资源点 并动态添加到路由
const { route,btn } = util.permision.packRoutesBtns(sources, __source) const { route, btn } = util.permision.packRoutesBtns(sources, __source)
frameInRoutes[0].children = [home, ...route,...sys] frameInRoutes[0].children = [home, ...route, ...sys]
router.addRoutes(frameInRoutes) router.addRoutes(frameInRoutes)
state.btns = btn state.btns = btn
await commit('d2admin/page/init', frameInRoutes, { root: true }) await commit('d2admin/page/init', frameInRoutes, { root: true })
......
/*
* @Author: limin
* @Date: 2019-09-01 17:56:57
* @Last Modified by: limin
* @Last Modified time: 2019-09-01 18:57:45
*/
import { FetchRoleList, CompanyList, DepartList, StationList } from '@/api/sys.base'
import { BaseData } from '@/common/constants'
const map = {
[BaseData.ROLE]: FetchRoleList,
[BaseData.COMPANY]: CompanyList,
[BaseData.DEPART]: DepartList,
[BaseData.STATION]: StationList
}
export default {
namespaced: true,
state: {
// 所属公司
company: [],
// 角色
role: [],
// 部门
depart: [],
// 站点
station: []
},
actions: {
/**
* 初始化获取 基础数据 并 前端持久化
* 每次登录会强制 初始化
* @param {*} param0
*/
init ({ state, dispatch, commit }) {
return new Promise(async resolve => {
Promise.all([
FetchRoleList(),
CompanyList(),
DepartList(),
StationList()
]).then( async ([role, company, depart, station] = res) => {
state.role = role
state.station = station
state.depart = depart
state.company = company
await dispatch('save2db', {path: `base`,value: {role, company, depart, station}})
resolve({ role, company, depart, station })
})
})
},
/**
* 根据名字获取基础数据
* 获取步骤:
* 内存 -> 前端持久化数据库 -> 后台接口
* @param {*} param0
* @param {*} name 名称 state 中的任意一个 强烈建议 使用 @/common/constants/BaseData 中的常量 便于灵活修改
*/
get ({ state, dispatch }, name) {
return new Promise(async resolve => {
let __data = state[name]
if (!__data.length) {
__data = await dispatch('getFromdb', `base.${name}`) || await dispatch('getFromAjax', name)
state[name] = __data
await dispatch('save2db', {path: `base.${name}`,value: __data})
}
resolve(__data)
})
},
/**
* 获取所有基础数据
* 获取步骤:
* 内存 -> 前端持久化数据库 -> 后台接口
* @param {*} param0
*/
load ({ state,dispatch }) {
return new Promise(async resolve => {
if (state.role.length === 0) {
state = await dispatch('getFromdb','base') || await dispatch('init')
}
const {role, company, depart, station} = state
resolve({role, company, depart, station})
})
},
/**
* 内部方法 从前端持久化数据库 获取指定数据
* @param {*} param0
* @param {*} path 数据 路径
*/
getFromdb ({ dispatch }, path) {
return new Promise(async resolve => {
const value = await dispatch('d2admin/db/get', {
dbName: 'database',
path,
user: true
}, { root: true })
resolve(value)
})
},
/**
* 内部方法 前端持久化 一个 数据
* @param {*} param0
* @param {*} param1 value 需要持久化的数据 path 需要持久化的数据路径
*/
save2db ({ dispatch }, {value,path}) {
return new Promise(async resolve => {
await dispatch('d2admin/db/set', {
dbName: 'database',
path,
value,
user: true
}, { root: true })
resolve(value)
})
},
/**
* 从后端获取一个数据
* @param {*} param0
* @param {*} name @/common/constants/BaseData 中的常量
*/
getFromAjax ({ state, dispatch, commit }, name) {
return new Promise(async resolve => {
const value = await map[name]()
resolve(value)
})
}
},
mutations: {
}
}
...@@ -5,7 +5,7 @@ export default { ...@@ -5,7 +5,7 @@ export default {
namespaced: true, namespaced: true,
state: { state: {
// 尺寸 // 尺寸
value: '' // medium small mini value: 'medium' // medium small mini
}, },
actions: { actions: {
/** /**
......
...@@ -53,10 +53,12 @@ export default { ...@@ -53,10 +53,12 @@ export default {
user: true user: true
}, { root: true }) }, { root: true })
// 检查这个主题在主题列表里是否存在 // 检查这个主题在主题列表里是否存在
if (state.list.find(e => e.name === activeName)) { let __theme = state.list.find(e => e.name === activeName)
if (__theme) {
state.activeName = activeName state.activeName = activeName
} else { } else {
state.activeName = state.list[0].name __theme = state.list[0]
state.activeName = __theme.name
// 持久化 // 持久化
await dispatch('d2admin/db/set', { await dispatch('d2admin/db/set', {
dbName: 'sys', dbName: 'sys',
...@@ -65,6 +67,8 @@ export default { ...@@ -65,6 +67,8 @@ export default {
user: true user: true
}, { root: true }) }, { root: true })
} }
// 设置ui 颜色
await dispatch('d2admin/color/set', __theme.color, { root: true })
// 将 vuex 中的主题应用到 dom // 将 vuex 中的主题应用到 dom
commit('dom') commit('dom')
// end // end
......
...@@ -41,6 +41,13 @@ export default { ...@@ -41,6 +41,13 @@ export default {
// end // end
resolve() resolve()
}) })
},
clear ({ state, dispatch }) {
return new Promise(async resolve => {
await dispatch('set', {})
resolve()
})
} }
} }
} }
<template>
<div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>
...@@ -43,26 +43,25 @@ ...@@ -43,26 +43,25 @@
<auth-button label="查看" @e-auth-click="handleClick(scope.row)"/> <auth-button label="查看" @e-auth-click="handleClick(scope.row)"/>
<auth-button label="编辑" @e-auth-click="handleClick(scope.row)"/> <auth-button label="编辑" @e-auth-click="handleClick(scope.row)"/>
<auth-button label="看不见我" @e-auth-click="handleClick(scope.row)"/> <auth-button label="看不见我" @e-auth-click="handleClick(scope.row)"/>
<el-button label="222222" v-auth></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-input v-model="testCache" type="text"></el-input>
</d2-container> </d2-container>
</template> </template>
<script> <script>
export default { export default {
name: 'page2',
methods: { methods: {
handleClick (row) { handleClick (row) {
alert(JSON.stringify(row)) alert(JSON.stringify(row))
} }
}, },
components: {
},
mounted () {
},
data () { data () {
return { return {
testCache: '',
btn: { btn: {
lable: '测试', lable: '测试',
action: 'test' action: 'test'
......
<!-- 编辑物料弹窗 -->
<template>
<div>
<el-dialog
title="编辑物料"
:visible.sync="isVisible"
:before-close="handleClose"
>
<el-form
:model="editForm"
:rules="rules"
ref="editRuleForm"
label-width="100px"
>
<el-form-item
label="物料代码"
prop="deviceNum">
<el-input
:disabled="disabled" v-model="editForm.deviceNum" placeholder="请输入物料代码" clearable
></el-input>
</el-form-item>
<el-form-item
label="物料编码"
prop="deviceCode">
<el-input
:disabled="disabled" v-model="editForm.deviceCode" placeholder="请输入物料编码" clearable
></el-input>
</el-form-item>
<el-form-item
label="CRC物料号"
prop="crcCode">
<el-input
:disabled="disabled" v-model="editForm.crcCode" placeholder="请输入CRC物料号" clearable
></el-input>
</el-form-item>
<el-form-item
label="图号"
prop="drawNum">
<el-input
:disabled="disabled" v-model="editForm.drawNum" placeholder="请输入图号" clearable
></el-input>
</el-form-item>
<el-form-item
label="物料名称"
prop="deviceName">
<el-input
:disabled="disabled" v-model="editForm.deviceName" placeholder="请输入物料名称" clearable
></el-input>
</el-form-item>
<el-form-item
label="规格"
prop="specifications">
<el-input
:disabled="disabled" v-model="editForm.specifications" placeholder="请输入规格" clearable
></el-input>
</el-form-item>
<el-form-item label="所在地" prop="stationName">
<el-select v-model="editForm.stationName" placeholder="请选择所在地" clearable filterable>
<el-option label="仓库" value="1"></el-option>
<el-option label="广州站" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="库存数量"
prop="stockCount">
<el-input
:disabled="disabled" v-model="editForm.stockCount" placeholder="请输入库存数量" clearable
></el-input>
</el-form-item>
<el-form-item
label="责任人"
prop="responsible">
<el-input
:disabled="disabled" v-model="editForm.responsible" placeholder="请输入责任人" clearable
></el-input>
</el-form-item>
</el-form>
<div slot="footer">
<el-button
type="primary"
@click="handleConfirm"
>保存</el-button>
<el-button
@click="handleClose"
>取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'EditDialog',
data () {
return {
disabled: false,
rules: {
deviceNum: [
{ required: true, message: '请输入物料代码', trigger: 'blur' }
],
deviceCode: [
{ required: true, message: '请输入物料编码', trigger: 'blur' }
],
crcCode: [
{ required: true, message: '请输入CRC物料号', trigger: 'blur' }
],
drawNum: [
{ required: true, message: '请输入图号', trigger: 'blur' }
],
deviceName: [
{ required: true, message: '请输入物料名称', trigger: 'blur' }
],
specifications: [
{ required: true, message: '请输入规格', trigger: 'blur' }
],
stationName: [
{ required: true, message: '请选择所在地', trigger: 'change' }
],
stockCount: [
{ required: true, message: '请输入库存数量', trigger: 'blur' }
],
responsible: [
{ required: true, message: '请输入责任人', trigger: 'blur' }
]
}
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
editForm: Object
},
watch: {
isVisible (val) {
// this.disabled = this.editForm.trafficCode ? true : false
this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields()
}
},
mounted () {},
methods: {
handleClose () {
this.$emit('closeDialog')
},
handleConfirm () {
this.$refs.editRuleForm.validate((vaild) => {
if (vaild) {
this.$emit('confirmDialog')
}
})
}
}
}
</script>
<style scoped>
</style>
<!-- 物料管理 -->
<template>
<d2-container>
<el-form
:inline="true"
:model="searchForm"
label-width="85px"
>
<el-form-item label="物料">
<el-input v-model="searchForm.keyWord" placeholder="请输入物料代码/编码/名称" clearable></el-input>
</el-form-item>
<el-form-item label="所在地">
<el-select v-model="searchForm.stationCode" placeholder="请选择所在地" clearable filterable>
<el-option value="1" label="仓库"></el-option>
<el-option value="2" label="广州站"></el-option>
</el-select>
</el-form-item>
<el-form-item label="责任人">
<el-select v-model="searchForm.responsible" placeholder="请选择责任人" clearable filterable>
<el-option value="1" label="张三"></el-option>
<el-option value="2" label="李四"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<el-row style="height: 40px; line-height: 40px">
<el-col :span="12">物料列表</el-col>
<el-col :span="12" style="text-align: right">
<el-button class="import-button" style="">导入
<input
type="file"
class="import-input"
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@change="importFile($event)" />
</el-button>
<el-button>导出</el-button>
</el-col>
</el-row>
<el-table
:data="tableData"
v-loading="tableLoading"
border
style="margin: 20px 0;"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<!-- <template slot-scope="scope">
<template v-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template> -->
</el-table-column>
<el-table-column
align="center"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
@click="handleEdit(scope.row, scope.$index)"
>编辑</el-button>
<el-button
type="text"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
></edit-dialog>
</d2-container>
</template>
<script>
import EditDialog from './editDialog'
import { getListApi, editApi, removeApi, importApi, exportApi } from '@api/deviceManagement'
import notice from '@/common/notice'
export default {
name: 'deviceManagement',
components: {
EditDialog
},
data () {
return {
// 编辑弹窗
editVisible: false,
editForm: {
id: '',
deviceNum: '',
deviceCode: '',
crcCode: '',
drawNum: '',
deviceName: '',
specifications: '',
stationCode: '',
stationName: '',
stockCount: '',
responsible: ''
},
// 搜索
searchForm: {
keyWord: '',
stationCode: '',
responsible: ''
},
// 表格
tableLoading: false,
tableData: [],
tableColumns: [{
label: '物料代码',
prop: 'deviceNum'
}, {
label: '物料编码',
prop: 'deviceCode'
}, {
label: 'CRC物料号',
prop: 'crcCode'
}, {
label: '图号',
prop: 'drawNum'
}, {
label: '物料名称',
prop: 'deviceName'
}, {
label: '规格',
prop: 'specifications'
}, {
label: '所在地',
prop: 'stationName'
}, {
label: '库存',
prop: 'stockCount'
}, {
label: '责任人',
prop: 'responsible'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30
}
},
mounted () {
this.loadingGetList()
},
methods: {
loadingGetList () {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams () {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
this.tableLoading = false
})
},
editDevice (params) {
editApi(params).then(res => {
// console.log(res)
this.handleEditClose()
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
},
// 导入
importFile (e) {
const params = {
file: e.target.files[0]
}
console.log(params)
importApi(params).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
})
},
/* 接口请求-end */
// 搜索
handleSearch () {
console.log(this.searchForm)
this.loadingGetList()
},
// 页码
handleSizeChange (value) {
// console.log(value)
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange (value) {
// console.log(value)
this.currentPage = value
// 调接口
this.loadingGetList()
},
handleEditClose () {
this.editVisible = !this.editVisible
},
handleEditConfirm () {
// console.log(JSON.parse(JSON.stringify(this.editForm)))
var editParams = JSON.parse(JSON.stringify(this.editForm))
this.editDevice(editParams)
},
// 表格-编辑
handleEdit (row, index = -1) {
// console.log(index)
// console.log(row)
console.log(row)
this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible
},
handleDelete (index, row) {
this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(index)
console.log(row)
this.$message({
type: 'success',
message: '删除成功'
})
}).catch(err => {})
}
}
}
</script>
<style scoped>
.import-button {
width: 70px;
height: 40px;
overflow: hidden;
position: relative;
cursor: pointer;
}
.import-input {
opacity: 0;
position: absolute;
left: 0;
top: 0;
width: 70px;
height: 100%;
cursor: pointer;
font-size:0
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!