Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
e24b97ee
Commit
e24b97ee
authored
Oct 27, 2019
by
trumansdo
Browse files
no message
parent
6f9e819b
Changes
34
Hide whitespace changes
Inline
Side-by-side
ve-admin/admin-web/src/api/user.js
View file @
e24b97ee
import
request
from
'
@/utils/request
'
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2019-10-27 23:13:10
* @LastEditors: 一日看尽长安花
* @Description:
*/
import
request
from
'
@/utils/request
'
;
export
function
login
(
data
)
{
export
function
login
(
data
)
{
return
request
({
return
request
({
url
:
'
/user/login
'
,
url
:
'
/user/login
'
,
method
:
'
post
'
,
method
:
'
post
'
,
data
data
})
})
;
}
}
export
function
getInfo
(
token
)
{
export
function
getInfo
(
token
)
{
return
request
({
return
request
({
url
:
'
/user/info
'
,
url
:
'
/user/info
'
,
method
:
'
get
'
,
method
:
'
get
'
// params: { token }
// params: { token }
})
})
;
}
}
export
function
logout
()
{
export
function
logout
()
{
return
request
({
return
request
({
url
:
'
/user/logout
'
,
url
:
'
/user/logout
'
,
method
:
'
post
'
method
:
'
post
'
})
});
}
export
function
users
(
params
)
{
return
request
({
url
:
'
/users
'
,
method
:
'
get
'
,
params
:
params
});
}
export
function
usersMetedata
()
{
return
request
({
url
:
'
/users/metedata
'
,
method
:
'
get
'
});
}
}
ve-admin/admin-web/src/components/TableViews/DataTable.vue
0 → 100644
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 16:14:37
* @LastEditTime: 2019-10-27 23:14:25
* @LastEditors: 一日看尽长安花
* @Description:
-->
<
template
>
<div
class=
"data-table"
>
<!-- 数据表格的row是来自data绑定的集合数据,并不是每一列绑定的prop -->
<el-table
ref=
"dataTable"
v-loading.lock=
"loading"
:data=
"tabledata.data"
style=
"width: 100%"
:stripe=
"true"
:highlight-current-row=
"true"
:border=
"true"
:fit=
"true"
>
<el-table-column
:key=
"Math.random()"
type=
"selection"
width=
"55"
>
</el-table-column>
<el-table-column
:key=
"Math.random()"
type=
"index"
></el-table-column>
<el-table-column
v-for=
"(val, key) in metedata"
:key=
"key"
:prop=
"key"
:label=
"val.name"
:sortable=
"val.sortable"
:show-overflow-tooltip=
"true"
>
</el-table-column>
<el-table-column
:key=
"Math.random()"
align=
"right"
>
<template
#header
="
slot
"
>
<el-input
v-model=
"search"
size=
"mini"
:clearable=
"true"
prefix-icon=
"el-icon-search"
placeholder=
"输入关键字搜索"
@
input=
"searchTable"
/>
</
template
>
<
template
v-slot=
"slot"
>
<el-button
size=
"mini"
@
click=
"handleEdit(slot.$index, slot.row)"
>
编辑
</el-button>
<el-button
size=
"mini"
type=
"danger"
@
click=
"handleDelete(slot.$index, slot.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"tabledata.total > 0"
:total=
"tabledata.total"
:page.sync=
"queryParams.page"
:limit.sync=
"queryParams.limit"
@
pagination=
"pagination"
/>
</div>
</template>
<
script
>
import
Pagination
from
'
./Pagination
'
;
export
default
{
name
:
'
DataTable
'
,
components
:
{
Pagination
},
props
:
{
// 表格元数据
metedata
:
{
type
:
Object
,
default
()
{
return
{};
}
},
// 表格数据
tabledata
:
{
type
:
Object
,
default
()
{
return
{
data
:
[],
total
:
0
};
}
},
searchMethod
:
{
type
:
Function
,
default
()
{
return
this
.
table
.
data
;
}
},
loading
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
search
:
''
,
queryParams
:
{
page
:
1
,
limit
:
10
},
cloneTableData
:
null
};
},
methods
:
{
searchTable
()
{
// 要用一个临时数据将当前页面的数据保存下来,不然 $emit 会将原数据修改
this
.
cloneTableData
=
!
this
.
cloneTableData
?
Object
.
assign
({},
this
.
tabledata
)
:
this
.
cloneTableData
;
let
tempTableData
=
Object
.
assign
({},
this
.
cloneTableData
);
tempTableData
.
data
=
this
.
searchMethod
(
this
.
search
,
tempTableData
.
data
);
this
.
$emit
(
'
update:tabledata
'
,
tempTableData
);
},
pagination
(
pageParams
)
{
this
.
queryParams
=
Object
.
assign
({},
this
.
queryParams
,
pageParams
);
this
.
$emit
(
'
pagination
'
,
this
.
queryParams
);
this
.
cloneTable
=
null
;
},
handleEdit
(
index
,
row
)
{
this
.
$emit
(
'
handle-edit
'
,
index
,
row
);
},
handleDelete
(
index
,
row
)
{
this
.
$emit
(
'
delete-data
'
,
index
,
row
);
}
}
};
</
script
>
ve-admin/admin-web/src/components/TableViews/EditDialog.vue
0 → 100644
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 16:14:37
* @LastEditTime: 2019-10-17 17:41:15
* @LastEditors: 一日看尽长安花
* @Description:
-->
<
template
>
<div
class=
"dialog-container"
>
<!-- 对话框 -->
<el-dialog
:title=
"dialogTitle"
:visible=
"dialogVisible"
:close-on-click-modal=
"false"
@
open=
"openDialog"
@
close=
"closeDialog"
>
<el-form
ref=
"editForm"
:rules=
"rules"
:model=
"dialogData"
label-position=
"left"
label-width=
"70px"
style=
"width: 400px; margin-left:50px;"
>
<el-form-item
v-for=
"(val, key) in metedata"
:key=
"key"
:label=
"val.name"
:prop=
"key"
>
<el-input
v-if=
"judgeType(val.type, 'string')"
v-model=
"dialogData[key]"
:placeholder=
"val.name"
:clearable=
"true"
style=
"width: 200px;"
class=
"filter-item"
/>
<el-date-picker
v-else-if=
"judgeType(val.type, 'date')"
v-model=
"dialogData[key]"
type=
"datetime"
:placeholder=
"val.name + '时间'"
>
</el-date-picker>
<el-select
v-else-if=
"judgeType(val.type, 'dict')"
:placeholder=
"val.name"
:clearable=
"true"
class=
"filter-item"
>
<el-option
/>
</el-select>
</el-form-item>
<slot
:dialog-data=
"dialogData"
name=
"dialog-form-item"
></slot>
</el-form>
<template
v-slot:footer
>
<div
class=
"dialog-footer"
>
<el-button
@
click=
"closeDialog"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"operationType === 'create' ? createData() : updateData()"
>
确定
</el-button>
</div>
</
template
>
</el-dialog>
</div>
</template>
<
script
>
import
{
equalsIgnoreCase
}
from
'
@/utils/str-util
'
;
export
default
{
name
:
'
EditDialog
'
,
props
:
{
metedata
:
{
type
:
Object
,
default
()
{
return
{};
}
},
dialogData
:
{
type
:
Object
,
default
()
{
return
{};
}
},
dialogTitle
:
{
type
:
String
,
default
:
'
创建
'
},
rules
:
{
type
:
Object
,
default
()
{
return
{};
}
},
dialogVisible
:
{
type
:
Boolean
,
default
:
false
},
operationType
:
{
type
:
String
,
default
:
'
create
'
}
},
data
()
{
return
{};
},
methods
:
{
judgeType
(
str1
,
type
)
{
return
equalsIgnoreCase
(
str1
,
type
);
},
createData
()
{
this
.
$refs
[
'
editForm
'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$emit
(
'
create-data
'
,
this
.
dialogData
);
this
.
$nextTick
(()
=>
{
this
.
$emit
(
'
update:dialogVisible
'
,
false
);
this
.
$notify
({
title
:
'
成功
'
,
message
:
'
添加成功
'
,
type
:
'
success
'
,
duration
:
2000
});
});
}
else
{
this
.
$notify
({
title
:
'
失败
'
,
message
:
'
数据无法通过校验!
'
,
type
:
'
error
'
,
duration
:
2000
});
}
});
},
updateData
()
{
this
.
$refs
[
'
editForm
'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$emit
(
'
update-data
'
,
this
.
dialogData
);
this
.
$nextTick
(()
=>
{
this
.
$emit
(
'
update:dialogVisible
'
,
false
);
this
.
$notify
({
title
:
'
成功
'
,
message
:
'
修改成功
'
,
type
:
'
success
'
,
duration
:
2000
});
});
}
else
{
this
.
$notify
({
title
:
'
失败
'
,
message
:
'
数据无法通过校验!
'
,
type
:
'
error
'
,
duration
:
2000
});
}
});
},
openDialog
()
{
this
.
$emit
(
'
update:dialogVisible
'
,
true
);
},
closeDialog
()
{
this
.
$emit
(
'
update:dialogVisible
'
,
false
);
}
}
};
</
script
>
<
style
scoped
></
style
>
ve-admin/admin-web/src/components/TableViews/Pagination.vue
0 → 100644
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-09-09 12:16:28
* @LastEditTime: 2019-10-27 00:01:53
* @LastEditors: 一日看尽长安花
* @Description: 这个分页是直接从组件复制的,为了保证以后修改逻辑不影响其它的页面使用公共的分页。
-->
<
template
>
<div
:class=
"
{ hidden: hidden }" class="pagination-container">
<el-pagination
:background=
"background"
:current-page.sync=
"currentPage"
:page-size.sync=
"pageSize"
:layout=
"layout"
:page-sizes=
"pageSizes"
:total=
"total"
v-bind=
"$attrs"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
/>
</div>
</
template
>
<
script
>
import
{
scrollTo
}
from
'
@/utils/scroll-to
'
;
export
default
{
name
:
'
Pagination
'
,
props
:
{
total
:
{
type
:
Number
,
default
:
0
},
page
:
{
type
:
Number
,
default
:
1
},
limit
:
{
type
:
Number
,
default
:
10
},
pageSizes
:
{
type
:
Array
,
default
()
{
return
[
10
,
20
,
30
,
50
,
100
];
}
},
layout
:
{
type
:
String
,
default
:
'
total, sizes, prev, pager, next, jumper
'
},
background
:
{
type
:
Boolean
,
default
:
true
},
autoScroll
:
{
type
:
Boolean
,
default
:
true
},
hidden
:
{
type
:
Boolean
,
default
:
false
}
},
computed
:
{
currentPage
:
{
get
()
{
return
this
.
page
;
},
set
(
val
)
{
this
.
$emit
(
'
update:page
'
,
val
);
}
},
pageSize
:
{
get
()
{
return
this
.
limit
;
},
set
(
val
)
{
this
.
$emit
(
'
update:limit
'
,
val
);
}
}
},
methods
:
{
handleSizeChange
(
val
)
{
this
.
$emit
(
'
pagination
'
,
{
page
:
this
.
currentPage
,
limit
:
val
});
if
(
this
.
autoScroll
)
{
scrollTo
(
0
,
800
);
}
},
handleCurrentChange
(
val
)
{
this
.
$emit
(
'
pagination
'
,
{
page
:
val
,
limit
:
this
.
pageSize
});
if
(
this
.
autoScroll
)
{
scrollTo
(
0
,
800
);
}
}
}
};
</
script
>
<
style
scoped
>
.pagination-container
{
background
:
#fff
;
padding
:
32px
16px
;
}
.pagination-container.hidden
{
display
:
none
;
}
</
style
>
ve-admin/admin-web/src/components/TableViews/SearchPane.vue
0 → 100644
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 16:14:37
* @LastEditTime: 2019-10-17 11:48:19
* @LastEditors: 一日看尽长安花
* @Description:
-->
<
template
>
<div
class=
"filter-container"
>
<el-form
ref=
"filterForm"
:size=
"size"
:model=
"filterData"
@
submit.native.prevent
>
<div
v-for=
"(val, key) in metedata"
:key=
"key"
class=
"filter-item-container"
>
<el-form-item>
<el-input
v-if=
"judgeType(val.type, 'string')"
v-model=
"filterData[key]"
:placeholder=
"val.name"
:clearable=
"true"
style=
"width: 200px;"
class=
"filter-item"
/>
<div
v-else-if=
"judgeType(val.type, 'date')"
style=
"display:inline-block"
>
<el-date-picker
v-model=
"filterData[key + 'Start']"
type=
"datetime"
:placeholder=
"val.name + '开始时间'"
>
</el-date-picker>
<el-date-picker
v-model=
"filterData[key + 'End']"
type=
"datetime"
:placeholder=
"val.name + '结束时间'"
>
</el-date-picker>
</div>
<el-select
v-else-if=
"judgeType(val.type, 'dict')"
:placeholder=
"val.name"
:clearable=
"true"
class=
"filter-item"
>
<el-option
/>
</el-select>
</el-form-item>
</div>
<slot
name=
"filter-condition"
:filter-data=
"filterData"
>
</slot>
<div
class=
"filter-item-container"
>
<el-button
:size=
"size"
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"filterSearch"
>
搜索
</el-button>
</div>
</el-form>
<div
class=
"filter-btn-group"
>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
type=
"primary"
icon=
"el-icon-edit"
:size=
"size"
@
click=
"handleCreate"
>
添加
</el-button>
<slot
name=
"operation-btn-group"
:filter-data=
"filterData"
>
</slot>
</div>
</div>
</
template
>
<
script
>
import
{
equalsIgnoreCase
}
from
'
@/utils/str-util
'
;
export
default
{
name
:
'
SearchPane
'
,
props
:
{
metedata
:
{
type
:
Object
,
default
()
{
return
{};
}
}
},
data
()
{
return
{
size
:
'
mini
'
,
filterData
:
{}
};
},
methods
:
{
judgeType
(
str1
,
type
)
{
return
equalsIgnoreCase
(
str1
,
type
);
},
filterSearch
(
filterData
)
{
this
.
$refs
[
'
filterForm
'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$emit
(
'
filter-search
'
,
this
.
filterData
);
}
else
{
this
.
$notify
({
title
:
'
Faild
'
,
message
:
'
Search Failded!
'
,
type
:
'
error
'
,
duration
:
2000
});
}
});
},
handleCreate
()
{
this
.
$emit
(
'
handle-create
'
);
}
}
};
</
script
>
<
style
scoped
>
.filter-item-container
{
display
:
inline-block
;
margin
:
0.15em
;
}
.filter-btn-group
{
margin
:
0.15em
;
}
</
style
>
ve-admin/admin-web/src/components/TableViews/index.vue
0 → 100644
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 15:43:18
* @LastEditTime: 2019-10-19 20:49:38
* @LastEditors: 一日看尽长安花
* @Description:
-->
<
template
>
<div>
<search-pane
:metedata=
"metedata"
@
filter-search=
"filterSearch"
@
handle-create=
"handleCreate"
></search-pane>
<data-table
:loading=
"loading"
:metedata=
"metedata"
:tabledata=
"tabledata"
:search-method=
"searchMethod"
@
update:tabledata=
"$emit('update:tabledata', $event)"
@
pagination=
"pagination"
@
handle-edit=
"handleEdit"
@
delete-data=
"$emit('delete-data')"
></data-table>
<edit-dialog
:metedata=
"metedata"
:dialog-visible.sync=
"dialogVisible"
:dialog-title=
"dialogTitle"
:operation-type=
"operationType"
:dialog-data=
"dialogData"
@
create-data=
"$emit('create-data')"
@
update-data=
"$emit('update-data')"
>
<template
#dialog-form-item
="
{dialogData:dialogData}">
</
template
>
</edit-dialog>
</div>
</template>
<
script
>
import
SearchPane
from
'
./SearchPane
'
;
import
DataTable
from
'
./DataTable
'
;
import
EditDialog
from
'
./EditDialog
'
;
export
default
{
name
:
'
TableViews
'
,
components
:
{
SearchPane
,
DataTable
,
EditDialog
},
props
:
{
// 表格元数据
metedata
:
{
type
:
Object
,
default
()
{
return
{};
}
},
// 表格数据
tabledata
:
{
type
:
Object
,
default
()
{
return
{
data
:
[],
total
:
0
};
}
},
// 加载中的遮罩层
loading
:
{
type
:
Boolean
,
default
:
true
},
searchMethod
:
{
type
:
Function
,
default
()
{
return
this
.
table
.
data
;
}
}
},
data
()
{
return
{
// 查询参数:包括搜索和分页参数
queryParams
:
{},
dialogData
:
{},
dialogVisible
:
false
,
// 对话框标题
dialogTitle
:
'
创建
'
,
// 对话框操作类型
operationType
:
'
create
'
};
},
methods
:
{
pagination
(
queryParams
)
{
this
.
queryParams
=
Object
.
assign
({},
queryParams
);
this
.
$emit
(
'
pagination
'
,
this
.
queryParams
);
},
filterSearch
(
filterData
)
{
this
.
queryParams
=
Object
.
assign
(
this
.
queryParams
,
filterData
);
this
.
$emit
(
'
filter-search
'
,
Object
.
assign
({},
this
.
queryParams
));
},
handleCreate
()
{
this
.
operationType
=
'
create
'
;
this
.
dialogTitle
=
'
创建
'
;
this
.
dialogVisible
=
true
;
this
.
dialogData
=
{};
},
handleEdit
(
index
,
row
)
{
this
.
operationType
=
'
update
'
;
this
.
dialogTitle
=
'
修改
'
;
this
.
dialogVisible
=
true
;
this
.
dialogData
=
Object
.
assign
({},
row
);
}
}
};
</
script
>
ve-admin/admin-web/src/main.js
View file @
e24b97ee
import
Vue
from
'
vue
'
/*
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2019-10-27 00:28:33
* @LastEditors: 一日看尽长安花
* @Description:
*/
import
Vue
from
'
vue
'
;
import
Cookies
from
'
js-cookie
'
import
Cookies
from
'
js-cookie
'
;
import
lodash
from
'
lodash
'
;
import
'
normalize.css/normalize.css
'
// a modern alternative to CSS resets
import
'
normalize.css/normalize.css
'
;
// a modern alternative to CSS resets
import
Element
from
'
element-ui
'
import
Element
from
'
element-ui
'
;
import
'
./styles/element-variables.scss
'
import
'
./styles/element-variables.scss
'
;
import
'
@/styles/index.scss
'
// global css
import
'
@/styles/index.scss
'
;
// global css
import
App
from
'
./App
'
import
App
from
'
./App
'
;
import
store
from
'
./store
'
import
store
from
'
./store
'
;
import
router
from
'
./router
'
import
router
from
'
./router
'
;
import
'
./icons
'
// icon
import
'
./icons
'
;
// icon
import
'
./permission
'
// permission control
import
'
./permission
'
;
// permission control
import
'
./utils/error-log
'
// error log
import
'
./utils/error-log
'
;
// error log
import
*
as
filters
from
'
./filters
'
// global filters
import
*
as
filters
from
'
./filters
'
;
// global filters
import
request
from
'
@/utils/request
'
;
/**
/**
* If you don't want to use mock-server
* If you don't want to use mock-server
...
@@ -36,18 +46,21 @@ if (process.env.NODE_ENV === 'unknown env') {
...
@@ -36,18 +46,21 @@ if (process.env.NODE_ENV === 'unknown env') {
Vue
.
use
(
Element
,
{
Vue
.
use
(
Element
,
{
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
// set element-ui default size
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
// set element-ui default size
})
})
;
// register global utility filters
// register global utility filters
Object
.
keys
(
filters
).
forEach
(
key
=>
{
Object
.
keys
(
filters
).
forEach
(
key
=>
{
Vue
.
filter
(
key
,
filters
[
key
])
Vue
.
filter
(
key
,
filters
[
key
]);
})
});
Vue
.
prototype
.
$lodash
=
lodash
;
Vue
.
prototype
.
$axios
=
request
;
Vue
.
config
.
productionTip
=
false
Vue
.
config
.
productionTip
=
false
;
new
Vue
({
new
Vue
({
el
:
'
#app
'
,
el
:
'
#app
'
,
router
,
router
,
store
,
store
,
render
:
h
=>
h
(
App
)
render
:
h
=>
h
(
App
)
})
})
;
ve-admin/admin-web/src/router/maps/core.js
View file @
e24b97ee
/*
* @Author: 一日看尽长安花
* @since: 2019-09-15 15:22:58
* @LastEditTime: 2019-10-27 22:44:09
* @LastEditors: 一日看尽长安花
* @Description:
*/
/*
/*
前端路由映射表中单个路由映射全部具有的信息
前端路由映射表中单个路由映射全部具有的信息
{
{
...
@@ -28,44 +35,45 @@ const coreRouter = [
...
@@ -28,44 +35,45 @@ const coreRouter = [
{
{
path
:
'
/admin/user/index.do
'
,
path
:
'
/admin/user/index.do
'
,
name
:
'
用户管理
'
,
name
:
'
用户管理
'
,
meta
:
{},
component
:
()
=>
import
(
'
@/views/users/index
'
),
meta
:
{}
},
},
{
{
path
:
'
/admin/org/index.do
'
,
path
:
'
/admin/org/index.do
'
,
name
:
'
组织机构管理
'
,
name
:
'
组织机构管理
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/role/index.do
'
,
path
:
'
/admin/role/index.do
'
,
name
:
'
角色管理
'
,
name
:
'
角色管理
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/menu/index.do
'
,
path
:
'
/admin/menu/index.do
'
,
name
:
'
菜单项
'
,
name
:
'
菜单项
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/function/index.do
'
,
path
:
'
/admin/function/index.do
'
,
name
:
'
功能点管理
'
,
name
:
'
功能点管理
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/dict/index.do
'
,
path
:
'
/admin/dict/index.do
'
,
name
:
'
字典数据管理
'
,
name
:
'
字典数据管理
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/role/function.do
'
,
path
:
'
/admin/role/function.do
'
,
name
:
'
角色功能授权
'
,
name
:
'
角色功能授权
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/role/data.do
'
,
path
:
'
/admin/role/data.do
'
,
name
:
'
角色数据授权
'
,
name
:
'
角色数据授权
'
,
meta
:
{}
,
meta
:
{}
}
,
}
]
,
]
},
},
{
{
path
:
'
/code
'
,
path
:
'
/code
'
,
...
@@ -76,14 +84,14 @@ const coreRouter = [
...
@@ -76,14 +84,14 @@ const coreRouter = [
{
{
path
:
'
/core/codeGen/project.do
'
,
path
:
'
/core/codeGen/project.do
'
,
name
:
'
子系统生成
'
,
name
:
'
子系统生成
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/core/codeGen/index.do
'
,
path
:
'
/core/codeGen/index.do
'
,
name
:
'
代码生成
'
,
name
:
'
代码生成
'
,
meta
:
{}
,
meta
:
{}
}
,
}
]
,
]
},
},
{
{
path
:
'
/monitor
'
,
path
:
'
/monitor
'
,
...
@@ -94,20 +102,20 @@ const coreRouter = [
...
@@ -94,20 +102,20 @@ const coreRouter = [
{
{
path
:
'
/admin/workflow/index.do
'
,
path
:
'
/admin/workflow/index.do
'
,
name
:
'
流程监控
'
,
name
:
'
流程监控
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/audit/index.do
'
,
path
:
'
/admin/audit/index.do
'
,
name
:
'
审计查询
'
,
name
:
'
审计查询
'
,
meta
:
{}
,
meta
:
{}
},
},
{
{
path
:
'
/admin/blog/index.do
'
,
path
:
'
/admin/blog/index.do
'
,
name
:
'
博客测试
'
,
name
:
'
博客测试
'
,
meta
:
{}
,
meta
:
{}
}
,
}
]
,
]
}
,
}
];
];
export
default
coreRouter
;
export
default
coreRouter
;
ve-admin/admin-web/src/store/modules/user.js
View file @
e24b97ee
import
{
login
,
logout
,
getInfo
}
from
'
@/api/user
'
import
{
login
,
logout
,
getInfo
}
from
'
@/api/user
'
;
import
{
getToken
,
setToken
,
removeToken
}
from
'
@/utils/auth
'
import
{
getToken
,
setToken
,
removeToken
}
from
'
@/utils/auth
'
;
import
router
,
{
resetRouter
}
from
'
@/router
'
import
router
,
{
resetRouter
}
from
'
@/router
'
;
const
state
=
{
const
state
=
{
token
:
getToken
(),
token
:
getToken
(),
...
@@ -8,73 +8,72 @@ const state = {
...
@@ -8,73 +8,72 @@ const state = {
avatar
:
''
,
avatar
:
''
,
introduction
:
''
,
introduction
:
''
,
roles
:
[]
roles
:
[]
}
}
;
const
mutations
=
{
const
mutations
=
{
SET_TOKEN
:
(
state
,
token
)
=>
{
SET_TOKEN
:
(
state
,
token
)
=>
{
state
.
token
=
token
state
.
token
=
token
;
},
},
SET_INTRODUCTION
:
(
state
,
introduction
)
=>
{
SET_INTRODUCTION
:
(
state
,
introduction
)
=>
{
state
.
introduction
=
introduction
state
.
introduction
=
introduction
;
},
},
SET_NAME
:
(
state
,
name
)
=>
{
SET_NAME
:
(
state
,
name
)
=>
{
state
.
name
=
name
state
.
name
=
name
;
},
},
SET_AVATAR
:
(
state
,
avatar
)
=>
{
SET_AVATAR
:
(
state
,
avatar
)
=>
{
state
.
avatar
=
avatar
state
.
avatar
=
avatar
;
},
},
SET_ROLES
:
(
state
,
roles
)
=>
{
SET_ROLES
:
(
state
,
roles
)
=>
{
state
.
roles
=
roles
state
.
roles
=
roles
;
}
}
}
}
;
const
actions
=
{
const
actions
=
{
// user login
// user login
login
({
commit
},
userInfo
)
{
login
({
commit
},
userInfo
)
{
const
{
username
,
password
}
=
userInfo
const
{
username
,
password
}
=
userInfo
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
login
({
username
:
username
.
trim
(),
password
:
password
})
login
({
username
:
username
.
trim
(),
password
:
password
})
.
then
(
response
=>
{
.
then
(
response
=>
{
const
{
data
}
=
response
const
{
data
}
=
response
;
commit
(
'
SET_TOKEN
'
,
data
.
token
)
commit
(
'
SET_TOKEN
'
,
data
.
token
)
;
setToken
(
data
.
token
)
setToken
(
data
.
token
)
;
resolve
()
resolve
()
;
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
;
})
})
;
})
})
;
},
},
// get user info
// get user info
getInfo
({
commit
,
state
})
{
getInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getInfo
(
state
.
token
)
getInfo
(
state
.
token
)
.
then
(
response
=>
{
.
then
(
response
=>
{
const
{
data
}
=
response
const
{
data
}
=
response
;
if
(
!
data
)
{
if
(
!
data
)
{
reject
(
'
Verification failed, please Login again.
'
)
reject
(
'
Verification failed, please Login again.
'
)
;
}
}
const
{
roles
,
name
,
avatar
,
introduction
}
=
data
const
{
roles
,
name
,
avatar
,
introduction
}
=
data
;
// roles must be a non-empty array
// roles must be a non-empty array
if
(
!
roles
||
roles
.
length
<=
0
)
{
if
(
!
roles
||
roles
.
length
<=
0
)
{
reject
(
'
getInfo: roles must be a non-null array!
'
)
reject
(
'
getInfo: roles must be a non-null array!
'
)
;
}
}
commit
(
'
SET_ROLES
'
,
roles
)
commit
(
'
SET_ROLES
'
,
roles
)
;
commit
(
'
SET_NAME
'
,
name
)
commit
(
'
SET_NAME
'
,
name
)
;
commit
(
'
SET_AVATAR
'
,
avatar
)
commit
(
'
SET_AVATAR
'
,
avatar
)
;
commit
(
'
SET_INTRODUCTION
'
,
introduction
)
commit
(
'
SET_INTRODUCTION
'
,
introduction
)
;
resolve
(
data
)
resolve
(
data
)
;
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
;
})
})
;
})
})
;
},
},
// user logout
// user logout
...
@@ -82,59 +81,59 @@ const actions = {
...
@@ -82,59 +81,59 @@ const actions = {
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
logout
(
state
.
token
)
logout
(
state
.
token
)
.
then
(()
=>
{
.
then
(()
=>
{
commit
(
'
SET_TOKEN
'
,
''
)
commit
(
'
SET_TOKEN
'
,
''
)
;
commit
(
'
SET_ROLES
'
,
[])
commit
(
'
SET_ROLES
'
,
[])
;
removeToken
()
removeToken
()
;
resetRouter
()
resetRouter
()
;
resolve
()
resolve
()
;
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
;
})
})
;
})
})
;
},
},
// remove token
// remove token
resetToken
({
commit
})
{
resetToken
({
commit
})
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
commit
(
'
SET_TOKEN
'
,
''
)
commit
(
'
SET_TOKEN
'
,
''
)
;
commit
(
'
SET_ROLES
'
,
[])
commit
(
'
SET_ROLES
'
,
[])
;
removeToken
()
removeToken
()
;
resolve
()
resolve
()
;
})
})
;
},
},
// dynamically modify permissions
// dynamically modify permissions
changeRoles
({
commit
,
dispatch
},
role
)
{
changeRoles
({
commit
,
dispatch
},
role
)
{
return
new
Promise
(
async
resolve
=>
{
return
new
Promise
(
async
resolve
=>
{
const
token
=
role
+
'
-token
'
const
token
=
role
+
'
-token
'
;
commit
(
'
SET_TOKEN
'
,
token
)
commit
(
'
SET_TOKEN
'
,
token
)
;
setToken
(
token
)
setToken
(
token
)
;
const
{
roles
}
=
await
dispatch
(
'
getInfo
'
)
const
{
roles
}
=
await
dispatch
(
'
getInfo
'
)
;
resetRouter
()
resetRouter
()
;
// generate accessible routes map based on roles
// generate accessible routes map based on roles
const
accessRoutes
=
await
dispatch
(
'
permission/generateRoutes
'
,
roles
,
{
const
accessRoutes
=
await
dispatch
(
'
permission/generateRoutes
'
,
roles
,
{
root
:
true
root
:
true
})
})
;
// dynamically add accessible routes
// dynamically add accessible routes
router
.
addRoutes
(
accessRoutes
)
router
.
addRoutes
(
accessRoutes
)
;
// reset visited views and cached views
// reset visited views and cached views
dispatch
(
'
tagsView/delAllViews
'
,
null
,
{
root
:
true
})
dispatch
(
'
tagsView/delAllViews
'
,
null
,
{
root
:
true
})
;
resolve
()
resolve
()
;
})
})
;
}
}
}
}
;
export
default
{
export
default
{
namespaced
:
true
,
namespaced
:
true
,
state
,
state
,
mutations
,
mutations
,
actions
actions
}
}
;
ve-admin/admin-web/src/utils/object-util.js
View file @
e24b97ee
/*
/*
* @
Description: In User Settings Edit
* @
Author: 一日看尽长安花
* @
Author: your name
* @
since: 2019-10-11 17:40:57
* @
Dat
e: 2019-10-1
1
1
7
:4
0:57
* @
LastEditTim
e: 2019-10-1
6
1
0
:4
6:40
* @LastEdit
Time: 2019-10-12 09:24:07
* @LastEdit
ors: 一日看尽长安花
* @
LastEditors: Please set LastEditors
* @
Description:
*/
*/
/**
/**
* @description: obj
不
存在。由于js存在undefined 和 null两种特殊的数据类型,认为从空间和引用指向上,只要有一个不存在则判断为不存在。
* @description: obj存在
为true
。由于js存在undefined 和 null两种特殊的数据类型,认为从空间和引用指向上,只要有一个不存在则判断为不存在。
* @param {Object}
* @param {Object}
* @return {Boolean}
* @return {Boolean}
*/
*/
export
function
isExists
(
obj
)
{
export
function
isExists
(
obj
)
{
return
void
0
===
obj
||
null
===
obj
;
return
obj
!==
void
0
&&
obj
!==
null
;
}
}
/**
/**
* @description: obj存在
* @description: obj
不
存在
为true。
* @param {Object}
* @param {Object}
* @return {Boolean}
* @return {Boolean}
*/
*/
export
function
isNotExists
(
obj
)
{
export
function
isNotExists
(
obj
)
{
return
!
isExists
(
obj
)
;
return
obj
===
void
0
||
obj
===
null
;
}
}
ve-admin/admin-web/src/utils/request.js
View file @
e24b97ee
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
* @Description: In User Settings Edit
* @Description: In User Settings Edit
* @Author: your name
* @Author: your name
* @Date: 2019-09-09 12:16:28
* @Date: 2019-09-09 12:16:28
* @LastEditTime: 2019-
09-09 12:16:28
* @LastEditTime: 2019-
10-27 23:12:07
* @LastEditors:
your name
* @LastEditors:
一日看尽长安花
*/
*/
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
MessageBox
,
Message
}
from
'
element-ui
'
;
import
{
MessageBox
,
Message
}
from
'
element-ui
'
;
...
...
ve-admin/admin-web/src/utils/str-util.js
View file @
e24b97ee
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
* @Description: 字符串工具类
* @Description: 字符串工具类
* @Author: 一日看尽长安花
* @Author: 一日看尽长安花
* @Date: 2019-10-11 17:40:47
* @Date: 2019-10-11 17:40:47
* @LastEditTime: 2019-10-1
2 09:36:33
* @LastEditTime: 2019-10-1
6 10:59:45
* @LastEditors:
Please set LastEditors
* @LastEditors:
一日看尽长安花
*/
*/
import
{
isExists
,
isNotExists
}
from
'
@/utils/object-util
'
;
import
{
isExists
,
isNotExists
}
from
'
@/utils/object-util
'
;
import
{
isString
,
trim
}
from
'
lodash
'
;
import
{
isString
,
trim
}
from
'
lodash
'
;
...
@@ -48,3 +48,31 @@ export function isNotBlank(str) {
...
@@ -48,3 +48,31 @@ export function isNotBlank(str) {
throw
'
str is null
'
;
throw
'
str is null
'
;
}
}
}
}
/**
* @description: 比较字符串
* @param {String, String, Boolean}
* @return {Boolean}
*/
export
function
equals
(
str1
,
str2
,
ignoreCase
=
false
)
{
if
(
isNotExists
(
str1
))
{
return
isNotExists
(
str2
);
}
if
(
isNotExists
(
str2
))
{
return
false
;
}
if
(
ignoreCase
)
{
return
str1
.
toLowerCase
()
===
str2
.
toLowerCase
();
}
else
{
return
str1
===
str2
;
}
}
/**
* @description: 比较字符串,比较时忽视大小写比较
* @param {String, String}
* @return {Boolean}
*/
export
function
equalsIgnoreCase
(
str1
,
str2
)
{
return
equals
(
str1
,
str2
,
true
);
}
ve-admin/admin-web/src/views/login/index.vue
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-09-04 20:55:14
* @LastEditTime: 2019-10-27 22:58:09
* @LastEditors: 一日看尽长安花
* @Description:
-->
<
template
>
<
template
>
<div
class=
"login-container"
>
<div
class=
"login-container"
>
<el-form
<el-form
...
@@ -92,8 +99,8 @@
...
@@ -92,8 +99,8 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
validUsername
}
from
'
@/utils/validate
'
import
{
validUsername
}
from
'
@/utils/validate
'
;
import
SocialSign
from
'
./components/SocialSignin
'
import
SocialSign
from
'
./components/SocialSignin
'
;
export
default
{
export
default
{
name
:
'
Login
'
,
name
:
'
Login
'
,
...
@@ -101,18 +108,18 @@ export default {
...
@@ -101,18 +108,18 @@ export default {
data
()
{
data
()
{
const
validateUsername
=
(
rule
,
value
,
callback
)
=>
{
const
validateUsername
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
validUsername
(
value
))
{
if
(
!
validUsername
(
value
))
{
callback
(
new
Error
(
'
Please enter the correct user name
'
))
callback
(
new
Error
(
'
Please enter the correct user name
'
))
;
}
else
{
}
else
{
callback
()
callback
()
;
}
}
}
}
;
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
.
length
<
6
)
{
if
(
value
.
length
<
6
)
{
callback
(
new
Error
(
'
The password can not be less than 6 digits
'
))
callback
(
new
Error
(
'
The password can not be less than 6 digits
'
))
;
}
else
{
}
else
{
callback
()
callback
()
;
}
}
}
}
;
return
{
return
{
loginForm
:
{
loginForm
:
{
username
:
'
admin
'
,
username
:
'
admin
'
,
...
@@ -132,15 +139,15 @@ export default {
...
@@ -132,15 +139,15 @@ export default {
showDialog
:
false
,
showDialog
:
false
,
redirect
:
undefined
,
redirect
:
undefined
,
otherQuery
:
{}
otherQuery
:
{}
}
}
;
},
},
watch
:
{
watch
:
{
$route
:
{
$route
:
{
handler
:
function
(
route
)
{
handler
:
function
(
route
)
{
const
query
=
route
.
query
const
query
=
route
.
query
;
if
(
query
)
{
if
(
query
)
{
this
.
redirect
=
query
.
redirect
this
.
redirect
=
query
.
redirect
;
this
.
otherQuery
=
this
.
getOtherQuery
(
query
)
this
.
otherQuery
=
this
.
getOtherQuery
(
query
)
;
}
}
},
},
immediate
:
true
immediate
:
true
...
@@ -151,9 +158,9 @@ export default {
...
@@ -151,9 +158,9 @@ export default {
},
},
mounted
()
{
mounted
()
{
if
(
this
.
loginForm
.
username
===
''
)
{
if
(
this
.
loginForm
.
username
===
''
)
{
this
.
$refs
.
username
.
focus
()
this
.
$refs
.
username
.
focus
()
;
}
else
if
(
this
.
loginForm
.
password
===
''
)
{
}
else
if
(
this
.
loginForm
.
password
===
''
)
{
this
.
$refs
.
password
.
focus
()
this
.
$refs
.
password
.
focus
()
;
}
}
},
},
destroyed
()
{
destroyed
()
{
...
@@ -166,54 +173,54 @@ export default {
...
@@ -166,54 +173,54 @@ export default {
(
shiftKey
&&
(
key
>=
'
a
'
&&
key
<=
'
z
'
))
||
(
shiftKey
&&
(
key
>=
'
a
'
&&
key
<=
'
z
'
))
||
(
!
shiftKey
&&
(
key
>=
'
A
'
&&
key
<=
'
Z
'
))
(
!
shiftKey
&&
(
key
>=
'
A
'
&&
key
<=
'
Z
'
))
)
{
)
{
this
.
capsTooltip
=
true
this
.
capsTooltip
=
true
;
}
else
{
}
else
{
this
.
capsTooltip
=
false
this
.
capsTooltip
=
false
;
}
}
}
}
if
(
key
===
'
CapsLock
'
&&
this
.
capsTooltip
===
true
)
{
if
(
key
===
'
CapsLock
'
&&
this
.
capsTooltip
===
true
)
{
this
.
capsTooltip
=
false
this
.
capsTooltip
=
false
;
}
}
},
},
showPwd
()
{
showPwd
()
{
if
(
this
.
passwordType
===
'
password
'
)
{
if
(
this
.
passwordType
===
'
password
'
)
{
this
.
passwordType
=
''
this
.
passwordType
=
''
;
}
else
{
}
else
{
this
.
passwordType
=
'
password
'
this
.
passwordType
=
'
password
'
;
}
}
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
password
.
focus
()
this
.
$refs
.
password
.
focus
()
;
})
})
;
},
},
handleLogin
()
{
handleLogin
()
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
loading
=
true
this
.
loading
=
true
;
this
.
$store
this
.
$store
.
dispatch
(
'
user/login
'
,
this
.
loginForm
)
.
dispatch
(
'
user/login
'
,
this
.
loginForm
)
.
then
(()
=>
{
.
then
(()
=>
{
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
this
.
redirect
||
'
/
'
,
path
:
this
.
redirect
||
'
/
'
,
query
:
this
.
otherQuery
query
:
this
.
otherQuery
})
})
;
this
.
loading
=
false
this
.
loading
=
false
;
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
loading
=
false
this
.
loading
=
false
;
})
})
;
}
else
{
}
else
{
console
.
log
(
'
error submit!!
'
)
console
.
log
(
'
error submit!!
'
)
;
return
false
return
false
;
}
}
})
})
;
},
},
getOtherQuery
(
query
)
{
getOtherQuery
(
query
)
{
return
Object
.
keys
(
query
).
reduce
((
acc
,
cur
)
=>
{
return
Object
.
keys
(
query
).
reduce
((
acc
,
cur
)
=>
{
if
(
cur
!==
'
redirect
'
)
{
if
(
cur
!==
'
redirect
'
)
{
acc
[
cur
]
=
query
[
cur
]
acc
[
cur
]
=
query
[
cur
]
;
}
}
return
acc
return
acc
;
},
{})
},
{})
;
}
}
// afterQRScan() {
// afterQRScan() {
// if (e.key === 'x-admin-oauth-code') {
// if (e.key === 'x-admin-oauth-code') {
...
@@ -234,7 +241,7 @@ export default {
...
@@ -234,7 +241,7 @@ export default {
// }
// }
// }
// }
}
}
}
}
;
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
...
...
ve-admin/admin-web/src/views/users/index.vue
0 → 100644
View file @
e24b97ee
<!--
* @Author: 一日看尽长安花
* @since: 2019-10-12 15:43:18
* @LastEditTime: 2019-10-27 22:49:20
* @LastEditors: 一日看尽长安花
* @Description:
-->
<
template
>
<div>
<table-views
:metedata=
"metedata"
:tabledata.sync=
"tabledata"
:loading=
"loading"
:search-method=
"searchMethod"
@
pagination=
"pagination"
@
filter-search=
"filterSearch"
@
create-data=
"createData"
@
delete-data=
"deleteData"
@
update-data=
"updateData"
></table-views>
</div>
</
template
>
<
script
>
import
TableViews
from
'
@/components/TableViews
'
;
import
{
users
,
usersMetedata
}
from
'
@/api/user
'
;
export
default
{
name
:
'
Demo2
'
,
components
:
{
TableViews
},
props
:
{},
data
()
{
return
{
// 整个页面的数据
metedata
:
{},
tabledata
:
{
data
:
[],
total
:
0
},
loading
:
true
};
},
computed
:
{},
mounted
()
{
this
.
obtainMetedata
();
this
.
obtainData
();
},
methods
:
{
obtainMetedata
()
{
this
.
loading
=
true
;
usersMetedata
()
.
then
(
result
=>
{
const
{
code
,
data
}
=
{
...
result
};
this
.
metedata
=
Object
.
assign
({},
data
);
})
.
catch
(
err
=>
{})
.
finally
(()
=>
{
this
.
loading
=
false
;
});
},
obtainData
(
queryParams
)
{
this
.
loading
=
true
;
users
(
queryParams
)
.
then
(
result
=>
{
const
{
code
,
data
}
=
{
...
result
};
this
.
tabledata
=
Object
.
assign
({},
data
);
})
.
catch
(
err
=>
{})
.
finally
(()
=>
{
this
.
loading
=
false
;
});
},
pagination
(
queryParams
)
{
this
.
obtainData
(
queryParams
);
},
searchMethod
(
search
,
tableData
)
{
return
tableData
.
filter
(
d
=>
!
search
||
d
.
name
.
toLowerCase
().
includes
(
search
.
toLowerCase
())
);
},
filterSearch
(
queryParams
)
{
this
.
obtainData
(
queryParams
);
},
createData
(
dialogData
)
{
this
.
$nextTick
(()
=>
{
this
.
$notify
({
title
:
'
成功
'
,
message
:
'
添加成功
'
,
type
:
'
success
'
,
duration
:
2000
});
});
},
updateData
(
dialogData
)
{
this
.
$nextTick
(()
=>
{
this
.
$notify
({
title
:
'
成功
'
,
message
:
'
修改成功
'
,
type
:
'
success
'
,
duration
:
2000
});
});
},
deleteData
(
index
,
row
)
{
this
.
$nextTick
(()
=>
{
this
.
$notify
({
title
:
'
成功
'
,
message
:
'
删除成功
'
,
type
:
'
success
'
,
duration
:
2000
});
});
}
}
};
</
script
>
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment