Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
yaru
fgqyxxlr
Commits
128b35c2
Commit
128b35c2
authored
Jun 15, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增示例(主子表提交)
parent
57fed227
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
397 additions
and
2 deletions
+397
-2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java
+12
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
+9
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java
+116
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java
+82
-0
ruoyi-admin/src/main/resources/templates/demo/table/subdata.html
+175
-0
ruoyi-admin/src/main/resources/templates/index.html
+1
-0
ruoyi-generator/src/main/resources/vm/html/add.html.vm
+1
-1
ruoyi-generator/src/main/resources/vm/html/edit.html.vm
+1
-1
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java
View file @
128b35c2
...
@@ -21,6 +21,7 @@ import com.ruoyi.common.core.text.Convert;
...
@@ -21,6 +21,7 @@ import com.ruoyi.common.core.text.Convert;
import
com.ruoyi.common.exception.BusinessException
;
import
com.ruoyi.common.exception.BusinessException
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.web.controller.demo.domain.CustomerModel
;
import
com.ruoyi.web.controller.demo.domain.UserOperateModel
;
import
com.ruoyi.web.controller.demo.domain.UserOperateModel
;
/**
/**
...
@@ -154,6 +155,17 @@ public class DemoOperateController extends BaseController
...
@@ -154,6 +155,17 @@ public class DemoOperateController extends BaseController
}
}
/**
/**
* 新增保存主子表信息
*/
@PostMapping
(
"/customer/add"
)
@ResponseBody
public
AjaxResult
addSave
(
CustomerModel
customerModel
)
{
System
.
out
.
println
(
customerModel
.
toString
());
return
AjaxResult
.
success
();
}
/**
* 修改用户
* 修改用户
*/
*/
@GetMapping
(
"/edit/{userId}"
)
@GetMapping
(
"/edit/{userId}"
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
View file @
128b35c2
...
@@ -224,6 +224,15 @@ public class DemoTableController extends BaseController
...
@@ -224,6 +224,15 @@ public class DemoTableController extends BaseController
}
}
/**
/**
* 主子表提交
*/
@GetMapping
(
"/subdata"
)
public
String
subdata
()
{
return
prefix
+
"/subdata"
;
}
/**
* 表格其他操作
* 表格其他操作
*/
*/
@GetMapping
(
"/other"
)
@GetMapping
(
"/other"
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java
0 → 100644
View file @
128b35c2
package
com
.
ruoyi
.
web
.
controller
.
demo
.
domain
;
import
java.util.List
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* 客户测试信息
*
* @author ruoyi
*/
public
class
CustomerModel
{
/**
* 客户姓名
*/
private
String
name
;
/**
* 客户手机
*/
private
String
phonenumber
;
/**
* 客户性别
*/
private
String
sex
;
/**
* 客户生日
*/
private
String
birthday
;
/**
* 客户描述
*/
private
String
remark
;
/**
* 商品信息
*/
private
List
<
GoodsModel
>
goods
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getPhonenumber
()
{
return
phonenumber
;
}
public
void
setPhonenumber
(
String
phonenumber
)
{
this
.
phonenumber
=
phonenumber
;
}
public
String
getSex
()
{
return
sex
;
}
public
void
setSex
(
String
sex
)
{
this
.
sex
=
sex
;
}
public
String
getBirthday
()
{
return
birthday
;
}
public
void
setBirthday
(
String
birthday
)
{
this
.
birthday
=
birthday
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
List
<
GoodsModel
>
getGoods
()
{
return
goods
;
}
public
void
setGoods
(
List
<
GoodsModel
>
goods
)
{
this
.
goods
=
goods
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"name"
,
getName
())
.
append
(
"phonenumber"
,
getPhonenumber
())
.
append
(
"sex"
,
getSex
())
.
append
(
"birthday"
,
getBirthday
())
.
append
(
"goods"
,
getGoods
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java
0 → 100644
View file @
128b35c2
package
com
.
ruoyi
.
web
.
controller
.
demo
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* 商品测试信息
*
* @author ruoyi
*/
public
class
GoodsModel
{
/**
* 商品名称
*/
private
String
name
;
/**
* 商品重量
*/
private
Integer
weight
;
/**
* 商品价格
*/
private
Double
price
;
/**
* 商品种类
*/
private
String
type
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Integer
getWeight
()
{
return
weight
;
}
public
void
setWeight
(
Integer
weight
)
{
this
.
weight
=
weight
;
}
public
Double
getPrice
()
{
return
price
;
}
public
void
setPrice
(
Double
price
)
{
this
.
price
=
price
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"name"
,
getName
())
.
append
(
"weight"
,
getWeight
())
.
append
(
"price"
,
getPrice
())
.
append
(
"type"
,
getType
())
.
toString
();
}
}
ruoyi-admin/src/main/resources/templates/demo/table/subdata.html
0 → 100644
View file @
128b35c2
<!DOCTYPE html>
<html
lang=
"zh"
xmlns:th=
"http://www.thymeleaf.org"
xmlns:shiro=
"http://www.pollix.at/thymeleaf/shiro"
>
<head>
<th:block
th:include=
"include :: header('主子表提交')"
/>
<th:block
th:include=
"include :: datetimepicker-css"
/>
</head>
<body
class=
"gray-bg"
>
<div
class=
"main-content"
>
<form
id=
"form-add"
class=
"form-horizontal"
>
<input
name=
"deptId"
type=
"hidden"
id=
"treeId"
/>
<h4
class=
"form-header h4"
>
客户信息
</h4>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-4 control-label is-required"
>
客户名称:
</label>
<div
class=
"col-sm-8"
>
<input
name=
"name"
placeholder=
"请输入客户名称"
class=
"form-control"
type=
"text"
maxlength=
"30"
>
</div>
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-4 control-label is-required"
>
用户性别:
</label>
<div
class=
"col-sm-8"
>
<select
name=
"sex"
class=
"form-control"
th:with=
"type=${@dict.getType('sys_user_sex')}"
>
<option
th:each=
"dict : ${type}"
th:text=
"${dict.dictLabel}"
th:value=
"${dict.dictValue}"
></option>
</select>
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-4 control-label is-required"
>
手机号码:
</label>
<div
class=
"col-sm-8"
>
<input
id=
"phonenumber"
name=
"phonenumber"
placeholder=
"请输入手机号码"
class=
"form-control"
type=
"text"
maxlength=
"11"
>
</div>
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-4 control-label is-required"
>
生日:
</label>
<div
class=
"col-sm-8"
>
<div
class=
"input-group date"
>
<input
name=
"birthday"
class=
"form-control"
placeholder=
"yyyy-MM-dd"
type=
"text"
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
></i></span>
</div>
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"form-group"
>
<label
class=
"col-xs-2 control-label"
>
备注:
</label>
<div
class=
"col-xs-10"
>
<textarea
name=
"remark"
maxlength=
"500"
class=
"form-control"
rows=
"3"
></textarea>
</div>
</div>
</div>
</div>
<h4
class=
"form-header h4"
>
商品数据
</h4>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<button
type=
"button"
class=
"btn btn-white btn-sm"
onclick=
"return addColumn()"
><i
class=
"fa fa-plus"
>
增加
</i></button>
<button
type=
"button"
class=
"btn btn-white btn-sm"
onclick=
"return delColumn()"
><i
class=
"fa fa-minus"
>
删除
</i></button>
<div
class=
"col-sm-12 select-table table-striped"
>
<table
id=
"bootstrap-table"
></table>
</div>
</div>
</div>
</form>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-offset-5 col-sm-10"
>
<button
type=
"button"
class=
"btn btn-sm btn-primary"
onclick=
"submitHandler()"
><i
class=
"fa fa-check"
></i>
保 存
</button>
<button
type=
"button"
class=
"btn btn-sm btn-danger"
onclick=
"closeItem()"
><i
class=
"fa fa-reply-all"
></i>
关 闭
</button>
</div>
</div>
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: datetimepicker-js"
/>
<script
th:inline=
"javascript"
>
$
(
function
()
{
var
options
=
{
pagination
:
false
,
showSearch
:
false
,
showRefresh
:
false
,
showToggle
:
false
,
showColumns
:
false
,
columns
:
[{
checkbox
:
true
},
{
field
:
'name'
,
align
:
'center'
,
title
:
'商品名称'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
html
=
$
.
common
.
sprintf
(
"<input class='form-control' type='text' name='goods[%s].name' value='%s'>"
,
index
,
value
);
return
html
;
}
},
{
field
:
'weight'
,
align
:
'center'
,
title
:
'商品重量'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
html
=
$
.
common
.
sprintf
(
"<input class='form-control' type='text' name='goods[%s].weight' value='%s'>"
,
index
,
value
);
return
html
;
}
},
{
field
:
'price'
,
align
:
'center'
,
title
:
'商品价格'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
html
=
$
.
common
.
sprintf
(
"<input class='form-control' type='text' name='goods[%s].price' value='%s'>"
,
index
,
value
);
return
html
;
}
},
{
field
:
'type'
,
align
:
'center'
,
title
:
'商品种类'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
html
=
$
.
common
.
sprintf
(
"<select class='form-control' name='goods[%s].type'><option value=''>所有</option><option value='0'>寒性</option><option value='1'>热性</option></select>"
,
index
);
return
html
;
}
}]
};
$
.
table
.
init
(
options
);
});
/* 主子表-提交 */
function
submitHandler
(
index
,
layero
){
var
data
=
$
(
"#form-add"
).
serializeArray
();
$
.
operate
.
saveModal
(
"/demo/operate/customer/add"
,
data
);
}
$
(
"input[name='birthday']"
).
datetimepicker
({
format
:
"yyyy-mm-dd"
,
minView
:
"month"
,
autoclose
:
true
});
function
addColumn
(){
var
count
=
$
(
"#"
+
table
.
options
.
id
).
bootstrapTable
(
'getData'
).
length
;
var
randomId
=
100
+
~~
(
Math
.
random
()
*
100
)
$
(
"#"
+
table
.
options
.
id
).
bootstrapTable
(
'insertRow'
,
{
index
:
count
,
row
:
{
name
:
'商品'
+
randomId
,
weight
:
20
+
randomId
,
price
:
1
+
+
randomId
+
.
2
,
type
:
10
+
randomId
,
}
})
}
function
delColumn
(){
var
ids
=
$
.
table
.
selectColumns
(
"name"
);
if
(
ids
.
length
==
0
)
{
$
.
modal
.
alertWarning
(
"请至少选择一条记录"
);
return
;
}
$
(
"#"
+
table
.
options
.
id
).
bootstrapTable
(
'remove'
,
{
field
:
'name'
,
values
:
ids
})
}
</script>
</body>
</html>
\ No newline at end of file
ruoyi-admin/src/main/resources/templates/index.html
View file @
128b35c2
...
@@ -115,6 +115,7 @@
...
@@ -115,6 +115,7 @@
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/curd}"
>
动态增删改查
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/curd}"
>
动态增删改查
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/reorder}"
>
表格拖拽操作
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/reorder}"
>
表格拖拽操作
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/editable}"
>
表格行内编辑
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/editable}"
>
表格行内编辑
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/subdata}"
>
主子表提交
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/other}"
>
表格其他操作
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/other}"
>
表格其他操作
</a></li>
</ul>
</ul>
</li>
</li>
...
...
ruoyi-generator/src/main/resources/vm/html/add.html.vm
View file @
128b35c2
...
@@ -88,8 +88,8 @@
...
@@ -88,8 +88,8 @@
<label
class=
"col-sm-3 control-label"
>
${comment}:
</label>
<label
class=
"col-sm-3 control-label"
>
${comment}:
</label>
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<div
class=
"input-group date"
>
<div
class=
"input-group date"
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
></i></span>
<input
name=
"${field}"
class=
"form-control"
placeholder=
"yyyy-MM-dd"
type=
"text"
#
if
($
column
.
required
)
required
#
end
>
<input
name=
"${field}"
class=
"form-control"
placeholder=
"yyyy-MM-dd"
type=
"text"
#
if
($
column
.
required
)
required
#
end
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
ruoyi-generator/src/main/resources/vm/html/edit.html.vm
View file @
128b35c2
...
@@ -88,8 +88,8 @@
...
@@ -88,8 +88,8 @@
<label
class=
"col-sm-3 control-label"
>
${comment}:
</label>
<label
class=
"col-sm-3 control-label"
>
${comment}:
</label>
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<div
class=
"input-group date"
>
<div
class=
"input-group date"
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
></i></span>
<input
name=
"${field}"
th:value=
"${#dates.format(${className}.${field}, 'yyyy-MM-dd')}"
class=
"form-control"
placeholder=
"yyyy-MM-dd"
type=
"text"
#
if
($
column
.
required
)
required
#
end
>
<input
name=
"${field}"
th:value=
"${#dates.format(${className}.${field}, 'yyyy-MM-dd')}"
class=
"form-control"
placeholder=
"yyyy-MM-dd"
type=
"text"
#
if
($
column
.
required
)
required
#
end
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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