Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
6236d3c0
Commit
6236d3c0
authored
Apr 11, 2019
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
excel的导入优化
parent
47980989
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
190 deletions
+18
-190
src/main/java/cn/stylefeng/guns/modular/demos/entity/ExcelItem.java
+18
-18
src/main/webapp/assets/modular/demos/excel_import.js
+0
-172
No files found.
src/main/java/cn/stylefeng/guns/modular/demos/entity/ExcelItem.java
View file @
6236d3c0
...
...
@@ -24,121 +24,121 @@ public class ExcelItem implements Serializable {
/**
* 主键id
*/
@TableId
(
value
=
"
USER_ID
"
,
type
=
IdType
.
ID_WORKER
)
@TableId
(
value
=
"
user_id
"
,
type
=
IdType
.
ID_WORKER
)
@Excel
(
name
=
"用户id"
)
private
Long
userId
;
/**
* 头像
*/
@TableField
(
"
AVATAR
"
)
@TableField
(
"
avatar
"
)
@Excel
(
name
=
"头像"
)
private
String
avatar
;
/**
* 账号
*/
@TableField
(
"
ACCOUNT
"
)
@TableField
(
"
account
"
)
@Excel
(
name
=
"账号"
)
private
String
account
;
/**
* 密码
*/
@TableField
(
"
PASSWORD
"
)
@TableField
(
"
password
"
)
private
String
password
;
/**
* md5密码盐
*/
@TableField
(
"
SALT
"
)
@TableField
(
"
salt
"
)
private
String
salt
;
/**
* 名字
*/
@TableField
(
"
NAME
"
)
@TableField
(
"
name
"
)
@Excel
(
name
=
"姓名"
)
private
String
name
;
/**
* 生日
*/
@TableField
(
"birthday"
)
@Excel
(
name
=
"生日"
)
@TableField
(
"BIRTHDAY"
)
private
Date
birthday
;
/**
* 性别(字典)
*/
@TableField
(
"
SEX
"
)
@TableField
(
"
sex
"
)
@Excel
(
name
=
"性别"
)
private
String
sex
;
/**
* 电子邮件
*/
@TableField
(
"
EMAIL
"
)
@TableField
(
"
email
"
)
@Excel
(
name
=
"邮箱"
)
private
String
email
;
/**
* 电话
*/
@TableField
(
"
PHONE
"
)
@TableField
(
"
phone
"
)
@Excel
(
name
=
"电话"
)
private
String
phone
;
/**
* 角色id(多个逗号隔开)
*/
@TableField
(
"
ROLE_ID
"
)
@TableField
(
"
role_id
"
)
@Excel
(
name
=
"角色id"
)
private
String
roleId
;
/**
* 部门id(多个逗号隔开)
*/
@TableField
(
"
DEPT_ID
"
)
@TableField
(
"
dept_id
"
)
@Excel
(
name
=
"部门id"
)
private
Long
deptId
;
/**
* 状态(字典)
*/
@TableField
(
"
STATUS
"
)
@TableField
(
"
status
"
)
@Excel
(
name
=
"状态"
)
private
String
status
;
/**
* 创建时间
*/
@TableField
(
value
=
"
CREATE_TIME
"
,
fill
=
FieldFill
.
INSERT
)
@TableField
(
value
=
"
create_time
"
,
fill
=
FieldFill
.
INSERT
)
@Excel
(
name
=
"创建时间"
)
private
Date
createTime
;
/**
* 创建人
*/
@TableField
(
value
=
"
CREATE_USER
"
,
fill
=
FieldFill
.
INSERT
)
@TableField
(
value
=
"
create_user
"
,
fill
=
FieldFill
.
INSERT
)
private
Long
createUser
;
/**
* 更新时间
*/
@TableField
(
value
=
"
UPDATE_TIME
"
,
fill
=
FieldFill
.
UPDATE
)
@TableField
(
value
=
"
update_time
"
,
fill
=
FieldFill
.
UPDATE
)
private
Date
updateTime
;
/**
* 更新人
*/
@TableField
(
value
=
"
UPDATE_USER
"
,
fill
=
FieldFill
.
UPDATE
)
@TableField
(
value
=
"
update_user
"
,
fill
=
FieldFill
.
UPDATE
)
private
Long
updateUser
;
/**
* 乐观锁
*/
@TableField
(
"
VERSION
"
)
@TableField
(
"
version
"
)
private
Integer
version
;
}
src/main/webapp/assets/modular/demos/excel_import.js
View file @
6236d3c0
...
...
@@ -40,40 +40,6 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'ax','upload']
};
/**
* 选择部门时
*/
MgrUser
.
onClickDept
=
function
(
e
,
treeId
,
treeNode
)
{
MgrUser
.
condition
.
deptId
=
treeNode
.
id
;
MgrUser
.
search
();
};
/**
* 点击查询按钮
*/
MgrUser
.
search
=
function
()
{
var
queryData
=
{};
queryData
[
'deptId'
]
=
MgrUser
.
condition
.
deptId
;
queryData
[
'name'
]
=
$
(
"#name"
).
val
();
queryData
[
'timeLimit'
]
=
$
(
"#timeLimit"
).
val
();
table
.
reload
(
MgrUser
.
tableId
,
{
where
:
queryData
});
};
/**
* 弹出添加用户对话框
*/
MgrUser
.
openAddUser
=
function
()
{
admin
.
putTempData
(
'formOk'
,
false
);
top
.
layui
.
admin
.
open
({
type
:
2
,
title
:
'添加用户'
,
content
:
Feng
.
ctxPath
+
'/mgr/user_add'
,
end
:
function
()
{
admin
.
getTempData
(
'formOk'
)
&&
table
.
reload
(
MgrUser
.
tableId
);
}
});
};
/**
* 导出excel按钮
*/
MgrUser
.
exportExcel
=
function
()
{
...
...
@@ -85,104 +51,6 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'ax','upload']
}
};
/**
* 点击编辑用户按钮时
*
* @param data 点击按钮时候的行数据
*/
MgrUser
.
onEditUser
=
function
(
data
)
{
admin
.
putTempData
(
'formOk'
,
false
);
top
.
layui
.
admin
.
open
({
type
:
2
,
title
:
'编辑用户'
,
content
:
Feng
.
ctxPath
+
'/mgr/user_edit?userId='
+
data
.
userId
,
end
:
function
()
{
admin
.
getTempData
(
'formOk'
)
&&
table
.
reload
(
MgrUser
.
tableId
);
}
});
};
/**
* 点击删除用户按钮
*
* @param data 点击按钮时候的行数据
*/
MgrUser
.
onDeleteUser
=
function
(
data
)
{
var
operation
=
function
()
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/delete"
,
function
()
{
table
.
reload
(
MgrUser
.
tableId
);
Feng
.
success
(
"删除成功!"
);
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
"userId"
,
data
.
userId
);
ajax
.
start
();
};
Feng
.
confirm
(
"是否删除用户"
+
data
.
account
+
"?"
,
operation
);
};
/**
* 分配角色
*
* @param data 点击按钮时候的行数据
*/
MgrUser
.
roleAssign
=
function
(
data
)
{
layer
.
open
({
type
:
2
,
title
:
'角色分配'
,
area
:
[
'300px'
,
'400px'
],
content
:
Feng
.
ctxPath
+
'/mgr/role_assign?userId='
+
data
.
userId
,
end
:
function
()
{
table
.
reload
(
MgrUser
.
tableId
);
}
});
};
/**
* 重置密码
*
* @param data 点击按钮时候的行数据
*/
MgrUser
.
resetPassword
=
function
(
data
)
{
Feng
.
confirm
(
"是否重置密码为111111 ?"
,
function
()
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/reset"
,
function
(
data
)
{
Feng
.
success
(
"重置密码成功!"
);
},
function
(
data
)
{
Feng
.
error
(
"重置密码失败!"
);
});
ajax
.
set
(
"userId"
,
data
.
userId
);
ajax
.
start
();
});
};
/**
* 修改用户状态
*
* @param userId 用户id
* @param checked 是否选中(true,false),选中就是解锁用户,未选中就是锁定用户
*/
MgrUser
.
changeUserStatus
=
function
(
userId
,
checked
)
{
if
(
checked
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/unfreeze"
,
function
(
data
)
{
Feng
.
success
(
"解除冻结成功!"
);
},
function
(
data
)
{
Feng
.
error
(
"解除冻结失败!"
);
table
.
reload
(
MgrUser
.
tableId
);
});
ajax
.
set
(
"userId"
,
userId
);
ajax
.
start
();
}
else
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/freeze"
,
function
(
data
)
{
Feng
.
success
(
"冻结成功!"
);
},
function
(
data
)
{
Feng
.
error
(
"冻结失败!"
+
data
.
responseJSON
.
message
+
"!"
);
table
.
reload
(
MgrUser
.
tableId
);
});
ajax
.
set
(
"userId"
,
userId
);
ajax
.
start
();
}
};
// 渲染表格
var
tableResult
=
table
.
render
({
elem
:
'#'
+
MgrUser
.
tableId
,
...
...
@@ -200,21 +68,6 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'ax','upload']
max
:
Feng
.
currentDate
()
});
//初始化左侧部门树
var
ztree
=
new
$ZTree
(
"deptTree"
,
"/dept/tree"
);
ztree
.
bindOnClick
(
MgrUser
.
onClickDept
);
ztree
.
init
();
// 搜索按钮点击事件
$
(
'#btnSearch'
).
click
(
function
()
{
MgrUser
.
search
();
});
// 添加按钮点击事件
$
(
'#btnAdd'
).
click
(
function
()
{
MgrUser
.
openAddUser
();
});
//执行实例
var
uploadInst
=
upload
.
render
({
elem
:
'#btnExp'
...
...
@@ -228,29 +81,4 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'ax','upload']
}
});
// 工具条点击事件
table
.
on
(
'tool('
+
MgrUser
.
tableId
+
')'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
var
layEvent
=
obj
.
event
;
if
(
layEvent
===
'edit'
)
{
MgrUser
.
onEditUser
(
data
);
}
else
if
(
layEvent
===
'delete'
)
{
MgrUser
.
onDeleteUser
(
data
);
}
else
if
(
layEvent
===
'roleAssign'
)
{
MgrUser
.
roleAssign
(
data
);
}
else
if
(
layEvent
===
'reset'
)
{
MgrUser
.
resetPassword
(
data
);
}
});
// 修改user状态
form
.
on
(
'switch(status)'
,
function
(
obj
)
{
var
userId
=
obj
.
elem
.
value
;
var
checked
=
obj
.
elem
.
checked
?
true
:
false
;
MgrUser
.
changeUserStatus
(
userId
,
checked
);
});
});
Write
Preview
Markdown
is supported
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