Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
SHR
/
tFIMS
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e1190a42
authored
Sep 11, 2019
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
eslint
1 parent
027c59cd
Hide whitespace changes
Inline
Side-by-side
Showing
66 changed files
with
220 additions
and
220 deletions
run.js
src/api/deviceManagement.js
src/api/maintainManagement.js
src/api/materiaOrderManagement.js
src/api/materialList.js
src/api/reportingLogs.js
src/api/subSysManagement.js
src/api/systemMonitor.js
src/api/trafficManagement.js
src/common/notice.js
src/components/d2-container/components/d2-container-card.vue
src/components/d2-container/components/d2-container-ghost.vue
src/components/d2-container/components/mixins/bs.js
src/components/d2-container/index.js
src/components/d2-icon-svg/index.vue
src/directives/src/focus.js
src/i18n.js
src/layout/header-aside/components/contextmenu/components/contentmenuList/index.vue
src/layout/header-aside/components/contextmenu/index.vue
src/layout/header-aside/components/hamburger/index.vue
src/layout/header-aside/components/header-color/index.vue
src/layout/header-aside/components/header-datetime/index.vue
src/layout/header-aside/components/header-locales/index.vue
src/layout/header-aside/components/header-log/index.vue
src/layout/header-aside/components/header-search/index.vue
src/layout/header-aside/components/header-size/index.vue
src/layout/header-aside/components/header-theme/components/d2-theme-list/index.vue
src/layout/header-aside/components/header-theme/index.vue
src/layout/header-aside/components/header-user/index.vue
src/layout/header-aside/components/menu-side/index.js
src/layout/header-aside/components/mixin/menu.js
src/layout/header-aside/components/panel-search/index.vue
src/layout/header-aside/components/personal-panel/personalDialog.vue
src/layout/header-aside/components/tabs/index.vue
src/layout/header-aside/mixins/search.js
src/libs/util.cookies.js
src/libs/util.js
src/libs/util.log.js
src/mock/api/sys.login.js
src/mock/d2-mock/patch/withCredentials.js
src/plugin/axios/index.js
src/plugin/d2admin/index.js
src/plugin/error/index.js
src/plugin/log/index.js
src/plugin/open/index.js
src/router/index.js
src/store/modules/d2admin/modules/auth.js
src/store/modules/d2admin/modules/color.js
src/store/modules/d2admin/modules/fullscreen.js
src/store/modules/d2admin/modules/gray.js
src/store/modules/d2admin/modules/releases.js
src/store/modules/d2admin/modules/search.js
src/store/modules/d2admin/modules/size.js
src/store/modules/d2admin/modules/theme.js
src/store/modules/d2admin/modules/transition.js
src/store/modules/d2admin/modules/tsearch.js
src/store/modules/d2admin/modules/ua.js
src/store/modules/d2admin/modules/user.js
src/views/demo/page1/index.vue
src/views/demo/page2/index.vue
src/views/materialList/index.vue
src/views/reportingLogs/index.vue
src/views/system/function/redirect/index.js
src/views/system/function/refresh/index.js
src/views/system/login/dialogReg.vue
src/views/system/login/index.vue
run.js
View file @
e1190a4
...
...
@@ -3,7 +3,7 @@ var app = express()
app
.
use
(
express
.
static
(
'./dist'
))
app
.
get
(
'/'
,
function
(
req
,
res
)
{
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
send
(
'Hello Vue'
)
})
...
...
src/api/deviceManagement.js
View file @
e1190a4
import
request
from
'./request'
const
path
=
'fims.device.'
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
list`
return
request
(
data
)
}
function
editApi
(
data
)
{
function
editApi
(
data
)
{
data
.
method
=
`
${
path
}
edit`
return
request
(
data
)
}
function
removeApi
(
data
)
{
function
removeApi
(
data
)
{
data
.
method
=
`
${
path
}
remove`
return
request
(
data
)
}
...
...
@@ -22,12 +22,12 @@ function removeApi (data) {
// return request(data, 'post', noSignAttr)
// }
function
exportApi
(
data
)
{
function
exportApi
(
data
)
{
data
.
method
=
`
${
path
}
export`
return
request
(
data
)
}
function
isExistApi
(
data
)
{
function
isExistApi
(
data
)
{
data
.
method
=
`
${
path
}
detail`
return
request
(
data
)
}
...
...
src/api/maintainManagement.js
View file @
e1190a4
...
...
@@ -2,17 +2,17 @@ import request from './request'
const
path
=
'fims.maintains.'
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
list`
return
request
(
data
)
}
function
removeApi
(
data
)
{
function
removeApi
(
data
)
{
data
.
method
=
`
${
path
}
delete`
return
request
(
data
)
}
function
exportApi
(
data
)
{
function
exportApi
(
data
)
{
data
.
method
=
`
${
path
}
export`
return
request
(
data
)
}
...
...
src/api/materiaOrderManagement.js
View file @
e1190a4
...
...
@@ -2,27 +2,27 @@ import request from './request'
const
path
=
'fims.order.'
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
search`
return
request
(
data
)
}
function
detailApi
(
data
)
{
function
detailApi
(
data
)
{
data
.
method
=
`
${
path
}
detail`
return
request
(
data
)
}
function
removeApi
(
data
)
{
function
removeApi
(
data
)
{
data
.
method
=
`
${
path
}
delete`
return
request
(
data
)
}
function
exportApi
(
data
)
{
function
exportApi
(
data
)
{
data
.
method
=
`
${
path
}
export`
return
request
(
data
)
}
function
downloadApi
(
data
)
{
function
downloadApi
(
data
)
{
data
.
method
=
`
${
path
}
download`
return
request
(
data
)
}
...
...
src/api/materialList.js
View file @
e1190a4
...
...
@@ -2,7 +2,7 @@ import request from './request'
const
path
=
'fims.material.'
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
list`
return
request
(
data
)
}
...
...
src/api/reportingLogs.js
View file @
e1190a4
...
...
@@ -2,12 +2,12 @@ import request from './request'
const
path
=
'fims.reportlog.'
function
getLogsApi
(
data
)
{
function
getLogsApi
(
data
)
{
data
.
method
=
`
${
path
}
search`
return
request
(
data
)
}
function
exportApi
(
data
)
{
function
exportApi
(
data
)
{
data
.
method
=
`
${
path
}
export`
return
request
(
data
)
}
...
...
src/api/subSysManagement.js
View file @
e1190a4
...
...
@@ -6,21 +6,21 @@ const methods = {
Edit
:
`
${
path
}
edit`
}
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
list`
return
request
(
data
)
}
function
editApi
(
data
)
{
function
editApi
(
data
)
{
return
request
(
data
)
}
function
removeApi
(
data
)
{
function
removeApi
(
data
)
{
data
.
method
=
`
${
path
}
remove`
return
request
(
data
)
}
function
isExistApi
(
data
)
{
function
isExistApi
(
data
)
{
data
.
method
=
`
${
path
}
detail`
return
request
(
data
)
}
...
...
src/api/systemMonitor.js
View file @
e1190a4
import
request
from
'./request'
const
path
=
'fims.system.'
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
list`
return
request
(
data
)
}
function
reportApi
(
data
)
{
function
reportApi
(
data
)
{
data
.
method
=
`
${
path
}
report`
return
request
(
data
)
}
function
exportApi
(
data
)
{
function
exportApi
(
data
)
{
data
.
method
=
`
${
path
}
export`
return
request
(
data
)
}
...
...
src/api/trafficManagement.js
View file @
e1190a4
...
...
@@ -6,22 +6,22 @@ const methods = {
Edit
:
`
${
path
}
edit`
}
function
getListApi
(
data
)
{
function
getListApi
(
data
)
{
data
.
method
=
`
${
path
}
list`
return
request
(
data
)
}
function
editApi
(
data
)
{
function
editApi
(
data
)
{
// data.method = `${path}edit`
return
request
(
data
)
}
function
removeApi
(
data
)
{
function
removeApi
(
data
)
{
data
.
method
=
`
${
path
}
remove`
return
request
(
data
)
}
function
isExistApi
(
data
)
{
function
isExistApi
(
data
)
{
data
.
method
=
`
${
path
}
detail`
return
request
(
data
)
}
...
...
src/common/notice.js
View file @
e1190a4
...
...
@@ -2,19 +2,19 @@ import Vue from 'vue'
export
default
new
Vue
({
methods
:
{
warningTips
(
message
)
{
warningTips
(
message
)
{
this
.
$notify
({
type
:
'warning'
,
title
:
message
})
},
okTips
(
message
)
{
okTips
(
message
)
{
this
.
$notify
({
type
:
'success'
,
title
:
message
||
'操作成功'
})
},
errorTips
(
message
)
{
errorTips
(
message
)
{
this
.
$notify
({
type
:
'error'
,
title
:
message
||
'操作失败'
...
...
src/components/d2-container/components/d2-container-card.vue
View file @
e1190a4
...
...
@@ -21,11 +21,11 @@ export default {
mixins
:
[
scroll
],
mounted
()
{
mounted
()
{
// 增加滚动事件监听
this
.
addScrollListener
()
},
beforeDestroy
()
{
beforeDestroy
()
{
// 移除滚动事件监听
this
.
removeScrollListener
()
}
...
...
src/components/d2-container/components/d2-container-ghost.vue
View file @
e1190a4
...
...
@@ -19,11 +19,11 @@ export default {
mixins
:
[
scroll
],
mounted
()
{
mounted
()
{
// 增加滚动事件监听
this
.
addScrollListener
()
},
beforeDestroy
()
{
beforeDestroy
()
{
// 移除滚动事件监听
this
.
removeScrollListener
()
}
...
...
src/components/d2-container/components/mixins/bs.js
View file @
e1190a4
...
...
@@ -8,19 +8,19 @@ export default {
default
:
()
=>
({})
}
},
data
()
{
data
()
{
return
{
BS
:
null
}
},
mounted
()
{
mounted
()
{
this
.
scrollInit
()
},
beforeDestroy
()
{
beforeDestroy
()
{
this
.
scrollDestroy
()
},
methods
:
{
scrollInit
()
{
scrollInit
()
{
// 初始化 bs
this
.
BS
=
new
BScroll
(
this
.
$refs
.
wrapper
,
Object
.
assign
({
mouseWheel
:
true
,
...
...
@@ -36,7 +36,7 @@ export default {
y
:
-
y
}))
},
scrollDestroy
()
{
scrollDestroy
()
{
// https://github.com/d2-projects/d2-admin/issues/75
try
{
this
.
BS
.
destroy
()
...
...
@@ -46,11 +46,11 @@ export default {
}
},
// 外部调用的方法 返回顶部
scrollToTop
()
{
scrollToTop
()
{
if
(
this
.
BS
)
this
.
BS
.
scrollTo
(
0
,
0
,
300
)
},
// 手动发出滚动事件
scroll
()
{
scroll
()
{
if
(
this
.
BS
)
{
this
.
$emit
(
'scroll'
,
{
x
:
-
this
.
BS
.
x
,
...
...
src/components/d2-container/index.js
View file @
e1190a4
...
...
@@ -25,7 +25,7 @@ export default {
},
computed
:
{
// 始终返回渲染组件
component
()
{
component
()
{
if
(
this
.
type
===
'card'
&&
!
this
.
betterScroll
)
return
d2ContainerCard
if
(
this
.
type
===
'card'
&&
this
.
betterScroll
)
return
d2ContainerCardBs
if
(
this
.
type
===
'ghost'
&&
!
this
.
betterScroll
)
return
d2ContainerGhost
...
...
@@ -37,7 +37,7 @@ export default {
}
}
},
render
(
h
)
{
render
(
h
)
{
const
slots
=
[
this
.
$slots
.
default
]
if
(
this
.
$slots
.
header
)
slots
.
push
(
h
(
'template'
,
{
slot
:
'header'
},
[
this
.
$slots
.
header
]))
if
(
this
.
$slots
.
footer
)
slots
.
push
(
h
(
'template'
,
{
slot
:
'footer'
},
[
this
.
$slots
.
footer
]))
...
...
@@ -57,14 +57,14 @@ export default {
},
methods
:
{
// 返回顶部
scrollToTop
()
{
scrollToTop
()
{
this
.
$refs
.
component
.
scrollToTop
()
// 如果开启了 better scroll 还需要手动触发一遍 scroll 事件
const
bs
=
this
.
$refs
.
component
.
BS
if
(
bs
)
this
.
$refs
.
component
.
scroll
()
},
// 用法同原生方法 scrollBy
scrollBy
(
x
=
0
,
y
=
0
,
time
=
300
)
{
scrollBy
(
x
=
0
,
y
=
0
,
time
=
300
)
{
if
(
this
.
betterScroll
)
{
const
bs
=
this
.
$refs
.
component
.
BS
if
(
bs
)
{
...
...
@@ -77,7 +77,7 @@ export default {
}
},
// 用法同原生方法 scrollTo
scrollTo
(
x
=
0
,
y
=
0
,
time
=
300
)
{
scrollTo
(
x
=
0
,
y
=
0
,
time
=
300
)
{
if
(
this
.
betterScroll
)
{
const
bs
=
this
.
$refs
.
component
.
BS
if
(
bs
)
{
...
...
@@ -90,7 +90,7 @@ export default {
}
},
// 用法同原生方法 scrollTop
scrollTop
(
top
=
0
,
time
=
300
)
{
scrollTop
(
top
=
0
,
time
=
300
)
{
if
(
this
.
betterScroll
)
{
const
bs
=
this
.
$refs
.
component
.
BS
if
(
bs
)
{
...
...
src/components/d2-icon-svg/index.vue
View file @
e1190a4
...
...
@@ -14,7 +14,7 @@ export default {
}
},
computed
:
{
icon
()
{
icon
()
{
return
`#d2-
${
this
.
name
}
`
}
}
...
...
src/directives/src/focus.js
View file @
e1190a4
...
...
@@ -7,7 +7,7 @@
export
default
{
name
:
'focus'
,
inserted
:
function
(
el
)
{
inserted
:
function
(
el
)
{
el
.
querySelector
(
'input'
).
focus
()
}
}
src/i18n.js
View file @
e1190a4
...
...
@@ -4,7 +4,7 @@ import util from '@/libs/util'
Vue
.
use
(
VueI18n
)
function
loadLocaleMessages
()
{
function
loadLocaleMessages
()
{
const
locales
=
require
.
context
(
'./locales'
,
true
,
/
[
A-Za-z0-9-_,
\s]
+
\.
json$/i
)
const
messages
=
{}
locales
.
keys
().
forEach
(
key
=>
{
...
...
src/layout/header-aside/components/contextmenu/components/contentmenuList/index.vue
View file @
e1190a4
...
...
@@ -30,7 +30,7 @@ export default {
}
},
methods
:
{
rowClick
(
event
)
{
rowClick
(
event
)
{
let
target
=
event
.
target
while
(
!
target
.
dataset
.
value
)
{
target
=
target
.
parentNode
...
...
src/layout/header-aside/components/contextmenu/index.vue
View file @
e1190a4
...
...
@@ -26,18 +26,18 @@ export default {
},
computed
:
{
flag
:
{
get
()
{
get
()
{
if
(
this
.
visible
)
{
// 注册全局监听事件 [ 目前只考虑鼠标解除触发 ]
window
.
addEventListener
(
'mousedown'
,
this
.
watchContextmenu
)
}
return
this
.
visible
},
set
(
newVal
)
{
set
(
newVal
)
{
this
.
$emit
(
'update:visible'
,
newVal
)
}
},
style
()
{
style
()
{
return
{
left
:
this
.
x
+
'px'
,
top
:
this
.
y
+
'px'
,
...
...
@@ -46,12 +46,12 @@ export default {
}
},
methods
:
{
watchContextmenu
(
event
)
{
watchContextmenu
(
event
)
{
if
(
!
this
.
$el
.
contains
(
event
.
target
)
||
event
.
button
!==
0
)
this
.
flag
=
false
window
.
removeEventListener
(
'mousedown'
,
this
.
watchContextmenu
)
}
},
mounted
()
{
mounted
()
{
// 将菜单放置到body下
document
.
querySelector
(
'body'
).
appendChild
(
this
.
$el
)
}
...
...
src/layout/header-aside/components/hamburger/index.vue
View file @
e1190a4
...
...
@@ -24,7 +24,7 @@ export default {
}
},
methods
:
{
click
()
{
click
()
{
this
.
onClick
&&
this
.
onClick
()
}
}
...
...
src/layout/header-aside/components/header-color/index.vue
View file @
e1190a4
...
...
@@ -12,7 +12,7 @@ import { mapState, mapActions } from 'vuex'
export
default
{
name
:
'd2-header-color'
,
data
()
{
data
()
{
return
{
predefine
:
[
'#FF0000'
,
'#008000'
,
'#0000FF'
...
...
@@ -26,11 +26,11 @@ export default {
})
},
watch
:
{
value
(
value
)
{
value
(
value
)
{
this
.
set
(
value
)
}
},
mounted
()
{
mounted
()
{
this
.
predefine
=
[...
this
.
predefine
,
...
this
.
listTheme
.
map
(
theme
=>
theme
.
color
)]
},
methods
:
{
...
...
src/layout/header-aside/components/header-datetime/index.vue
View file @
e1190a4
...
...
@@ -7,20 +7,20 @@ import dayjs from 'dayjs'
const
sFormat
=
'YYYY年MM月DD日'
export
default
{
name
:
'd2-header-datetime'
,
data
()
{
data
()
{
return
{
timeInterval
:
null
,
time
:
dayjs
().
format
(
sFormat
)
}
},
mounted
()
{
mounted
()
{
// this.timeInterval = setInterval(() => this.refreshTime(), 1000);
},
beforeDestroy
()
{
beforeDestroy
()
{
clearInterval
(
this
.
timeInterval
)
},
methods
:
{
refreshTime
()
{
refreshTime
()
{
this
.
time
=
dayjs
().
format
(
sFormat
)
}
}
...
...
src/layout/header-aside/components/header-locales/index.vue
View file @
e1190a4
...
...
@@ -21,14 +21,14 @@
<
script
>
export
default
{
methods
:
{
onChangeLocale
(
command
)
{
onChangeLocale
(
command
)
{
this
.
$i18n
.
locale
=
command
let
message
=
`当前语言:
${
this
.
$t
(
'_name'
)}
[
${
this
.
$i18n
.
locale
}
]`
if
(
!
[
'TRAVIS'
,
'NETLIFY'
].
includes
(
process
.
env
.
VUE_APP_BUILD_MODE
))
{
message
=
[
`当前语言:
${
this
.
$t
(
'_name'
)}
[
${
this
.
$i18n
.
locale
}
]`
,
`仅提供切换功能,没有配置具体的语言数据 `
,
`文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>`
'仅提供切换功能,没有配置具体的语言数据 '
,
'文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>'
].
join
(
'<br/>'
)
}
this
.
$notify
({
...
...
src/layout/header-aside/components/header-log/index.vue
View file @
e1190a4
...
...
@@ -32,7 +32,7 @@ export default {
logLength
:
'log/length'
,
logLengthError
:
'log/lengthError'
}),
tooltipContent
()
{
tooltipContent
()
{
return
this
.
logLength
===
0
?
'没有日志或异常'
:
`
${
this
.
logLength
}
条日志
${
this
.
logLengthError
>
0
...
...
@@ -44,7 +44,7 @@ export default {
...
mapMutations
(
'd2admin/log'
,
[
'clean'
]),
handleClick
()
{
handleClick
()
{
this
.
$router
.
push
({
name
:
'log'
})
...
...
src/layout/header-aside/components/header-search/index.vue
View file @
e1190a4
...
...
@@ -7,7 +7,7 @@
<
script
>
export
default
{
methods
:
{
handleClick
()
{
handleClick
()
{
this
.
$emit
(
'click'
)
}
}
...
...
src/layout/header-aside/components/header-size/index.vue
View file @
e1190a4
...
...
@@ -15,7 +15,7 @@
import
{
mapState
,
mapMutations
,
mapActions
}
from
'vuex'
export
default
{
name
:
'd2-header-size'
,
data
()
{
data
()
{
return
{
options
:
[
{
label
:
'大'
,
value
:
'default'
},
...
...
@@ -37,7 +37,7 @@ export default {
...
mapActions
({
sizeSet
:
'd2admin/size/set'
}),
handleChange
(
value
)
{
handleChange
(
value
)
{
this
.
sizeSet
(
value
)
// this.$notify({
// title: '提示',
...
...
@@ -46,7 +46,7 @@ export default {
// type: 'success'
// })
},
iconName
(
name
)
{
iconName
(
name
)
{
return
name
===
this
.
value
?
'dot-circle-o'
:
'circle-o'
}
}
...
...
src/layout/header-aside/components/header-theme/components/d2-theme-list/index.vue
View file @
e1190a4
...
...
@@ -44,7 +44,7 @@
import
{
mapState
,
mapActions
}
from
'vuex'
export
default
{
name
:
'd2-theme-list'
,
data
()
{
data
()
{
return
{
table
:
{
showHeader
:
false
,
...
...
@@ -63,7 +63,7 @@ export default {
'set'
]),
...
mapActions
(
'd2admin/color'
,
{
setColor
:
'set'
}),
handleSelectTheme
(
row
)
{
handleSelectTheme
(
row
)
{
const
{
name
,
color
}
=
row
this
.
set
(
name
)
this
.
setColor
(
color
)
...
...
src/layout/header-aside/components/header-theme/index.vue
View file @
e1190a4
...
...
@@ -29,7 +29,7 @@ export default {
components
:
{
'd2-theme-list'
:
themeList
},
data
()
{
data
()
{
return
{
dialogVisible
:
false
}
...
...
src/layout/header-aside/components/header-user/index.vue
View file @
e1190a4
...
...
@@ -26,7 +26,7 @@ export default {
components
:
{
PersonalPanel
}
,
mounted
()
{
mounted
()
{
this
.
$event
.
$on
(
'e-password-dialog'
,
res
=>
(
this
.
passVisible
=
res
))
}
,
computed
:
{
...
...
src/layout/header-aside/components/menu-side/index.js
View file @
e1190a4
...
...
@@ -8,7 +8,7 @@ export default {
mixins
:
[
menuMixin
],
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
'div'
,
{
attrs
:
{
class
:
'd2-layout-header-aside-menu-side'
}
},
[
createElement
(
'el-menu'
,
{
props
:
{
collapse
:
this
.
asideCollapse
,
uniqueOpened
:
true
,
defaultActive
:
this
.
active
},
...
...
@@ -23,7 +23,7 @@ export default {
]
:
[]
])
},
data
()
{
data
()
{
return
{
active
:
''
,
asideHeight
:
300
,
...
...
@@ -38,7 +38,7 @@ export default {
},
watch
:
{
// 折叠和展开菜单的时候销毁 better scroll
asideCollapse
(
val
)
{
asideCollapse
(
val
)
{
this
.
scrollDestroy
()
setTimeout
(()
=>
{
this
.
scrollInit
()
...
...
@@ -46,20 +46,20 @@ export default {
},
// 监听路由 控制侧边栏激活状态
'$route.fullPath'
:
{
handler
(
value
)
{
handler
(
value
)
{
this
.
active
=
value
},
immediate
:
true
}
},
mounted
()
{
mounted
()
{
this
.
scrollInit
()
},
beforeDestroy
()
{
beforeDestroy
()
{
this
.
scrollDestroy
()
},
methods
:
{
scrollInit
()
{
scrollInit
()
{
this
.
BS
=
new
BScroll
(
this
.
$el
,
{
mouseWheel
:
true
,
click
:
true
...
...
@@ -70,7 +70,7 @@ export default {
// }
})
},
scrollDestroy
()
{
scrollDestroy
()
{
// https://github.com/d2-projects/d2-admin/issues/75
try
{
this
.
BS
.
destroy
()
...
...
src/layout/header-aside/components/mixin/menu.js
View file @
e1190a4
...
...
@@ -2,7 +2,7 @@ import util from '@/libs/util.js'
export
default
{
methods
:
{
handleMenuSelect
(
index
,
indexPath
)
{
handleMenuSelect
(
index
,
indexPath
)
{
if
(
/^d2-menu-empty-
\d
+$/
.
test
(
index
)
||
index
===
undefined
)
{
this
.
$message
.
warning
(
'临时菜单'
)
}
else
if
(
/^https:
\/\/
|http:
\/\/
/
.
test
(
index
))
{
...
...
src/layout/header-aside/components/panel-search/index.vue
View file @
e1190a4
...
...
@@ -63,7 +63,7 @@ export default {
components
:
{
'd2-panel-search-item'
:
()
=>
import
(
'./components/panel-search-item/index.vue'
)
},
data
()
{
data
()
{
return
{
searchText
:
''
,
results
:
[]
...
...
@@ -75,7 +75,7 @@ export default {
'pool'
]),
// 这份数据是展示在搜索面板下面的
resultsList
()
{
resultsList
()
{
return
(
this
.
results
.
length
===
0
&&
this
.
searchText
===
''
)
?
this
.
pool
.
map
(
e
=>
({
value
:
e
.
fullTitle
,
...
e
...
...
@@ -86,7 +86,7 @@ export default {
/**
* @description 过滤选项 这个方法在每次输入框的值发生变化时会触发
*/
querySearch
(
queryString
,
callback
)
{
querySearch
(
queryString
,
callback
)
{
var
pool
=
this
.
pool
const
results
=
this
.
query
(
queryString
?
pool
:
[],
queryString
)
this
.
results
=
results
...
...
@@ -97,7 +97,7 @@ export default {
* @param {Object} pool 需要过滤的数据
* @param {String} queryString 查询字符串
*/
query
(
pool
,
queryString
)
{
query
(
pool
,
queryString
)
{
return
new
Fuse
(
pool
,
{
shouldSort
:
true
,
tokenize
:
true
,
...
...
@@ -120,7 +120,7 @@ export default {
/**
* @description 聚焦输入框
*/
focus
()
{
focus
()
{
this
.
input
=
''
setTimeout
(()
=>
{
if
(
this
.
$refs
.
input
)
{
...
...
@@ -134,7 +134,7 @@ export default {
/**
* @description 接收用户在列表中选择项目的事件
*/
handleResultsGroupItemClick
(
path
)
{
handleResultsGroupItemClick
(
path
)
{
// 如果用户选择的就是当前页面 就直接关闭搜索面板
if
(
path
===
this
.
$route
.
path
)
{
this
.
handleEsc
()
...
...
@@ -146,7 +146,7 @@ export default {
/**
* @description 接收用户在下拉菜单中选中事件
*/
handleSelect
({
path
})
{
handleSelect
({
path
})
{
// 如果用户选择的就是当前页面 就直接关闭搜索面板
if
(
path
===
this
.
$route
.
path
)
{
this
.
handleEsc
()
...
...
@@ -160,7 +160,7 @@ export default {
/**
* @augments 关闭输入框的下拉菜单
*/
closeSuggestion
()
{
closeSuggestion
()
{
if
(
this
.
$refs
.
input
.
activated
)
{
this
.
$refs
.
input
.
suggestions
=
[]
this
.
$refs
.
input
.
activated
=
false
...
...
@@ -169,13 +169,13 @@ export default {
/**
* @augments 接收用户点击空白区域的关闭
*/
handlePanelClick
()
{
handlePanelClick
()
{
this
.
handleEsc
()
},
/**
* @augments 接收用户触发的关闭
*/
handleEsc
()
{
handleEsc
()
{
this
.
closeSuggestion
()
this
.
$nextTick
(()
=>
{
this
.
$emit
(
'close'
)
...
...
src/layout/header-aside/components/personal-panel/personalDialog.vue
View file @
e1190a4
...
...
@@ -48,7 +48,7 @@ export default {
user
:
Object
},
methods
:
{
handleClose
()
{
handleClose
()
{
this
.
$event
.
$emit
(
'e-pd-close'
)
}
}
...
...
src/layout/header-aside/components/tabs/index.vue
View file @
e1190a4
...
...
@@ -65,7 +65,7 @@ export default {
D2Contextmenu
:
()
=>
import
(
'../contextmenu'
),
D2ContextmenuList
:
()
=>
import
(
'../contextmenu/components/contentmenuList'
)
},
data
()
{
data
()
{
return
{
contextmenuFlag
:
false
,
contentmenuX
:
0
,
...
...
@@ -99,7 +99,7 @@ export default {
/**
* @description 右键菜单功能点击
*/
handleContextmenu
(
event
)
{
handleContextmenu
(
event
)
{
let
target
=
event
.
target
// 解决 https://github.com/d2-projects/d2-admin/issues/54
let
flag
=
false
...
...
@@ -120,13 +120,13 @@ export default {
/**
* @description 右键菜单的row-click事件
*/
contextmenuClick
(
command
)
{
contextmenuClick
(
command
)
{
this
.
handleControlItemClick
(
command
,
this
.
tagName
)
},
/**
* @description 接收点击关闭控制上选项的事件
*/
handleControlItemClick
(
command
,
tagName
=
null
)
{
handleControlItemClick
(
command
,
tagName
=
null
)
{
if
(
tagName
)
{
this
.
contextmenuFlag
=
false
}
...
...
@@ -154,7 +154,7 @@ export default {
/**
* @description 接收点击 tab 标签的事件
*/
handleClick
(
tab
,
event
)
{
handleClick
(
tab
,
event
)
{
// 找到点击的页面在 tag 列表里是哪个
const
page
=
this
.
opened
.
find
(
page
=>
page
.
fullPath
===
tab
.
name
)
const
{
name
,
params
,
query
}
=
page
...
...
@@ -165,7 +165,7 @@ export default {
/**
* @description 点击 tab 上的删除按钮触发这里 首页的删除按钮已经隐藏 因此这里不用判断是 index
*/
handleTabsEdit
(
tagName
,
action
)
{
handleTabsEdit
(
tagName
,
action
)
{
if
(
action
===
'remove'
)
{
this
.
close
({
tagName
...
...
src/layout/header-aside/mixins/search.js
View file @
e1190a4
...
...
@@ -6,7 +6,7 @@ export default {
components
:
{
'd2-panel-search'
:
()
=>
import
(
'../components/panel-search'
)
},
mounted
()
{
mounted
()
{
// 绑定搜索功能快捷键 [ 打开 ]
hotkeys
(
this
.
searchHotkey
.
open
,
event
=>
{
event
.
preventDefault
()
...
...
@@ -18,7 +18,7 @@ export default {
this
.
searchPanelClose
()
})
},
beforeDestroy
()
{
beforeDestroy
()
{
hotkeys
.
unbind
(
this
.
searchHotkey
.
open
)
hotkeys
.
unbind
(
this
.
searchHotkey
.
close
)
},
...
...
@@ -36,7 +36,7 @@ export default {
/**
* 接收点击搜索按钮
*/
handleSearchClick
()
{
handleSearchClick
()
{
this
.
searchToggle
()
if
(
this
.
searchActive
)
{
setTimeout
(()
=>
{
...
...
@@ -46,7 +46,7 @@ export default {
},
500
)
}
},
searchPanelOpen
()
{
searchPanelOpen
()
{
if
(
!
this
.
searchActive
)
{
this
.
searchSet
(
true
)
setTimeout
(()
=>
{
...
...
@@ -57,7 +57,7 @@ export default {
}
},
// 关闭搜索面板
searchPanelClose
()
{
searchPanelClose
()
{
if
(
this
.
searchActive
)
{
this
.
searchSet
(
false
)
}
...
...
src/libs/util.cookies.js
View file @
e1190a4
...
...
@@ -8,7 +8,7 @@ const cookies = {}
* @param {String} value cookie value
* @param {Object} setting cookie setting
*/
cookies
.
set
=
function
(
name
=
'default'
,
value
=
''
,
cookieSetting
=
{})
{
cookies
.
set
=
function
(
name
=
'default'
,
value
=
''
,
cookieSetting
=
{})
{
let
currentCookieSetting
=
{
expires
:
1
}
...
...
@@ -20,14 +20,14 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
* @description 拿到 cookie 值
* @param {String} name cookie name
*/
cookies
.
get
=
function
(
name
=
'default'
)
{
cookies
.
get
=
function
(
name
=
'default'
)
{
return
Cookies
.
get
(
`tfims-
${
process
.
env
.
VUE_APP_VERSION
}
-
${
name
}
`
)
}
/**
* @description 拿到 cookie 全部的值
*/
cookies
.
getAll
=
function
()
{
cookies
.
getAll
=
function
()
{
return
Cookies
.
get
()
}
...
...
@@ -35,7 +35,7 @@ cookies.getAll = function () {
* @description 删除 cookie
* @param {String} name cookie name
*/
cookies
.
remove
=
function
(
name
=
'default'
)
{
cookies
.
remove
=
function
(
name
=
'default'
)
{
return
Cookies
.
remove
(
`tfims-
${
process
.
env
.
VUE_APP_VERSION
}
-
${
name
}
`
)
}
...
...
src/libs/util.js
View file @
e1190a4
...
...
@@ -13,7 +13,7 @@ const util = {
* @description 更新标题
* @param {String} title 标题
*/
util
.
title
=
function
(
titleText
)
{
util
.
title
=
function
(
titleText
)
{
const
processTitle
=
process
.
env
.
VUE_APP_TITLE
window
.
document
.
title
=
`
${
processTitle
}${
titleText
?
` |
${
titleText
}
`
:
''
}
`
}
...
...
@@ -22,7 +22,7 @@ util.title = function (titleText) {
* @description 打开新页面
* @param {String} url 地址
*/
util
.
open
=
function
(
url
,
target
)
{
util
.
open
=
function
(
url
,
target
)
{
var
a
=
document
.
createElement
(
'a'
)
a
.
setAttribute
(
'href'
,
url
)
a
.
setAttribute
(
'target'
,
target
||
'_blank'
)
...
...
@@ -62,7 +62,7 @@ util.deepClone = (obj) => {
* @param {Function} condition 回调函数,必须返回谓词,判断是否找到了。会传入(item, index, level)三个参数
* @param {String} children 子数组的key
*/
util
.
deepFind
=
function
(
menus
,
id
)
{
util
.
deepFind
=
function
(
menus
,
id
)
{
const
cloneMenus
=
util
.
deepClone
(
menus
)
for
(
let
menu
of
cloneMenus
)
{
if
(
menu
.
id
===
id
)
{
...
...
@@ -110,7 +110,7 @@ util.colorToRgb = (sColor, alpha) => {
* 重置form
* 用法: util.resetForm.call(this,'formName')
*/
util
.
resetForm
=
function
(
formName
)
{
util
.
resetForm
=
function
(
formName
)
{
this
.
$nextTick
(()
=>
{
for
(
var
key
in
this
[
formName
])
{
if
(
this
[
formName
].
hasOwnProperty
(
key
))
{
...
...
src/libs/util.log.js
View file @
e1190a4
...
...
@@ -4,7 +4,7 @@ const log = {}
* @description 返回这个样式的颜色值
* @param {String} type 样式名称 [ primary | success | warning | danger | text ]
*/
function
typeColor
(
type
=
'default'
)
{
function
typeColor
(
type
=
'default'
)
{
let
color
=
''
switch
(
type
)
{
case
'default'
:
color
=
'#35495E'
;
break
...
...
@@ -23,7 +23,7 @@ function typeColor (type = 'default') {
* @param {String} info info text
* @param {String} type style
*/
log
.
capsule
=
function
(
title
,
info
,
type
=
'primary'
)
{
log
.
capsule
=
function
(
title
,
info
,
type
=
'primary'
)
{
console
.
log
(
`%c
${
title
}
%c
${
info
}
%c`
,
'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;'
,
...
...
@@ -35,7 +35,7 @@ log.capsule = function (title, info, type = 'primary') {
/**
* @description 打印彩色文字
*/
log
.
colorful
=
function
(
textArr
)
{
log
.
colorful
=
function
(
textArr
)
{
console
.
log
(
`%c
${
textArr
.
map
(
t
=>
t
.
text
||
''
).
join
(
'%c'
)}
`
,
...
textArr
.
map
(
t
=>
`color:
${
typeColor
(
t
.
type
)}
;`
)
...
...
@@ -45,35 +45,35 @@ log.colorful = function (textArr) {
/**
* @description 打印 default 样式的文字
*/
log
.
default
=
function
(
text
)
{
log
.
default
=
function
(
text
)
{
log
.
colorful
([{
text
}])
}
/**
* @description 打印 primary 样式的文字
*/
log
.
primary
=
function
(
text
)
{
log
.
primary
=
function
(
text
)
{
log
.
colorful
([{
text
,
type
:
'primary'
}])
}
/**
* @description 打印 success 样式的文字
*/
log
.
success
=
function
(
text
)
{
log
.
success
=
function
(
text
)
{
log
.
colorful
([{
text
,
type
:
'success'
}])
}
/**
* @description 打印 warning 样式的文字
*/
log
.
warning
=
function
(
text
)
{
log
.
warning
=
function
(
text
)
{
log
.
colorful
([{
text
,
type
:
'warning'
}])
}
/**
* @description 打印 danger 样式的文字
*/
log
.
danger
=
function
(
text
)
{
log
.
danger
=
function
(
text
)
{
log
.
colorful
([{
text
,
type
:
'danger'
}])
}
...
...
src/mock/api/sys.login.js
View file @
e1190a4
...
...
@@ -8,7 +8,7 @@ export default [
{
path
:
'/api/login'
,
method
:
'post'
,
handle
({
body
})
{
handle
({
body
})
{
const
user
=
userDB
.
find
(
e
=>
e
.
username
===
body
.
username
&&
e
.
password
===
body
.
password
)
if
(
user
)
{
return
{
...
...
src/mock/d2-mock/patch/withCredentials.js
View file @
e1190a4
export
default
function
(
Mock
)
{
export
default
function
(
Mock
)
{
// http://cnine.me/note/FrontEnd/mock-lose-cookies-dbg.html
Mock
.
XHR
.
prototype
.
__send
=
Mock
.
XHR
.
prototype
.
send
Mock
.
XHR
.
prototype
.
send
=
function
()
{
Mock
.
XHR
.
prototype
.
send
=
function
()
{
if
(
this
.
custom
.
xhr
)
this
.
custom
.
xhr
.
withCredentials
=
this
.
withCredentials
||
false
this
.
__send
.
apply
(
this
,
arguments
)
}
...
...
src/plugin/axios/index.js
View file @
e1190a4
...
...
@@ -12,14 +12,14 @@ import qs from 'qs'
axios
.
defaults
.
withCredentials
=
true
const
expiresMinute
=
60
// 过期时间(分钟)
// 创建一个错误
function
errorCreate
(
msg
)
{
function
errorCreate
(
msg
)
{
const
error
=
new
Error
(
msg
)
errorLog
(
error
)
throw
error
}
// 记录和显示错误
function
errorLog
(
error
)
{
function
errorLog
(
error
)
{
// 添加到日志
store
.
dispatch
(
'd2admin/log/push'
,
{
message
:
'数据请求异常'
,
...
...
@@ -51,7 +51,7 @@ const service = axios.create({
// 请求拦截器
service
.
interceptors
.
request
.
use
(
config
=>
{
config
.
transformRequest
=
[
function
(
data
)
{
config
.
transformRequest
=
[
function
(
data
)
{
return
qs
.
stringify
(
data
)
}]
return
new
Promise
(
async
resolve
=>
{
...
...
src/plugin/d2admin/index.js
View file @
e1190a4
...
...
@@ -19,7 +19,7 @@ import pluginLog from '@/plugin/log'
import
pluginOpen
from
'@/plugin/open'
export
default
{
async
install
(
Vue
,
options
)
{
async
install
(
Vue
,
options
)
{
// 设置为 false 以阻止 vue 在启动时生成生产提示
// https://cn.vuejs.org/v2/api/#productionTip
Vue
.
config
.
productionTip
=
false
...
...
src/plugin/error/index.js
View file @
e1190a4
...
...
@@ -2,8 +2,8 @@ import store from '@/store'
import
util
from
'@/libs/util'
export
default
{
install
(
Vue
,
options
)
{
Vue
.
config
.
errorHandler
=
function
(
error
,
instance
,
info
)
{
install
(
Vue
,
options
)
{
Vue
.
config
.
errorHandler
=
function
(
error
,
instance
,
info
)
{
Vue
.
nextTick
(()
=>
{
// store 追加 log
store
.
dispatch
(
'd2admin/log/push'
,
{
...
...
src/plugin/log/index.js
View file @
e1190a4
...
...
@@ -2,11 +2,11 @@ import store from '@/store'
import
util
from
'@/libs/util'
export
default
{
install
(
Vue
,
options
)
{
install
(
Vue
,
options
)
{
// 快速打印 log
Vue
.
prototype
.
$log
=
{
...
util
.
log
,
push
(
data
)
{
push
(
data
)
{
if
(
typeof
data
===
'string'
)
{
// 如果传递来的数据是字符串
// 赋值给 message 字段
...
...
src/plugin/open/index.js
View file @
e1190a4
import
util
from
'@/libs/util'
export
default
{
install
(
Vue
,
options
)
{
install
(
Vue
,
options
)
{
Vue
.
prototype
.
$open
=
util
.
open
}
}
src/router/index.js
View file @
e1190a4
...
...
@@ -13,7 +13,7 @@ import util from '@/libs/util.js'
import
routes
from
'./routes'
const
originalPush
=
VueRouter
.
prototype
.
push
// 解决连续点击路由异常问题 limin
VueRouter
.
prototype
.
push
=
function
push
(
location
)
{
VueRouter
.
prototype
.
push
=
function
push
(
location
)
{
return
originalPush
.
call
(
this
,
location
)
&&
originalPush
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
Vue
.
use
(
VueRouter
)
...
...
@@ -27,7 +27,7 @@ const router = new VueRouter({
* 路由拦截
* 权限验证
*/
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
const
source
=
store
.
state
.
d2admin
.
auth
.
source
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
await
store
.
dispatch
(
'd2admin/page/isLoaded'
)
...
...
src/store/modules/d2admin/modules/auth.js
View file @
e1190a4
...
...
@@ -20,40 +20,40 @@ export default {
* @description 返回当前登录用户权限资源
* @param {Object} state state
*/
source
(
state
,
dispatch
)
{
source
(
state
,
dispatch
)
{
return
state
.
source
},
/**
* @description 返回当前页面meta
* @param {Object} state state
*/
meta
(
state
,
dispatch
)
{
meta
(
state
,
dispatch
)
{
return
state
.
meta
},
/**
* @description 当前角色拥有的所有按钮
* @param {Object} state state
*/
btns
(
state
,
dispatch
)
{
btns
(
state
,
dispatch
)
{
return
state
.
btns
},
/**
* 返回当前页面的btn
* @param {*} state
*/
curBtns
(
state
)
{
curBtns
(
state
)
{
return
state
.
btns
[
state
.
meta
.
authId
]
},
/**
* 返回当前页面的btn
* @param {*} state
*/
btnIdAll
(
state
)
{
btnIdAll
(
state
)
{
return
state
.
btnIdAll
}
},
actions
:
{
save2db
({
state
,
dispatch
})
{
save2db
({
state
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
// 设置数据
dispatch
(
'd2admin/db/set'
,
{
...
...
@@ -70,7 +70,7 @@ export default {
* @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源
*/
set
({
state
,
commit
,
dispatch
},
source
)
{
set
({
state
,
commit
,
dispatch
},
source
)
{
return
new
Promise
(
async
resolve
=>
{
// 检查这个主题在主题列表里是否存在
state
.
source
=
source
...
...
@@ -84,7 +84,7 @@ export default {
* @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源
*/
setCurrentPageMeta
({
state
,
commit
,
dispatch
},
meta
)
{
setCurrentPageMeta
({
state
,
commit
,
dispatch
},
meta
)
{
return
new
Promise
(
async
resolve
=>
{
state
.
meta
=
meta
// end
...
...
@@ -95,7 +95,7 @@ export default {
* @description 从持久化数据加载资源数据
* @param {Object} context
*/
load
({
state
,
commit
,
dispatch
})
{
load
({
state
,
commit
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
if
(
!
state
.
source
)
{
state
.
source
=
await
dispatch
(
'd2admin/db/get'
,
{
...
...
@@ -112,7 +112,7 @@ export default {
* 过滤并初始化路由与左侧菜单栏
* @param {*} param0
*/
init
({
state
,
commit
,
dispatch
})
{
init
({
state
,
commit
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
try
{
// 获取权限资源点
...
...
src/store/modules/d2admin/modules/color.js
View file @
e1190a4
...
...
@@ -12,7 +12,7 @@ export default {
* @description 返回当前颜色值
* @param {Object} state state
*/
color
(
state
,
dispatch
)
{
color
(
state
,
dispatch
)
{
return
state
.
value
}
},
...
...
@@ -22,7 +22,7 @@ export default {
* @param {Object} context
* @param {String} color 尺寸
*/
set
({
state
,
dispatch
,
commit
},
color
)
{
set
({
state
,
dispatch
,
commit
},
color
)
{
return
new
Promise
(
async
resolve
=>
{
// 记录上个值
const
old
=
state
.
value
...
...
@@ -48,7 +48,7 @@ export default {
* @description 从持久化数据读取颜色设置
* @param {Object} context
*/
load
({
state
,
dispatch
,
commit
})
{
load
({
state
,
dispatch
,
commit
})
{
return
new
Promise
(
async
resolve
=>
{
// 记录上个值
const
old
=
state
.
value
...
...
@@ -68,7 +68,7 @@ export default {
resolve
()
})
},
loadFromDB
({
state
,
dispatch
,
commit
})
{
loadFromDB
({
state
,
dispatch
,
commit
})
{
return
new
Promise
(
async
resolve
=>
{
const
color
=
await
dispatch
(
'd2admin/db/get'
,
{
dbName
:
'sys'
,
...
...
@@ -87,7 +87,7 @@ export default {
* @param {Object} payload oldColor {String} 旧的颜色
* @param {Object} payload newColor {String} 新颜色
*/
apply
(
state
,
{
oldColor
,
newColor
})
{
apply
(
state
,
{
oldColor
,
newColor
})
{
var
options
=
{
oldColors
:
[...
forElementUI
.
getElementUISeries
(
oldColor
)],
newColors
:
[...
forElementUI
.
getElementUISeries
(
newColor
)]
...
...
src/store/modules/d2admin/modules/fullscreen.js
View file @
e1190a4
...
...
@@ -11,7 +11,7 @@ export default {
* @description 初始化监听
* @param {Object} context
*/
listen
({
commit
})
{
listen
({
commit
})
{
return
new
Promise
(
resolve
=>
{
if
(
screenfull
.
enabled
)
{
screenfull
.
on
(
'change'
,
()
=>
{
...
...
@@ -29,7 +29,7 @@ export default {
* @description 切换全屏
* @param {Object} context
*/
toggle
({
commit
})
{
toggle
({
commit
})
{
return
new
Promise
(
resolve
=>
{
if
(
screenfull
.
isFullscreen
)
{
screenfull
.
exit
()
...
...
@@ -49,7 +49,7 @@ export default {
* @param {Object} state state
* @param {Boolean} active active
*/
set
(
state
,
active
)
{
set
(
state
,
active
)
{
state
.
active
=
active
}
}
...
...
src/store/modules/d2admin/modules/gray.js
View file @
e1190a4
...
...
@@ -9,7 +9,7 @@ export default {
* @description 切换灰度状态
* @param {Object} state state
*/
toggle
(
state
)
{
toggle
(
state
)
{
state
.
active
=
!
state
.
active
},
/**
...
...
@@ -17,7 +17,7 @@ export default {
* @param {Object} state state
* @param {Boolean} active active
*/
set
(
state
,
active
)
{
set
(
state
,
active
)
{
state
.
active
=
active
}
}
...
...
src/store/modules/d2admin/modules/releases.js
View file @
e1190a4
...
...
@@ -7,7 +7,7 @@ export default {
* @description 显示版本信息
* @param {Object} state state
*/
versionShow
()
{
versionShow
()
{
util
.
log
.
capsule
(
process
.
env
.
VUE_APP_TITLE
,
`v
${
process
.
env
.
VUE_APP_VERSION
}
`
)
console
.
log
(
'广联赛讯 http://www.glsx.com.cn'
)
// console.log('D2 Crud https://github.com/d2-projects/d2-crud')
...
...
src/store/modules/d2admin/modules/search.js
View file @
e1190a4
...
...
@@ -18,7 +18,7 @@ export default {
* @description 切换激活状态
* @param {Object} state state
*/
toggle
(
state
)
{
toggle
(
state
)
{
state
.
active
=
!
state
.
active
},
/**
...
...
@@ -26,7 +26,7 @@ export default {
* @param {Object} state state
* @param {Boolean} active active
*/
set
(
state
,
active
)
{
set
(
state
,
active
)
{
state
.
active
=
active
},
/**
...
...
@@ -34,9 +34,9 @@ export default {
* @param {Object} state state
* @param {Array} menu menu
*/
init
(
state
,
menu
)
{
init
(
state
,
menu
)
{
const
pool
=
[]
const
push
=
function
(
menu
,
titlePrefix
=
[])
{
const
push
=
function
(
menu
,
titlePrefix
=
[])
{
menu
.
forEach
(
m
=>
{
if
(
m
.
children
)
{
push
(
m
.
children
,
[
...
titlePrefix
,
m
.
title
])
...
...
src/store/modules/d2admin/modules/size.js
View file @
e1190a4
...
...
@@ -13,7 +13,7 @@ export default {
* @param {Object} context
* @param {Boolean} refresh 是否在设置之后刷新页面
*/
apply
({
state
,
commit
},
refresh
)
{
apply
({
state
,
commit
},
refresh
)
{
Vue
.
prototype
.
$ELEMENT
.
size
=
state
.
value
if
(
refresh
)
{
commit
(
'd2admin/page/keepAliveClean'
,
null
,
{
root
:
true
})
...
...
@@ -24,7 +24,7 @@ export default {
* @description 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
* @param {Object} context
*/
isLoaded
({
state
})
{
isLoaded
({
state
})
{
if
(
state
.
value
)
return
Promise
.
resolve
()
return
new
Promise
(
resolve
=>
{
const
timer
=
setInterval
(()
=>
{
...
...
@@ -39,7 +39,7 @@ export default {
* @param {Object} context
* @param {String} size 尺寸
*/
set
({
state
,
dispatch
},
size
)
{
set
({
state
,
dispatch
},
size
)
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
state
.
value
=
size
...
...
@@ -60,7 +60,7 @@ export default {
* @description 从持久化数据读取尺寸设置
* @param {Object} context
*/
load
({
state
,
dispatch
})
{
load
({
state
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
state
.
value
=
await
dispatch
(
'd2admin/db/get'
,
{
...
...
src/store/modules/d2admin/modules/theme.js
View file @
e1190a4
...
...
@@ -14,7 +14,7 @@ export default {
* @description 返回当前的主题信息 不是一个名字 而是当前激活主题的所有数据
* @param {Object} state state
*/
activeSetting
(
state
)
{
activeSetting
(
state
)
{
return
state
.
list
.
find
(
theme
=>
theme
.
name
===
state
.
activeName
)
}
},
...
...
@@ -23,7 +23,7 @@ export default {
* @description 激活一个主题
* @param {String} themeValue 需要激活的主题名称
*/
set
({
state
,
commit
,
dispatch
},
themeName
)
{
set
({
state
,
commit
,
dispatch
},
themeName
)
{
return
new
Promise
(
async
resolve
=>
{
// 检查这个主题在主题列表里是否存在
state
.
activeName
=
state
.
list
.
find
(
e
=>
e
.
name
===
themeName
)
?
themeName
:
state
.
list
[
0
].
name
...
...
@@ -43,7 +43,7 @@ export default {
/**
* @description 从持久化数据加载主题设置 * @param {Object} context
*/
load
({
state
,
commit
,
dispatch
})
{
load
({
state
,
commit
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
let
activeName
=
await
dispatch
(
'd2admin/db/get'
,
{
...
...
@@ -82,7 +82,7 @@ export default {
* @description 将 vuex 中的主题应用到 dom
* @param {Object} state state
*/
dom
(
state
)
{
dom
(
state
)
{
document
.
body
.
className
=
`theme-
${
state
.
activeName
}
`
}
}
...
...
src/store/modules/d2admin/modules/transition.js
View file @
e1190a4
...
...
@@ -13,7 +13,7 @@ export default {
* @param {Object} context
* @param {Boolean} active 新的状态
*/
set
({
state
,
dispatch
},
active
)
{
set
({
state
,
dispatch
},
active
)
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
state
.
active
=
active
...
...
@@ -32,7 +32,7 @@ export default {
* 从数据库读取页面过渡动画设置
* @param {Object} context
*/
load
({
state
,
dispatch
})
{
load
({
state
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
state
.
active
=
await
dispatch
(
'd2admin/db/get'
,
{
...
...
src/store/modules/d2admin/modules/tsearch.js
View file @
e1190a4
...
...
@@ -9,7 +9,7 @@ export default {
* @description 切换状态
* @param {Object} state state
*/
toggle
(
state
)
{
toggle
(
state
)
{
state
.
active
=
!
state
.
active
},
/**
...
...
@@ -17,7 +17,7 @@ export default {
* @param {Object} state state
* @param {Boolean} active active
*/
set
(
state
,
active
)
{
set
(
state
,
active
)
{
state
.
active
=
active
}
}
...
...
src/store/modules/d2admin/modules/ua.js
View file @
e1190a4
...
...
@@ -11,7 +11,7 @@ export default {
* @description 记录 UA
* @param {Object} state state
*/
get
(
state
)
{
get
(
state
)
{
state
.
data
=
new
UaParser
().
getResult
()
}
}
...
...
src/store/modules/d2admin/modules/user.js
View file @
e1190a4
...
...
@@ -10,7 +10,7 @@ export default {
* @param {Object} context
* @param {*} info info
*/
set
({
state
,
dispatch
},
info
)
{
set
({
state
,
dispatch
},
info
)
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
state
.
info
=
info
...
...
@@ -30,7 +30,7 @@ export default {
* @description 从数据库取用户数据
* @param {Object} context
*/
load
({
state
,
dispatch
})
{
load
({
state
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
// store 赋值
// state.info = await dispatch('d2admin/db/get', {
...
...
@@ -45,7 +45,7 @@ export default {
})
},
clear
({
state
,
dispatch
})
{
clear
({
state
,
dispatch
})
{
return
new
Promise
(
async
resolve
=>
{
// await dispatch('d2admin/db/set', {
// dbName: 'database',
...
...
src/views/demo/page1/index.vue
View file @
e1190a4
...
...
@@ -12,7 +12,7 @@
<
script
>
export
default
{
name
:
'page1'
,
render
:
function
(
createElement
)
{
render
:
function
(
createElement
)
{
return
createElement
(
'div'
,
{
attrs
:
{
class
:
'd2-layout-header-aside-menu-side'
}
},
[
createElement
(
'el-menu'
,
{
...
...
src/views/demo/page2/index.vue
View file @
e1190a4
...
...
@@ -56,11 +56,11 @@
export
default
{
name
:
'page2'
,
methods
:
{
handleClick
(
row
)
{
handleClick
(
row
)
{
alert
(
JSON
.
stringify
(
row
))
}
},
data
()
{
data
()
{
return
{
testCache
:
''
,
btn
:
{
...
...
src/views/materialList/index.vue
View file @
e1190a4
...
...
@@ -58,7 +58,7 @@ import { getListApi } from '@api/materialList'
import
notice
from
'@/common/notice'
export
default
{
name
:
'fimsMaterialList'
,
data
()
{
data
()
{
return
{
searchForm
:
{
keyWord
:
''
...
...
@@ -95,24 +95,24 @@ export default {
}
},
mounted
()
{
mounted
()
{
this
.
loadingGetList
()
},
methods
:
{
loadingGetList
()
{
loadingGetList
()
{
this
.
tableLoading
=
true
this
.
getList
()
},
/* 接口请求-start */
getParams
()
{
getParams
()
{
return
{
pageCount
:
this
.
pageSize
,
pageSize
:
this
.
currentPage
,
...
this
.
searchForm
}
},
getList
()
{
getList
()
{
const
params
=
this
.
getParams
()
getListApi
(
params
).
then
(
res
=>
{
this
.
tableData
=
res
.
deviceList
...
...
@@ -125,18 +125,18 @@ export default {
},
/* 接口请求-end */
// 搜索
handleSearch
()
{
handleSearch
()
{
this
.
loadingGetList
()
},
// 页码
handleSizeChange
(
value
)
{
handleSizeChange
(
value
)
{
this
.
pageSize
=
value
// 调接口
this
.
loadingGetList
()
},
handleCurrentChange
(
value
)
{
handleCurrentChange
(
value
)
{
this
.
currentPage
=
value
// 调接口
this
.
loadingGetList
()
...
...
src/views/reportingLogs/index.vue
View file @
e1190a4
...
...
@@ -116,7 +116,7 @@ import { BaseData } from '@/common/constants'
import
notice
from
'@/common/notice'
export
default
{
name
:
'FimsReportingLogs'
,
data
()
{
data
()
{
return
{
// 远程搜索-返回数组
remoteOptionArr
:
{
...
...
@@ -166,24 +166,24 @@ export default {
},
watch
:
{
'searchForm.reportTime'
(
value
)
{
'searchForm.reportTime'
(
value
)
{
!
value
&&
this
.
loadingGetList
()
}
},
mounted
()
{
mounted
()
{
this
.
loadingGetList
()
this
.
loadBaseData
()
},
methods
:
{
async
loadBaseData
()
{
async
loadBaseData
()
{
const
data
=
await
this
.
$store
.
dispatch
(
'd2admin/base/get'
,
BaseData
.
STATION
.
KEY
)
this
.
baseData
.
station
=
data
},
// 防抖
debounce
(
fn
,
delay
=
50
)
{
debounce
(
fn
,
delay
=
50
)
{
let
timer
=
null
return
(...
args
)
=>
{
clearTimeout
(
timer
)
...
...
@@ -194,21 +194,21 @@ export default {
},
// 远程搜索
remoteArr
(
value
,
attr
)
{
remoteArr
(
value
,
attr
)
{
this
.
debounce
(
this
.
getRemote
(
attr
,
value
),
50
)
},
// 清空远程搜索列表;表格数据刷新
remoteAndGetList
(
attr
)
{
remoteAndGetList
(
attr
)
{
this
.
remoteOptionArr
[
attr
]
=
[]
this
.
loadingGetList
()
},
loadingGetList
()
{
loadingGetList
()
{
this
.
tableLoading
=
true
this
.
getList
()
},
getParams
()
{
getParams
()
{
return
Object
.
assign
(
{
pageCount
:
this
.
pageSize
,
...
...
@@ -217,7 +217,7 @@ export default {
this
.
searchForm
)
},
getRemote
(
attr
,
value
)
{
getRemote
(
attr
,
value
)
{
let
params
=
{}
params
[
attr
]
=
value
delete
params
.
pageCount
...
...
@@ -226,7 +226,7 @@ export default {
this
.
remoteOptionArr
[
attr
]
=
new
Set
(
res
.
loges
.
map
(
item
=>
item
[
attr
]))
})
},
getList
()
{
getList
()
{
const
params
=
this
.
getParams
()
params
.
startTime
=
params
.
reportTime
?
params
.
reportTime
[
0
]
+
' '
+
'00:00:00 '
:
''
params
.
endTime
=
params
.
reportTime
?
params
.
reportTime
[
1
]
+
' '
+
'23:59:59'
:
''
...
...
@@ -243,7 +243,7 @@ export default {
})
},
handleExport
()
{
handleExport
()
{
const
params
=
this
.
getParams
()
params
.
startTime
=
params
.
reportTime
?
params
.
reportTime
[
0
]
+
' '
+
'00:00:00 '
:
''
params
.
endTime
=
params
.
reportTime
?
params
.
reportTime
[
1
]
+
' '
+
'23:59:59'
:
''
...
...
@@ -259,18 +259,18 @@ export default {
},
// 搜索
handleSearch
()
{
handleSearch
()
{
this
.
loadingGetList
()
},
// 页码
handleSizeChange
(
value
)
{
handleSizeChange
(
value
)
{
this
.
pageSize
=
value
// 调接口
this
.
loadingGetList
()
},
handleCurrentChange
(
value
)
{
handleCurrentChange
(
value
)
{
this
.
currentPage
=
value
// 调接口
this
.
loadingGetList
()
...
...
src/views/system/function/redirect/index.js
View file @
e1190a4
export
default
{
beforeRouteEnter
(
to
,
from
,
next
)
{
beforeRouteEnter
(
to
,
from
,
next
)
{
next
(
instance
=>
instance
.
$router
.
replace
(
JSON
.
parse
(
from
.
params
.
route
)))
},
render
:
h
=>
h
()
...
...
src/views/system/function/refresh/index.js
View file @
e1190a4
export
default
{
beforeRouteEnter
(
to
,
from
,
next
)
{
beforeRouteEnter
(
to
,
from
,
next
)
{
next
(
instance
=>
instance
.
$router
.
replace
(
from
.
fullPath
))
},
render
:
h
=>
h
()
...
...
src/views/system/login/dialogReg.vue
View file @
e1190a4
...
...
@@ -90,11 +90,11 @@ export default {
}
},
computed
:
{
dialogVisible
()
{
dialogVisible
()
{
return
this
.
isVisible
}
},
data
()
{
data
()
{
return
{
POST_DISABLED
,
company
:
[],
...
...
@@ -186,12 +186,12 @@ export default {
},
methods
:
{
...
mapActions
(
'd2admin/base'
,
[
'load'
]),
handleClose
()
{
handleClose
()
{
this
.
$refs
.
regForm
.
resetFields
()
this
.
$event
.
$emit
(
'e-reg-dialog'
,
false
)
},
// 提交注册数据
submit
()
{
submit
()
{
this
.
$refs
.
regForm
.
validate
(
vaild
=>
{
if
(
vaild
)
{
var
__p
=
this
.
regForm
...
...
@@ -201,21 +201,21 @@ export default {
notice
.
okTips
(
'注册信息已提交,请等待管理员审核'
)
this
.
handleClose
()
}
else
{
notice
.
errorTips
(
`注册失败!`
)
notice
.
errorTips
(
'注册失败!'
)
}
})
}
})
},
// 加载业务所需所有数据
async
fetchData
()
{
async
fetchData
()
{
const
{
station
,
post
}
=
await
this
.
load
()
this
.
baseData
.
posts
=
post
this
.
baseData
.
stations
=
station
Object
.
freeze
(
this
.
baseData
)
}
},
mounted
()
{
mounted
()
{
this
.
fetchData
()
}
}
...
...
src/views/system/login/index.vue
View file @
e1190a4
...
...
@@ -90,7 +90,7 @@ export default {
components
:
{
DialogReg
:
()
=>
import
(
'./dialogReg'
)
},
data
()
{
data
()
{
return
{
registerDialogVisible
:
false
,
timeInterval
:
null
,
...
...
@@ -118,20 +118,20 @@ export default {
})
}
},
mounted
()
{
mounted
()
{
this
.
timeInterval
=
setInterval
(()
=>
this
.
refreshTime
(),
1000
)
this
.
$event
.
$on
(
'e-reg-dialog'
,
res
=>
(
this
.
registerDialogVisible
=
res
))
},
beforeDestroy
()
{
beforeDestroy
()
{
clearInterval
(
this
.
timeInterval
)
},
methods
:
{
...
mapActions
(
'd2admin/account'
,
[
'login'
]),
refreshTime
()
{
refreshTime
()
{
this
.
time
=
dayjs
().
format
(
'HH:mm:ss'
)
},
// 提交登录信息
submit
()
{
submit
()
{
// console.log(navigator.userAgent.toLocaleLowerCase())
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
if
(
valid
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment