Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
warehouse
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
胡懿
warehouse
Commits
a2ae1320
Commit
a2ae1320
authored
Feb 13, 2023
by
zhanglt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
货架信息表代码
parent
f443c581
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
899 additions
and
0 deletions
+899
-0
Shelves.java
...com/jeeplus/modules/warehouse/shelves/entity/Shelves.java
+58
-0
ShelvesMapper.java
...eplus/modules/warehouse/shelves/mapper/ShelvesMapper.java
+19
-0
ShelvesMapper.xml
...us/modules/warehouse/shelves/mapper/xml/ShelvesMapper.xml
+127
-0
ShelvesService.java
...lus/modules/warehouse/shelves/service/ShelvesService.java
+48
-0
ShelvesController.java
...plus/modules/warehouse/shelves/web/ShelvesController.java
+226
-0
shelvesForm.jsp
.../webapp/webpage/modules/warehouse/shelves/shelvesForm.jsp
+78
-0
shelvesList.js
...n/webapp/webpage/modules/warehouse/shelves/shelvesList.js
+256
-0
shelvesList.jsp
.../webapp/webpage/modules/warehouse/shelves/shelvesList.jsp
+87
-0
No files found.
src/main/java/com/jeeplus/modules/warehouse/shelves/entity/Shelves.java
0 → 100644
View file @
a2ae1320
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com
.
jeeplus
.
modules
.
warehouse
.
shelves
.
entity
;
import
com.jeeplus.core.persistence.DataEntity
;
import
com.jeeplus.common.utils.excel.annotation.ExcelField
;
/**
* 货架信息Entity
* @author zhanglt
* @version 2023-02-13
*/
public
class
Shelves
extends
DataEntity
<
Shelves
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
name
;
// 货架名称
private
String
number
;
// 货架编号
private
String
warehouse
;
// 仓库id
public
Shelves
()
{
super
();
}
public
Shelves
(
String
id
){
super
(
id
);
}
@ExcelField
(
title
=
"货架名称"
,
align
=
2
,
sort
=
1
)
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
@ExcelField
(
title
=
"货架编号"
,
align
=
2
,
sort
=
2
)
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
@ExcelField
(
title
=
"仓库id"
,
dictType
=
""
,
align
=
2
,
sort
=
3
)
public
String
getWarehouse
()
{
return
warehouse
;
}
public
void
setWarehouse
(
String
warehouse
)
{
this
.
warehouse
=
warehouse
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/shelves/mapper/ShelvesMapper.java
0 → 100644
View file @
a2ae1320
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com
.
jeeplus
.
modules
.
warehouse
.
shelves
.
mapper
;
import
com.jeeplus.core.persistence.BaseMapper
;
import
com.jeeplus.core.persistence.annotation.MyBatisMapper
;
import
com.jeeplus.modules.warehouse.shelves.entity.Shelves
;
/**
* 货架信息MAPPER接口
* @author zhanglt
* @version 2023-02-13
*/
@MyBatisMapper
public
interface
ShelvesMapper
extends
BaseMapper
<
Shelves
>
{
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/shelves/mapper/xml/ShelvesMapper.xml
0 → 100644
View file @
a2ae1320
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jeeplus.modules.warehouse.shelves.mapper.ShelvesMapper"
>
<sql
id=
"shelvesColumns"
>
a.id AS "id",
a.name AS "name",
a.number AS "number",
a.warehouse_id AS "warehouse.id",
a.remarks AS "remarks",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag"
</sql>
<sql
id=
"shelvesJoins"
>
</sql>
<select
id=
"get"
resultType=
"Shelves"
>
SELECT
<include
refid=
"shelvesColumns"
/>
FROM t_wh_shelves a
<include
refid=
"shelvesJoins"
/>
WHERE a.id = #{id}
</select>
<select
id=
"findList"
resultType=
"Shelves"
>
SELECT
<include
refid=
"shelvesColumns"
/>
FROM t_wh_shelves a
<include
refid=
"shelvesJoins"
/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select
id=
"findAllList"
resultType=
"Shelves"
>
SELECT
<include
refid=
"shelvesColumns"
/>
FROM t_wh_shelves a
<include
refid=
"shelvesJoins"
/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert
id=
"insert"
>
INSERT INTO t_wh_shelves(
id,
name,
number,
warehouse_id,
remarks,
create_by,
create_date,
update_by,
update_date,
del_flag
) VALUES (
#{id},
#{name},
#{number},
#{warehouse.id},
#{remarks},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{delFlag}
)
</insert>
<update
id=
"update"
>
UPDATE t_wh_shelves SET
name = #{name},
number = #{number},
warehouse_id = #{warehouse.id},
remarks = #{remarks},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
<!--物理删除-->
<update
id=
"delete"
>
DELETE FROM t_wh_shelves
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update
id=
"deleteByLogic"
>
UPDATE t_wh_shelves SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select
id=
"findUniqueByProperty"
resultType=
"Shelves"
statementType=
"STATEMENT"
>
select * FROM t_wh_shelves where ${propertyName} = '${value}'
</select>
</mapper>
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/shelves/service/ShelvesService.java
0 → 100644
View file @
a2ae1320
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com
.
jeeplus
.
modules
.
warehouse
.
shelves
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeeplus.core.persistence.Page
;
import
com.jeeplus.core.service.CrudService
;
import
com.jeeplus.modules.warehouse.shelves.entity.Shelves
;
import
com.jeeplus.modules.warehouse.shelves.mapper.ShelvesMapper
;
/**
* 货架信息Service
* @author zhanglt
* @version 2023-02-13
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
ShelvesService
extends
CrudService
<
ShelvesMapper
,
Shelves
>
{
public
Shelves
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
Shelves
>
findList
(
Shelves
shelves
)
{
return
super
.
findList
(
shelves
);
}
public
Page
<
Shelves
>
findPage
(
Page
<
Shelves
>
page
,
Shelves
shelves
)
{
return
super
.
findPage
(
page
,
shelves
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
Shelves
shelves
)
{
super
.
save
(
shelves
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
Shelves
shelves
)
{
super
.
delete
(
shelves
);
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/shelves/web/ShelvesController.java
0 → 100644
View file @
a2ae1320
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com
.
jeeplus
.
modules
.
warehouse
.
shelves
.
web
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.ConstraintViolationException
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.google.common.collect.Lists
;
import
com.jeeplus.common.utils.DateUtils
;
import
com.jeeplus.common.config.Global
;
import
com.jeeplus.common.json.AjaxJson
;
import
com.jeeplus.core.persistence.Page
;
import
com.jeeplus.core.web.BaseController
;
import
com.jeeplus.common.utils.StringUtils
;
import
com.jeeplus.common.utils.excel.ExportExcel
;
import
com.jeeplus.common.utils.excel.ImportExcel
;
import
com.jeeplus.modules.warehouse.shelves.entity.Shelves
;
import
com.jeeplus.modules.warehouse.shelves.service.ShelvesService
;
/**
* 货架信息Controller
* @author zhanglt
* @version 2023-02-13
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/warehouse/shelves/shelves"
)
public
class
ShelvesController
extends
BaseController
{
@Autowired
private
ShelvesService
shelvesService
;
@ModelAttribute
public
Shelves
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
Shelves
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
shelvesService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
Shelves
();
}
return
entity
;
}
/**
* 货架信息列表页面
*/
@RequiresPermissions
(
"warehouse:shelves:shelves:list"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
Shelves
shelves
,
Model
model
)
{
model
.
addAttribute
(
"shelves"
,
shelves
);
return
"modules/warehouse/shelves/shelvesList"
;
}
/**
* 货架信息列表数据
*/
@ResponseBody
@RequiresPermissions
(
"warehouse:shelves:shelves:list"
)
@RequestMapping
(
value
=
"data"
)
public
Map
<
String
,
Object
>
data
(
Shelves
shelves
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
Shelves
>
page
=
shelvesService
.
findPage
(
new
Page
<
Shelves
>(
request
,
response
),
shelves
);
return
getBootstrapData
(
page
);
}
/**
* 查看,增加,编辑货架信息表单页面
*/
@RequiresPermissions
(
value
={
"warehouse:shelves:shelves:view"
,
"warehouse:shelves:shelves:add"
,
"warehouse:shelves:shelves:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"form/{mode}"
)
public
String
form
(
@PathVariable
String
mode
,
Shelves
shelves
,
Model
model
)
{
model
.
addAttribute
(
"shelves"
,
shelves
);
model
.
addAttribute
(
"mode"
,
mode
);
return
"modules/warehouse/shelves/shelvesForm"
;
}
/**
* 保存货架信息
*/
@ResponseBody
@RequiresPermissions
(
value
={
"warehouse:shelves:shelves:add"
,
"warehouse:shelves:shelves:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"save"
)
public
AjaxJson
save
(
Shelves
shelves
,
Model
model
)
throws
Exception
{
AjaxJson
j
=
new
AjaxJson
();
/**
* 后台hibernate-validation插件校验
*/
String
errMsg
=
beanValidator
(
shelves
);
if
(
StringUtils
.
isNotBlank
(
errMsg
)){
j
.
setSuccess
(
false
);
j
.
setMsg
(
errMsg
);
return
j
;
}
//新增或编辑表单保存
shelvesService
.
save
(
shelves
);
//保存
j
.
setSuccess
(
true
);
j
.
setMsg
(
"保存货架信息成功"
);
return
j
;
}
/**
* 删除货架信息
*/
@ResponseBody
@RequiresPermissions
(
"warehouse:shelves:shelves:del"
)
@RequestMapping
(
value
=
"delete"
)
public
AjaxJson
delete
(
Shelves
shelves
)
{
AjaxJson
j
=
new
AjaxJson
();
shelvesService
.
delete
(
shelves
);
j
.
setMsg
(
"删除货架信息成功"
);
return
j
;
}
/**
* 批量删除货架信息
*/
@ResponseBody
@RequiresPermissions
(
"warehouse:shelves:shelves:del"
)
@RequestMapping
(
value
=
"deleteAll"
)
public
AjaxJson
deleteAll
(
String
ids
)
{
AjaxJson
j
=
new
AjaxJson
();
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
shelvesService
.
delete
(
shelvesService
.
get
(
id
));
}
j
.
setMsg
(
"删除货架信息成功"
);
return
j
;
}
/**
* 导出excel文件
*/
@ResponseBody
@RequiresPermissions
(
"warehouse:shelves:shelves:export"
)
@RequestMapping
(
value
=
"export"
)
public
AjaxJson
exportFile
(
Shelves
shelves
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
AjaxJson
j
=
new
AjaxJson
();
try
{
String
fileName
=
"货架信息"
+
DateUtils
.
getDate
(
"yyyyMMddHHmmss"
)+
".xlsx"
;
Page
<
Shelves
>
page
=
shelvesService
.
findPage
(
new
Page
<
Shelves
>(
request
,
response
,
-
1
),
shelves
);
new
ExportExcel
(
"货架信息"
,
Shelves
.
class
).
setDataList
(
page
.
getList
()).
write
(
response
,
fileName
).
dispose
();
j
.
setSuccess
(
true
);
j
.
setMsg
(
"导出成功!"
);
return
j
;
}
catch
(
Exception
e
)
{
j
.
setSuccess
(
false
);
j
.
setMsg
(
"导出货架信息记录失败!失败信息:"
+
e
.
getMessage
());
}
return
j
;
}
/**
* 导入Excel数据
*/
@ResponseBody
@RequiresPermissions
(
"warehouse:shelves:shelves:import"
)
@RequestMapping
(
value
=
"import"
)
public
AjaxJson
importFile
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
AjaxJson
j
=
new
AjaxJson
();
try
{
int
successNum
=
0
;
int
failureNum
=
0
;
StringBuilder
failureMsg
=
new
StringBuilder
();
ImportExcel
ei
=
new
ImportExcel
(
file
,
1
,
0
);
List
<
Shelves
>
list
=
ei
.
getDataList
(
Shelves
.
class
);
for
(
Shelves
shelves
:
list
){
try
{
shelvesService
.
save
(
shelves
);
successNum
++;
}
catch
(
ConstraintViolationException
ex
){
failureNum
++;
}
catch
(
Exception
ex
)
{
failureNum
++;
}
}
if
(
failureNum
>
0
){
failureMsg
.
insert
(
0
,
",失败 "
+
failureNum
+
" 条货架信息记录。"
);
}
j
.
setMsg
(
"已成功导入 "
+
successNum
+
" 条货架信息记录"
+
failureMsg
);
}
catch
(
Exception
e
)
{
j
.
setSuccess
(
false
);
j
.
setMsg
(
"导入货架信息失败!失败信息:"
+
e
.
getMessage
());
}
return
j
;
}
/**
* 下载导入货架信息数据模板
*/
@ResponseBody
@RequiresPermissions
(
"warehouse:shelves:shelves:import"
)
@RequestMapping
(
value
=
"import/template"
)
public
AjaxJson
importFileTemplate
(
HttpServletResponse
response
)
{
AjaxJson
j
=
new
AjaxJson
();
try
{
String
fileName
=
"货架信息数据导入模板.xlsx"
;
List
<
Shelves
>
list
=
Lists
.
newArrayList
();
new
ExportExcel
(
"货架信息数据"
,
Shelves
.
class
,
1
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
j
.
setSuccess
(
false
);
j
.
setMsg
(
"导入模板下载失败!失败信息:"
+
e
.
getMessage
());
}
return
j
;
}
}
\ No newline at end of file
src/main/webapp/webpage/modules/warehouse/shelves/shelvesForm.jsp
0 → 100644
View file @
a2ae1320
<
%@
page
contentType=
"text/html;charset=UTF-8"
%
>
<
%@
include
file=
"/webpage/include/taglib.jsp"
%
>
<html>
<head>
<title>
货架信息管理
</title>
<meta
name=
"decorator"
content=
"ani"
/>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
jp
.
ajaxForm
(
"#inputForm"
,
function
(
data
){
if
(
data
.
success
){
jp
.
success
(
data
.
msg
);
jp
.
go
(
"${ctx}/warehouse/shelves/shelves"
);
}
else
{
jp
.
error
(
data
.
msg
);
$
(
"#inputForm"
).
find
(
"button:submit"
).
button
(
"reset"
);
}
});
});
</script>
</head>
<body>
<div
class=
"wrapper wrapper-content"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
<a
class=
"panelButton"
href=
"${ctx}/warehouse/shelves/shelves"
><i
class=
"ti-angle-left"
></i>
返回
</a>
</h3>
</div>
<div
class=
"panel-body"
>
<form:form
id=
"inputForm"
modelAttribute=
"shelves"
action=
"${ctx}/warehouse/shelves/shelves/save"
method=
"post"
class=
"form-horizontal"
>
<form:hidden
path=
"id"
/>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
><font
color=
"red"
>
*
</font>
货架名称:
</label>
<div
class=
"col-sm-10"
>
<form:input
path=
"name"
htmlEscape=
"false"
class=
"form-control required"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
><font
color=
"red"
>
*
</font>
货架编号:
</label>
<div
class=
"col-sm-10"
>
<form:input
path=
"number"
htmlEscape=
"false"
class=
"form-control required"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
仓库id:
</label>
<div
class=
"col-sm-10"
>
<form:radiobuttons
path=
"warehouse.id"
items=
"${fns:getDictList('')}"
itemLabel=
"label"
itemValue=
"value"
htmlEscape=
"false"
class=
"i-checks "
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
备注信息:
</label>
<div
class=
"col-sm-10"
>
<form:textarea
path=
"remarks"
htmlEscape=
"false"
rows=
"4"
class=
"form-control "
/>
</div>
</div>
<c:if
test=
"${mode == 'add' || mode=='edit'}"
>
<div
class=
"col-lg-3"
></div>
<div
class=
"col-lg-6"
>
<div
class=
"form-group text-center"
>
<div>
<button
class=
"btn btn-primary btn-block btn-lg btn-parsley"
data-loading-text=
"正在提交..."
>
提 交
</button>
</div>
</div>
</div>
</c:if>
</form:form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
src/main/webapp/webpage/modules/warehouse/shelves/shelvesList.js
0 → 100644
View file @
a2ae1320
<%
@
page
contentType
=
"text/html;charset=UTF-8"
%>
<
script
>
$
(
document
).
ready
(
function
()
{
$
(
'#shelvesTable'
).
bootstrapTable
({
//请求方法
method
:
'post'
,
//类型json
dataType
:
"json"
,
contentType
:
"application/x-www-form-urlencoded"
,
//显示检索按钮
showSearch
:
true
,
//显示刷新按钮
showRefresh
:
true
,
//显示切换手机试图按钮
showToggle
:
true
,
//显示 内容列下拉框
showColumns
:
true
,
//显示到处按钮
showExport
:
true
,
//显示切换分页按钮
showPaginationSwitch
:
true
,
//最低显示2行
minimumCountColumns
:
2
,
//是否显示行间隔色
striped
:
true
,
//是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
cache
:
false
,
//是否显示分页(*)
pagination
:
true
,
//排序方式
sortOrder
:
"asc"
,
//初始化加载第一页,默认第一页
pageNumber
:
1
,
//每页的记录行数(*)
pageSize
:
10
,
//可供选择的每页的行数(*)
pageList
:
[
10
,
25
,
50
,
100
],
//这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
url
:
"${ctx}/warehouse/shelves/shelves/data"
,
//默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
//queryParamsType:'',
////查询参数,每次调用是会带上这个参数,可自定义
queryParams
:
function
(
params
)
{
var
searchParam
=
$
(
"#searchForm"
).
serializeJSON
();
searchParam
.
pageNo
=
params
.
limit
===
undefined
?
"1"
:
params
.
offset
/
params
.
limit
+
1
;
searchParam
.
pageSize
=
params
.
limit
===
undefined
?
-
1
:
params
.
limit
;
searchParam
.
orderBy
=
params
.
sort
===
undefined
?
""
:
params
.
sort
+
" "
+
params
.
order
;
return
searchParam
;
},
//分页方式:client客户端分页,server服务端分页(*)
sidePagination
:
"server"
,
contextMenuTrigger
:
"right"
,
//pc端 按右键弹出菜单
contextMenuTriggerMobile
:
"press"
,
//手机端 弹出菜单,click:单击, press:长按。
contextMenu
:
'#context-menu'
,
onContextMenuItem
:
function
(
row
,
$el
){
if
(
$el
.
data
(
"item"
)
==
"edit"
){
edit
(
row
.
id
);
}
else
if
(
$el
.
data
(
"item"
)
==
"view"
){
view
(
row
.
id
);
}
else
if
(
$el
.
data
(
"item"
)
==
"delete"
){
jp
.
confirm
(
'确认要删除该货架信息记录吗?'
,
function
(){
jp
.
loading
();
jp
.
get
(
"${ctx}/warehouse/shelves/shelves/delete?id="
+
row
.
id
,
function
(
data
){
if
(
data
.
success
){
$
(
'#shelvesTable'
).
bootstrapTable
(
'refresh'
);
jp
.
success
(
data
.
msg
);
}
else
{
jp
.
error
(
data
.
msg
);
}
})
});
}
},
onClickRow
:
function
(
row
,
$el
){
},
onShowSearch
:
function
()
{
$
(
"#search-collapse"
).
slideToggle
();
},
columns
:
[{
checkbox
:
true
}
,{
field
:
'name'
,
title
:
'货架名称'
,
sortable
:
true
,
sortName
:
'name'
,
formatter
:
function
(
value
,
row
,
index
){
value
=
jp
.
unescapeHTML
(
value
);
<
c
:
choose
>
<
c
:
when
test
=
"${fns:hasPermission('warehouse:shelves:shelves:edit')}"
>
return
"<a href='javascript:edit(
\"
"
+
row
.
id
+
"
\"
)'>"
+
value
+
"</a>"
;
<
/c:when
>
<
c
:
when
test
=
"${fns:hasPermission('warehouse:shelves:shelves:view')}"
>
return
"<a href='javascript:view(
\"
"
+
row
.
id
+
"
\"
)'>"
+
value
+
"</a>"
;
<
/c:when
>
<
c
:
otherwise
>
return
value
;
<
/c:otherwise
>
<
/c:choose
>
}
}
,{
field
:
'number'
,
title
:
'货架编号'
,
sortable
:
true
,
sortName
:
'number'
}
,{
field
:
'warehouse.id'
,
title
:
'仓库id'
,
sortable
:
true
,
sortName
:
'warehouse.id'
,
formatter
:
function
(
value
,
row
,
index
){
return
jp
.
getDictLabel
(
$
{
fns
:
toJson
(
fns
:
getDictList
(
''
))},
value
,
"-"
);
}
}
,{
field
:
'remarks'
,
title
:
'备注信息'
,
sortable
:
true
,
sortName
:
'remarks'
}
]
});
if
(
navigator
.
userAgent
.
match
(
/
(
iPhone|iPod|Android|ios
)
/i
)){
//如果是移动端
$
(
'#shelvesTable'
).
bootstrapTable
(
"toggleView"
);
}
$
(
'#shelvesTable'
).
on
(
'check.bs.table uncheck.bs.table load-success.bs.table '
+
'check-all.bs.table uncheck-all.bs.table'
,
function
()
{
$
(
'#remove'
).
prop
(
'disabled'
,
!
$
(
'#shelvesTable'
).
bootstrapTable
(
'getSelections'
).
length
);
$
(
'#view,#edit'
).
prop
(
'disabled'
,
$
(
'#shelvesTable'
).
bootstrapTable
(
'getSelections'
).
length
!=
1
);
});
$
(
"#btnImport"
).
click
(
function
(){
jp
.
open
({
type
:
2
,
area
:
[
500
,
200
],
auto
:
true
,
title
:
"导入数据"
,
content
:
"${ctx}/tag/importExcel"
,
btn
:
[
'下载模板'
,
'确定'
,
'关闭'
],
btn1
:
function
(
index
,
layero
){
jp
.
downloadFile
(
'${ctx}/warehouse/shelves/shelves/import/template'
);
},
btn2
:
function
(
index
,
layero
){
var
iframeWin
=
layero
.
find
(
'iframe'
)[
0
];
//得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
iframeWin
.
contentWindow
.
importExcel
(
'${ctx}/warehouse/shelves/shelves/import'
,
function
(
data
)
{
if
(
data
.
success
){
jp
.
success
(
data
.
msg
);
refresh
();
}
else
{
jp
.
error
(
data
.
msg
);
}
jp
.
close
(
index
);
});
//调用保存事件
return
false
;
},
btn3
:
function
(
index
){
jp
.
close
(
index
);
}
});
});
$
(
"#export"
).
click
(
function
(){
//导出Excel文件
var
searchParam
=
$
(
"#searchForm"
).
serializeJSON
();
searchParam
.
pageNo
=
1
;
searchParam
.
pageSize
=
-
1
;
var
sortName
=
$
(
'#shelvesTable'
).
bootstrapTable
(
"getOptions"
,
"none"
).
sortName
;
var
sortOrder
=
$
(
'#shelvesTable'
).
bootstrapTable
(
"getOptions"
,
"none"
).
sortOrder
;
var
values
=
""
;
for
(
var
key
in
searchParam
){
values
=
values
+
key
+
"="
+
searchParam
[
key
]
+
"&"
;
}
if
(
sortName
!=
undefined
&&
sortOrder
!=
undefined
){
values
=
values
+
"orderBy="
+
sortName
+
" "
+
sortOrder
;
}
jp
.
downloadFile
(
'${ctx}/warehouse/shelves/shelves/export?'
+
values
);
})
$
(
"#search"
).
click
(
"click"
,
function
()
{
// 绑定查询按扭
$
(
'#shelvesTable'
).
bootstrapTable
(
'refresh'
);
});
$
(
"#reset"
).
click
(
"click"
,
function
()
{
// 绑定查询按扭
$
(
"#searchForm input"
).
val
(
""
);
$
(
"#searchForm select"
).
val
(
""
);
$
(
"#searchForm .select-item"
).
html
(
""
);
$
(
'#shelvesTable'
).
bootstrapTable
(
'refresh'
);
});
});
function
getIdSelections
()
{
return
$
.
map
(
$
(
"#shelvesTable"
).
bootstrapTable
(
'getSelections'
),
function
(
row
)
{
return
row
.
id
});
}
function
deleteAll
(){
jp
.
confirm
(
'确认要删除该货架信息记录吗?'
,
function
(){
jp
.
loading
();
jp
.
get
(
"${ctx}/warehouse/shelves/shelves/deleteAll?ids="
+
getIdSelections
(),
function
(
data
){
if
(
data
.
success
){
$
(
'#shelvesTable'
).
bootstrapTable
(
'refresh'
);
jp
.
success
(
data
.
msg
);
}
else
{
jp
.
error
(
data
.
msg
);
}
})
})
}
function
refresh
(){
$
(
'#shelvesTable'
).
bootstrapTable
(
'refresh'
);
}
function
add
(){
jp
.
go
(
"${ctx}/warehouse/shelves/shelves/form/add"
);
}
function
edit
(
id
){
if
(
id
==
undefined
){
id
=
getIdSelections
();
}
jp
.
go
(
"${ctx}/warehouse/shelves/shelves/form/edit?id="
+
id
);
}
function
view
(
id
)
{
if
(
id
==
undefined
){
id
=
getIdSelections
();
}
jp
.
go
(
"${ctx}/warehouse/shelves/shelves/form/view?id="
+
id
);
}
<
/script>
\ No newline at end of file
src/main/webapp/webpage/modules/warehouse/shelves/shelvesList.jsp
0 → 100644
View file @
a2ae1320
<
%@
page
contentType=
"text/html;charset=UTF-8"
%
>
<
%@
include
file=
"/webpage/include/taglib.jsp"
%
>
<html>
<head>
<title>
货架信息管理
</title>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
>
<meta
name=
"decorator"
content=
"ani"
/>
<
%@
include
file=
"/webpage/include/bootstraptable.jsp"
%
>
<
%@
include
file=
"/webpage/include/treeview.jsp"
%
>
<
%@
include
file=
"shelvesList.js"
%
>
</head>
<body>
<div
class=
"wrapper wrapper-content"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
货架信息列表
</h3>
</div>
<div
class=
"panel-body"
>
<!-- 搜索 -->
<div
id=
"search-collapse"
class=
"collapse"
>
<div
class=
"accordion-inner"
>
<form:form
id=
"searchForm"
modelAttribute=
"shelves"
class=
"form form-horizontal well clearfix"
>
<div
class=
"col-xs-12 col-sm-6 col-md-4"
>
<div
style=
"margin-top:26px"
>
<a
id=
"search"
class=
"btn btn-primary btn-rounded btn-bordered btn-sm"
><i
class=
"fa fa-search"
></i>
查询
</a>
<a
id=
"reset"
class=
"btn btn-primary btn-rounded btn-bordered btn-sm"
><i
class=
"fa fa-refresh"
></i>
重置
</a>
</div>
</div>
</form:form>
</div>
</div>
<!-- 工具栏 -->
<div
id=
"toolbar"
>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:add"
>
<button
id=
"add"
class=
"btn btn-primary"
onclick=
"add()"
>
<i
class=
"glyphicon glyphicon-plus"
></i>
新建
</button>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:edit"
>
<button
id=
"edit"
class=
"btn btn-success"
disabled
onclick=
"edit()"
>
<i
class=
"glyphicon glyphicon-edit"
></i>
修改
</button>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:del"
>
<button
id=
"remove"
class=
"btn btn-danger"
disabled
onclick=
"deleteAll()"
>
<i
class=
"glyphicon glyphicon-remove"
></i>
删除
</button>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:import"
>
<button
id=
"btnImport"
class=
"btn btn-info"
><i
class=
"fa fa-folder-open-o"
></i>
导入
</button>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:export"
>
<button
id=
"export"
class=
"btn btn-warning"
>
<i
class=
"fa fa-file-excel-o"
></i>
导出
</button>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:view"
>
<button
id=
"view"
class=
"btn btn-default"
disabled
onclick=
"view()"
>
<i
class=
"fa fa-search-plus"
></i>
查看
</button>
</shiro:hasPermission>
</div>
<!-- 表格 -->
<table
id=
"shelvesTable"
data-toolbar=
"#toolbar"
></table>
<!-- context menu -->
<ul
id=
"context-menu"
class=
"dropdown-menu"
>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:view"
>
<li
data-item=
"view"
><a>
查看
</a></li>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:edit"
>
<li
data-item=
"edit"
><a>
编辑
</a></li>
</shiro:hasPermission>
<shiro:hasPermission
name=
"warehouse:shelves:shelves:del"
>
<li
data-item=
"delete"
><a>
删除
</a></li>
</shiro:hasPermission>
<li
data-item=
"action1"
><a>
取消
</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
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