将 test 独立出模块,方便代码管理
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
|
||||
/**
|
||||
* 测试数据DAO接口
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@MyBatisDao//(dataSourceName="ds2")
|
||||
public interface TestDataChildDao extends CrudDao<TestDataChild> {
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 测试数据DAO接口
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface TestDataDao extends CrudDao<TestData> {
|
||||
|
||||
/**
|
||||
* 演示Map参数和返回值,支持分页
|
||||
*/
|
||||
List<Map<String, Object>> findListForMap(Map<String, Object> params);
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.dao;
|
||||
|
||||
import com.jeesite.common.dao.TreeDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.test.entity.TestTree;
|
||||
|
||||
/**
|
||||
* 测试树表DAO接口
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface TestTreeDao extends TreeDao<TestTree> {
|
||||
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.db;
|
||||
|
||||
import com.jeesite.common.datasource.DataSourceHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.tests.BaseInitDataTests;
|
||||
import com.jeesite.modules.gen.entity.GenTable;
|
||||
import com.jeesite.modules.gen.entity.GenTableColumn;
|
||||
import com.jeesite.modules.gen.service.GenTableService;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
|
||||
/**
|
||||
* 初始化核心表数据
|
||||
* @author ThinkGem
|
||||
* @version 2020-5-26
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitTestData extends BaseInitDataTests {
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists("test_data")) {
|
||||
return true; // 如果表已存在,则无需初始化
|
||||
}
|
||||
runCreateScript("test.sql");
|
||||
initGenDemoData();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private GenTableService genTableService;
|
||||
/**
|
||||
* 代码生成测试数据
|
||||
*/
|
||||
public void initGenDemoData() throws Exception{
|
||||
if (!checkTable(GenTable.class)) {
|
||||
return;
|
||||
}
|
||||
if (!checkTable(GenTableColumn.class)) {
|
||||
return;
|
||||
}
|
||||
initGenTestData();
|
||||
initGenTreeData();
|
||||
}
|
||||
/**
|
||||
* 代码生成测试数据
|
||||
*/
|
||||
private void initGenTestData() throws Exception{
|
||||
GenTable genTable = new GenTable();
|
||||
genTable.setIsNewRecord(true);
|
||||
genTable.setTableName("test_data");
|
||||
genTable.setDataSourceName(dataSourceName);
|
||||
genTable = genTableService.getFromDb(genTable);
|
||||
genTable.setIsNewRecord(true);
|
||||
genTable.setClassName("TestData");
|
||||
genTable.setFunctionAuthor("ThinkGem");
|
||||
genTable.setTplCategory("crud");
|
||||
genTable.setPackageName("com.jeesite.modules");
|
||||
genTable.setModuleName("test");
|
||||
genTable.setSubModuleName("");
|
||||
genTable.setFunctionName("测试数据");
|
||||
genTable.setFunctionNameSimple("数据");
|
||||
genTable.getOptionMap().put("isHaveDisableEnable", Global.YES);
|
||||
genTable.getOptionMap().put("isHaveDelete", Global.YES);
|
||||
genTable.getOptionMap().put("isFileUpload", Global.YES);
|
||||
genTable.getOptionMap().put("isImageUpload", Global.YES);
|
||||
initGenTableColumn(genTable);
|
||||
DataSourceHolder.setDataSourceName(dataSourceName);
|
||||
genTableService.save(genTable);
|
||||
// 子表
|
||||
GenTable genTableChild = new GenTable();
|
||||
genTableChild.setIsNewRecord(true);
|
||||
genTableChild.setTableName("test_data_child");
|
||||
genTableChild.setDataSourceName(dataSourceName);
|
||||
genTableChild = genTableService.getFromDb(genTableChild);
|
||||
genTableChild.setIsNewRecord(true);
|
||||
genTableChild.setClassName("TestDataChild");
|
||||
genTableChild.setFunctionAuthor("ThinkGem");
|
||||
genTableChild.setTplCategory("crud");
|
||||
genTableChild.setPackageName("com.jeesite.modules");
|
||||
genTableChild.setModuleName("test");
|
||||
genTableChild.setSubModuleName("");
|
||||
genTableChild.setFunctionName("测试子表");
|
||||
genTableChild.setFunctionNameSimple("数据");
|
||||
genTableChild.setParentTableName("test_data");
|
||||
genTableChild.setParentTableFkName("test_data_id");
|
||||
initGenTableColumn(genTableChild);
|
||||
DataSourceHolder.setDataSourceName(dataSourceName);
|
||||
genTableService.save(genTableChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* 代码生成测试数据(列初始化)
|
||||
*/
|
||||
private void initGenTableColumn(GenTable genTable){
|
||||
for(GenTableColumn column : genTable.getColumnList()){
|
||||
if ("test_input".equals(column.getColumnName())
|
||||
|| "test_textarea".equals(column.getColumnName())
|
||||
|| "test_select".equals(column.getColumnName())
|
||||
|| "test_select_multiple".equals(column.getColumnName())
|
||||
|| "test_checkbox".equals(column.getColumnName())
|
||||
|| "test_radio".equals(column.getColumnName())
|
||||
|| "test_date".equals(column.getColumnName())
|
||||
|| "test_datetime".equals(column.getColumnName())
|
||||
){
|
||||
column.setShowType(StringUtils.substringAfter(
|
||||
column.getColumnName(), "test_"));
|
||||
if ("test_input".equals(column.getColumnName())
|
||||
){
|
||||
column.setQueryType("LIKE");
|
||||
}
|
||||
else if ("test_textarea".equals(column.getColumnName())
|
||||
){
|
||||
column.setQueryType("LIKE");
|
||||
column.getOptionMap().put("isNewLine", Global.YES);
|
||||
// column.getOptionMap().put("gridRowCol", "12/2/10");
|
||||
}
|
||||
else if ("test_select".equals(column.getColumnName())
|
||||
|| "test_select_multiple".equals(column.getColumnName())
|
||||
|| "test_radio".equals(column.getColumnName())
|
||||
|| "test_checkbox".equals(column.getColumnName())
|
||||
){
|
||||
column.getOptionMap().put("dictType", "sys_menu_type");
|
||||
column.getOptionMap().put("dictName", "sys_menu_type");
|
||||
}
|
||||
else if ("test_date".equals(column.getColumnName())
|
||||
|| "test_datetime".equals(column.getColumnName())
|
||||
){
|
||||
column.setQueryType("BETWEEN");
|
||||
}
|
||||
}else if ("test_user_code".equals(column.getColumnName())){
|
||||
column.setAttrType("com.jeesite.modules.sys.entity.User");
|
||||
column.setFullAttrName("testUser");
|
||||
column.setShowType("userselect");
|
||||
}else if ("test_office_code".equals(column.getColumnName())){
|
||||
column.setAttrType("com.jeesite.modules.sys.entity.Office");
|
||||
column.setFullAttrName("testOffice");
|
||||
column.setShowType("officeselect");
|
||||
}else if ("test_area_code".equals(column.getColumnName())){
|
||||
column.setFullAttrName("testAreaCode|testAreaName");
|
||||
column.setShowType("areaselect");
|
||||
}else if ("test_area_name".equals(column.getColumnName())){
|
||||
column.setIsEdit(Global.NO);
|
||||
column.setIsQuery(Global.NO);
|
||||
}else if ("test_data_id".equals(column.getColumnName())){
|
||||
column.setFullAttrName("testData");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 代码生成树表测试数据
|
||||
*/
|
||||
private void initGenTreeData() throws Exception{
|
||||
GenTable genTable = new GenTable();
|
||||
genTable.setIsNewRecord(true);
|
||||
genTable.setTableName("test_tree");
|
||||
genTable.setDataSourceName(dataSourceName);
|
||||
genTable = genTableService.getFromDb(genTable);
|
||||
genTable.setIsNewRecord(true);
|
||||
genTable.setClassName("TestTree");
|
||||
genTable.setFunctionAuthor("ThinkGem");
|
||||
genTable.setTplCategory("treeGrid");
|
||||
genTable.setPackageName("com.jeesite.modules");
|
||||
genTable.setModuleName("test");
|
||||
genTable.setSubModuleName("");
|
||||
genTable.setFunctionName("测试树表");
|
||||
genTable.setFunctionNameSimple("数据");
|
||||
genTable.getOptionMap().put("isHaveDisableEnable", Global.YES);
|
||||
genTable.getOptionMap().put("isHaveDelete", Global.YES);
|
||||
genTable.getOptionMap().put("isFileUpload", Global.YES);
|
||||
genTable.getOptionMap().put("isImageUpload", Global.YES);
|
||||
genTable.getOptionMap().put("treeViewCode", "tree_code");
|
||||
genTable.getOptionMap().put("treeViewName", "tree_name");
|
||||
initGenTableColumn(genTable);
|
||||
DataSourceHolder.setDataSourceName(dataSourceName);
|
||||
genTableService.save(genTable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.entity;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.entity.Office;
|
||||
import java.util.List;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
|
||||
/**
|
||||
* 测试数据Entity
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Table(name="test_data", alias="a", columns={
|
||||
@Column(name="id", attrName="id", label="编号", isPK=true),
|
||||
@Column(name="test_input", attrName="testInput", label="单行文本", queryType=QueryType.LIKE),
|
||||
@Column(name="test_textarea", attrName="testTextarea", label="多行文本", queryType=QueryType.LIKE),
|
||||
@Column(name="test_select", attrName="testSelect", label="下拉框"),
|
||||
@Column(name="test_select_multiple", attrName="testSelectMultiple", label="下拉多选"),
|
||||
@Column(name="test_radio", attrName="testRadio", label="单选框"),
|
||||
@Column(name="test_checkbox", attrName="testCheckbox", label="复选框"),
|
||||
@Column(name="test_date", attrName="testDate", label="日期选择", isUpdateForce=true/*是否强制更新(当调用update并且该属性为空的时候,允许更新为空)*/),
|
||||
@Column(name="test_datetime", attrName="testDatetime", label="日期时间", isUpdateForce=true),
|
||||
@Column(name="test_user_code", attrName="testUser.userCode", label="用户选择"),
|
||||
@Column(name="test_office_code", attrName="testOffice.officeCode", label="机构选择"),
|
||||
@Column(name="test_area_code", attrName="testAreaCode", label="区域选择"),
|
||||
@Column(name="test_area_name", attrName="testAreaName", label="区域名称"),
|
||||
@Column(includeEntity=DataEntity.class),
|
||||
}, joinTable={
|
||||
@JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="testUser", alias="u10",
|
||||
on="u10.user_code = a.test_user_code", columns={
|
||||
@Column(name="user_code", label="用户编码", isPK=true),
|
||||
@Column(name="user_name", label="用户名称", isQuery=false),
|
||||
}),
|
||||
@JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="testOffice", alias="u11",
|
||||
on="u11.office_code = a.test_office_code", columns={
|
||||
@Column(name="office_code", label="机构编码", isPK=true),
|
||||
@Column(name="office_name", label="机构名称", isQuery=false),
|
||||
}),
|
||||
}, orderBy="a.update_date DESC"
|
||||
)
|
||||
public class TestData extends DataEntity<TestData> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String testInput; // 单行文本
|
||||
private String testTextarea; // 多行文本
|
||||
private String testSelect; // 下拉框
|
||||
private String testSelectMultiple; // 下拉多选
|
||||
private String testRadio; // 单选框
|
||||
private String testCheckbox; // 复选框
|
||||
private Date testDate; // 日期选择
|
||||
private Date testDatetime; // 日期时间
|
||||
private User testUser; // 用户选择
|
||||
private Office testOffice; // 机构选择
|
||||
private String testAreaCode; // 区域选择
|
||||
private String testAreaName; // 区域名称
|
||||
private List<TestDataChild> testDataChildList = ListUtils.newArrayList(); // 子表列表
|
||||
|
||||
public TestData() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public TestData(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="单行文本长度不能超过 200 个字符")
|
||||
public String getTestInput() {
|
||||
return testInput;
|
||||
}
|
||||
|
||||
public void setTestInput(String testInput) {
|
||||
this.testInput = testInput;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="多行文本长度不能超过 200 个字符")
|
||||
public String getTestTextarea() {
|
||||
return testTextarea;
|
||||
}
|
||||
|
||||
public void setTestTextarea(String testTextarea) {
|
||||
this.testTextarea = testTextarea;
|
||||
}
|
||||
|
||||
@Size(min=0, max=10, message="下拉框长度不能超过 10 个字符")
|
||||
public String getTestSelect() {
|
||||
return testSelect;
|
||||
}
|
||||
|
||||
public void setTestSelect(String testSelect) {
|
||||
this.testSelect = testSelect;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="下拉多选长度不能超过 200 个字符")
|
||||
public String getTestSelectMultiple() {
|
||||
return testSelectMultiple;
|
||||
}
|
||||
|
||||
public void setTestSelectMultiple(String testSelectMultiple) {
|
||||
this.testSelectMultiple = testSelectMultiple;
|
||||
}
|
||||
|
||||
@Size(min=0, max=10, message="单选框长度不能超过 10 个字符")
|
||||
public String getTestRadio() {
|
||||
return testRadio;
|
||||
}
|
||||
|
||||
public void setTestRadio(String testRadio) {
|
||||
this.testRadio = testRadio;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="复选框长度不能超过 200 个字符")
|
||||
public String getTestCheckbox() {
|
||||
return testCheckbox;
|
||||
}
|
||||
|
||||
public void setTestCheckbox(String testCheckbox) {
|
||||
this.testCheckbox = testCheckbox;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
public Date getTestDate() {
|
||||
return testDate;
|
||||
}
|
||||
|
||||
public void setTestDate(Date testDate) {
|
||||
this.testDate = testDate;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
public Date getTestDatetime() {
|
||||
return testDatetime;
|
||||
}
|
||||
|
||||
public void setTestDatetime(Date testDatetime) {
|
||||
this.testDatetime = testDatetime;
|
||||
}
|
||||
|
||||
public User getTestUser() {
|
||||
return testUser;
|
||||
}
|
||||
|
||||
public void setTestUser(User testUser) {
|
||||
this.testUser = testUser;
|
||||
}
|
||||
|
||||
public Office getTestOffice() {
|
||||
return testOffice;
|
||||
}
|
||||
|
||||
public void setTestOffice(Office testOffice) {
|
||||
this.testOffice = testOffice;
|
||||
}
|
||||
|
||||
@Size(min=0, max=64, message="区域选择长度不能超过 64 个字符")
|
||||
public String getTestAreaCode() {
|
||||
return testAreaCode;
|
||||
}
|
||||
|
||||
public void setTestAreaCode(String testAreaCode) {
|
||||
this.testAreaCode = testAreaCode;
|
||||
}
|
||||
|
||||
@Size(min=0, max=100, message="区域名称长度不能超过 100 个字符")
|
||||
public String getTestAreaName() {
|
||||
return testAreaName;
|
||||
}
|
||||
|
||||
public void setTestAreaName(String testAreaName) {
|
||||
this.testAreaName = testAreaName;
|
||||
}
|
||||
|
||||
public Date getTestDate_gte() {
|
||||
return sqlMap.getWhere().getValue("test_date", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setTestDate_gte(Date testDate) {
|
||||
sqlMap.getWhere().and("test_date", QueryType.GTE, testDate);
|
||||
}
|
||||
|
||||
public Date getTestDate_lte() {
|
||||
return sqlMap.getWhere().getValue("test_date", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setTestDate_lte(Date testDate) {
|
||||
sqlMap.getWhere().and("test_date", QueryType.LTE, testDate);
|
||||
}
|
||||
|
||||
public Date getTestDatetime_gte() {
|
||||
return sqlMap.getWhere().getValue("test_datetime", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setTestDatetime_gte(Date testDatetime) {
|
||||
sqlMap.getWhere().and("test_datetime", QueryType.GTE, testDatetime);
|
||||
}
|
||||
|
||||
public Date getTestDatetime_lte() {
|
||||
return sqlMap.getWhere().getValue("test_datetime", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setTestDatetime_lte(Date testDatetime) {
|
||||
sqlMap.getWhere().and("test_datetime", QueryType.LTE, testDatetime);
|
||||
}
|
||||
|
||||
public List<TestDataChild> getTestDataChildList() {
|
||||
return testDataChildList;
|
||||
}
|
||||
|
||||
public void setTestDataChildList(List<TestDataChild> testDataChildList) {
|
||||
this.testDataChildList = testDataChildList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.entity;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.entity.Office;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
|
||||
/**
|
||||
* 测试数据Entity
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Table(name="test_data_child", alias="a", columns={
|
||||
@Column(name="id", attrName="id", label="编号", isPK=true),
|
||||
@Column(name="test_sort", attrName="testSort", label="排序号"),
|
||||
@Column(name="test_data_id", attrName="testData.id", label="父表主键"),
|
||||
@Column(name="test_input", attrName="testInput", label="单行文本", queryType=QueryType.LIKE),
|
||||
@Column(name="test_textarea", attrName="testTextarea", label="多行文本", queryType=QueryType.LIKE),
|
||||
@Column(name="test_select", attrName="testSelect", label="下拉框"),
|
||||
@Column(name="test_select_multiple", attrName="testSelectMultiple", label="下拉多选"),
|
||||
@Column(name="test_radio", attrName="testRadio", label="单选框"),
|
||||
@Column(name="test_checkbox", attrName="testCheckbox", label="复选框"),
|
||||
@Column(name="test_date", attrName="testDate", label="日期选择", isUpdateForce=true),
|
||||
@Column(name="test_datetime", attrName="testDatetime", label="日期时间", isUpdateForce=true),
|
||||
@Column(name="test_user_code", attrName="testUser.userCode", label="用户选择"),
|
||||
@Column(name="test_office_code", attrName="testOffice.officeCode", label="机构选择"),
|
||||
@Column(name="test_area_code", attrName="testAreaCode", label="区域选择"),
|
||||
@Column(name="test_area_name", attrName="testAreaName", label="区域名称", isQuery=false),
|
||||
}, joinTable={
|
||||
@JoinTable(type=Type.LEFT_JOIN, entity=User.class, attrName="testUser", alias="u12",
|
||||
on="u12.user_code = a.test_user_code", columns={
|
||||
@Column(name="user_code", label="用户编码", isPK=true),
|
||||
@Column(name="user_name", label="用户名称", isQuery=false),
|
||||
}),
|
||||
@JoinTable(type=Type.LEFT_JOIN, entity=Office.class, attrName="testOffice", alias="u13",
|
||||
on="u13.office_code = a.test_office_code", columns={
|
||||
@Column(name="office_code", label="机构编码", isPK=true),
|
||||
@Column(name="office_name", label="机构名称", isQuery=false),
|
||||
}),
|
||||
}, orderBy="a.id ASC"
|
||||
)
|
||||
public class TestDataChild extends DataEntity<TestDataChild> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long testSort; // 排序号
|
||||
private TestData testData; // 父表主键 父类
|
||||
private String testInput; // 单行文本
|
||||
private String testTextarea; // 多行文本
|
||||
private String testSelect; // 下拉框
|
||||
private String testSelectMultiple; // 下拉多选
|
||||
private String testRadio; // 单选框
|
||||
private String testCheckbox; // 复选框
|
||||
private Date testDate; // 日期选择
|
||||
private Date testDatetime; // 日期时间
|
||||
private User testUser; // 用户选择
|
||||
private Office testOffice; // 机构选择
|
||||
private String testAreaCode; // 区域选择
|
||||
private String testAreaName; // 区域名称
|
||||
|
||||
public TestDataChild() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
|
||||
public TestDataChild(TestData testData){
|
||||
this.testData = testData;
|
||||
}
|
||||
|
||||
public Long getTestSort() {
|
||||
return testSort;
|
||||
}
|
||||
|
||||
public void setTestSort(Long testSort) {
|
||||
this.testSort = testSort;
|
||||
}
|
||||
|
||||
@Size(min=0, max=64, message="父表主键长度不能超过 64 个字符")
|
||||
public TestData getTestData() {
|
||||
return testData;
|
||||
}
|
||||
|
||||
public void setTestData(TestData testData) {
|
||||
this.testData = testData;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="单行文本长度不能超过 200 个字符")
|
||||
public String getTestInput() {
|
||||
return testInput;
|
||||
}
|
||||
|
||||
public void setTestInput(String testInput) {
|
||||
this.testInput = testInput;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="多行文本长度不能超过 200 个字符")
|
||||
public String getTestTextarea() {
|
||||
return testTextarea;
|
||||
}
|
||||
|
||||
public void setTestTextarea(String testTextarea) {
|
||||
this.testTextarea = testTextarea;
|
||||
}
|
||||
|
||||
@Size(min=0, max=10, message="下拉框长度不能超过 10 个字符")
|
||||
public String getTestSelect() {
|
||||
return testSelect;
|
||||
}
|
||||
|
||||
public void setTestSelect(String testSelect) {
|
||||
this.testSelect = testSelect;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="下拉多选长度不能超过 200 个字符")
|
||||
public String getTestSelectMultiple() {
|
||||
return testSelectMultiple;
|
||||
}
|
||||
|
||||
public void setTestSelectMultiple(String testSelectMultiple) {
|
||||
this.testSelectMultiple = testSelectMultiple;
|
||||
}
|
||||
|
||||
@Size(min=0, max=10, message="单选框长度不能超过 10 个字符")
|
||||
public String getTestRadio() {
|
||||
return testRadio;
|
||||
}
|
||||
|
||||
public void setTestRadio(String testRadio) {
|
||||
this.testRadio = testRadio;
|
||||
}
|
||||
|
||||
@Size(min=0, max=200, message="复选框长度不能超过 200 个字符")
|
||||
public String getTestCheckbox() {
|
||||
return testCheckbox;
|
||||
}
|
||||
|
||||
public void setTestCheckbox(String testCheckbox) {
|
||||
this.testCheckbox = testCheckbox;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
public Date getTestDate() {
|
||||
return testDate;
|
||||
}
|
||||
|
||||
public void setTestDate(Date testDate) {
|
||||
this.testDate = testDate;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
public Date getTestDatetime() {
|
||||
return testDatetime;
|
||||
}
|
||||
|
||||
public void setTestDatetime(Date testDatetime) {
|
||||
this.testDatetime = testDatetime;
|
||||
}
|
||||
|
||||
public User getTestUser() {
|
||||
return testUser;
|
||||
}
|
||||
|
||||
public void setTestUser(User testUser) {
|
||||
this.testUser = testUser;
|
||||
}
|
||||
|
||||
public Office getTestOffice() {
|
||||
return testOffice;
|
||||
}
|
||||
|
||||
public void setTestOffice(Office testOffice) {
|
||||
this.testOffice = testOffice;
|
||||
}
|
||||
|
||||
@Size(min=0, max=64, message="区域选择长度不能超过 64 个字符")
|
||||
public String getTestAreaCode() {
|
||||
return testAreaCode;
|
||||
}
|
||||
|
||||
public void setTestAreaCode(String testAreaCode) {
|
||||
this.testAreaCode = testAreaCode;
|
||||
}
|
||||
|
||||
@Size(min=0, max=100, message="区域名称长度不能超过 100 个字符")
|
||||
public String getTestAreaName() {
|
||||
return testAreaName;
|
||||
}
|
||||
|
||||
public void setTestAreaName(String testAreaName) {
|
||||
this.testAreaName = testAreaName;
|
||||
}
|
||||
|
||||
public Date getTestDate_gte() {
|
||||
return sqlMap.getWhere().getValue("test_date", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setTestDate_gte(Date testDate) {
|
||||
sqlMap.getWhere().and("test_date", QueryType.GTE, testDate);
|
||||
}
|
||||
|
||||
public Date getTestDate_lte() {
|
||||
return sqlMap.getWhere().getValue("test_date", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setTestDate_lte(Date testDate) {
|
||||
sqlMap.getWhere().and("test_date", QueryType.LTE, testDate);
|
||||
}
|
||||
|
||||
public Date getTestDatetime_gte() {
|
||||
return sqlMap.getWhere().getValue("test_datetime", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setTestDatetime_gte(Date testDatetime) {
|
||||
sqlMap.getWhere().and("test_datetime", QueryType.GTE, testDatetime);
|
||||
}
|
||||
|
||||
public Date getTestDatetime_lte() {
|
||||
return sqlMap.getWhere().getValue("test_datetime", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setTestDatetime_lte(Date testDatetime) {
|
||||
sqlMap.getWhere().and("test_datetime", QueryType.LTE, testDatetime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.entity;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.entity.TreeEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
|
||||
/**
|
||||
* 测试树表Entity
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Table(name="test_tree", alias="a", columns={
|
||||
@Column(name="tree_code", attrName="treeCode", label="节点编码", isPK=true),
|
||||
@Column(includeEntity=TreeEntity.class),
|
||||
@Column(name="tree_name", attrName="treeName", label="节点名称", queryType=QueryType.LIKE, isTreeName=true),
|
||||
@Column(includeEntity=DataEntity.class),
|
||||
}, orderBy="a.tree_sorts, a.tree_code"
|
||||
)
|
||||
public class TestTree extends TreeEntity<TestTree> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String treeCode; // 节点编码
|
||||
private String treeName; // 节点名称
|
||||
|
||||
public TestTree() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public TestTree(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestTree getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(TestTree parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getTreeCode() {
|
||||
return treeCode;
|
||||
}
|
||||
|
||||
public void setTreeCode(String treeCode) {
|
||||
this.treeCode = treeCode;
|
||||
}
|
||||
|
||||
@NotBlank(message="节点名称不能为空")
|
||||
@Size(min=0, max=200, message="节点名称长度不能超过 200 个字符")
|
||||
public String getTreeName() {
|
||||
return treeName;
|
||||
}
|
||||
|
||||
public void setTreeName(String treeName) {
|
||||
this.treeName = treeName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.service;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.idgen.IdGen;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.test.dao.TestDataChildDao;
|
||||
import com.jeesite.modules.test.dao.TestDataDao;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 测试数据Service
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Service
|
||||
public class TestDataService extends CrudService<TestDataDao, TestData> {
|
||||
|
||||
@Autowired
|
||||
private TestDataChildDao testDataChildDao;
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param testData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TestData get(TestData testData) {
|
||||
TestData entity = super.get(testData);
|
||||
if (entity != null){
|
||||
TestDataChild testDataChild = new TestDataChild(entity);
|
||||
testDataChild.setStatus(TestDataChild.STATUS_NORMAL);
|
||||
entity.setTestDataChildList(testDataChildDao.findList(testDataChild));
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param testData 查询条件
|
||||
* @param testData page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<TestData> findPage(TestData testData) {
|
||||
|
||||
// // 演示Map参数和返回值,支持分页
|
||||
// Page<Map<String, Object>> pageMap = new Page<>();
|
||||
// Map<String, Object> params = MapUtils.newHashMap();
|
||||
// params.put("testInput", "123");
|
||||
// params.put("page", pageMap);
|
||||
// pageMap.setList(dao.findListForMap(params));
|
||||
// System.out.println(pageMap.getList());
|
||||
// System.out.println(pageMap.getCount());
|
||||
|
||||
return super.findPage(testData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询子表分页数据
|
||||
* @param page 分页对象
|
||||
* @param testData
|
||||
* @return
|
||||
*/
|
||||
public List<TestDataChild> findSubList(TestDataChild testData) {
|
||||
return testDataChildDao.findList(testData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param testData
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(TestData testData) {
|
||||
super.save(testData);
|
||||
// 保存上传图片
|
||||
FileUploadUtils.saveFileUpload(testData, testData.getId(), "testData_image");
|
||||
// 保存上传附件
|
||||
FileUploadUtils.saveFileUpload(testData, testData.getId(), "testData_file");
|
||||
// 保存 TestData子表
|
||||
int index = 0;
|
||||
for (TestDataChild testDataChild : testData.getTestDataChildList()){
|
||||
if (!TestDataChild.STATUS_DELETE.equals(testDataChild.getStatus())){
|
||||
testDataChild.setTestData(testData);
|
||||
if (testDataChild.getIsNewRecord()){
|
||||
testDataChild.preInsert();
|
||||
testDataChildDao.insert(testDataChild);
|
||||
}else{
|
||||
testDataChild.preUpdate();
|
||||
testDataChildDao.update(testDataChild);
|
||||
}
|
||||
}else{
|
||||
testDataChildDao.delete(testDataChild);
|
||||
}
|
||||
// 保存上传附件
|
||||
FileUploadUtils.saveFileUpload(testDataChild, testDataChild.getId(),
|
||||
"testDataChildList["+index+"].testDataChild_file");
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param testData
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(TestData testData) {
|
||||
super.updateStatus(testData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param testData
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(TestData testData) {
|
||||
super.delete(testData);
|
||||
TestDataChild testDataChild = new TestDataChild();
|
||||
testDataChild.setTestData(testData);
|
||||
testDataChildDao.deleteByEntity(testDataChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务调度测试:testDataService.executeTestTask(userService, 1, 2L, 3F, 4D, 'abc')
|
||||
*/
|
||||
public void executeTestTask(UserService userService, Integer i, Long l, Float f, Double d, String s){
|
||||
System.out.println(DateUtils.getTime() + " 任务执行了~~~ bean: " + userService + ", i: " + i
|
||||
+ ", l: " + l + ", f: " + f + ", d: " + d + ", s: " + s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务测试,若 Child 报错,则回滚
|
||||
*/
|
||||
@Transactional//(propagation = Propagation.NOT_SUPPORTED)
|
||||
public void transTest(TestData testData) {
|
||||
testData.setTestInput("transTest");
|
||||
testData.setTestTextarea(IdGen.randomBase62(5));
|
||||
dao.insert(testData);
|
||||
TestDataChild testDataChild = new TestDataChild();
|
||||
testDataChild.setTestData(testData);
|
||||
// 设置一个超出数据库范围的值,抛出数据库异常
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i=0; i<500; i++){
|
||||
sb.append("transTest" + i);
|
||||
}
|
||||
testDataChild.setTestInput(sb.toString());
|
||||
testDataChildDao.insert(testDataChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务验证,返回空,则事务回滚成功
|
||||
*/
|
||||
public boolean transValid(TestData testData) {
|
||||
return dao.get(testData) == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.service;
|
||||
|
||||
import com.jeesite.common.service.TreeService;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.modules.test.dao.TestTreeDao;
|
||||
import com.jeesite.modules.test.entity.TestTree;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 测试树表Service
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Service
|
||||
public class TestTreeService extends TreeService<TestTreeDao, TestTree> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param testTree
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TestTree get(TestTree testTree) {
|
||||
return super.get(testTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param testTree
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TestTree> findList(TestTree testTree) {
|
||||
return super.findList(testTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param testTree
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(TestTree testTree) {
|
||||
super.save(testTree);
|
||||
// 保存上传图片
|
||||
FileUploadUtils.saveFileUpload(testTree, testTree.getId(), "testTree_image");
|
||||
// 保存上传附件
|
||||
FileUploadUtils.saveFileUpload(testTree, testTree.getId(), "testTree_file");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param testTree
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(TestTree testTree) {
|
||||
super.updateStatus(testTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param testTree
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(TestTree testTree) {
|
||||
testTree.sqlMap().markIdDelete(); // 逻辑删除时标记ID值
|
||||
super.delete(testTree);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.web;
|
||||
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.service.TestDataService;
|
||||
|
||||
/**
|
||||
* 演示实例Controller
|
||||
* @author ThinkGem
|
||||
* @version 2018-03-24
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/demo")
|
||||
public class DemoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TestDataService testDataService;
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public TestData get(String id, boolean isNewRecord) {
|
||||
return testDataService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* DataGrid
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = "dataGrid/{viewName}")
|
||||
public String dataGrid(@PathVariable String viewName, TestData testData, Model model) {
|
||||
return "modules/demo/demoDataGrid" + StringUtils.cap(viewName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Form
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = "form/{viewName}")
|
||||
public String form(@PathVariable String viewName, TestData testData, Model model) {
|
||||
return "modules/demo/demoForm" + StringUtils.cap(viewName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
import com.jeesite.modules.test.service.TestDataService;
|
||||
|
||||
/**
|
||||
* 测试数据Controller
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/test/testData")
|
||||
public class TestDataController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TestDataService testDataService;
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public TestData get(String id, boolean isNewRecord) {
|
||||
return testDataService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(TestData testData, Model model) {
|
||||
model.addAttribute("testData", testData);
|
||||
return "modules/test/testDataList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<TestData> listData(TestData testData, HttpServletRequest request, HttpServletResponse response) {
|
||||
testData.setPage(new Page<>(request, response));
|
||||
Page<TestData> page = testDataService.findPage(testData);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询子表列表数据
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = "subListData")
|
||||
@ResponseBody
|
||||
public List<TestDataChild> subListData(TestDataChild testDataChild) {
|
||||
return testDataService.findSubList(testDataChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("test:testData:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(TestData testData, Model model) {
|
||||
model.addAttribute("testData", testData);
|
||||
return "modules/test/testDataForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("test:testData:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated TestData testData) {
|
||||
testDataService.save(testData);
|
||||
return renderResult(Global.TRUE, text("保存数据成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用数据
|
||||
*/
|
||||
@RequiresPermissions("test:testData:edit")
|
||||
@RequestMapping(value = "disable")
|
||||
@ResponseBody
|
||||
public String disable(TestData testData) {
|
||||
testData.setStatus(TestData.STATUS_DISABLE);
|
||||
testDataService.updateStatus(testData);
|
||||
return renderResult(Global.TRUE, text("停用数据成功"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用数据
|
||||
*/
|
||||
@RequiresPermissions("test:testData:edit")
|
||||
@RequestMapping(value = "enable")
|
||||
@ResponseBody
|
||||
public String enable(TestData testData) {
|
||||
testData.setStatus(TestData.STATUS_NORMAL);
|
||||
testDataService.updateStatus(testData);
|
||||
return renderResult(Global.TRUE, text("启用数据成功"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("test:testData:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(TestData testData) {
|
||||
testDataService.delete(testData);
|
||||
return renderResult(Global.TRUE, text("删除数据成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务测试
|
||||
*/
|
||||
@RequiresPermissions("test:testData:edit")
|
||||
@RequestMapping(value = "transTest")
|
||||
@ResponseBody
|
||||
public String transTest(TestData testData) {
|
||||
try{
|
||||
testDataService.transTest(testData);
|
||||
}catch (Exception e) {
|
||||
logger.debug("事务测试信息,报错回滚:" + e.getMessage());
|
||||
}
|
||||
boolean bl = testDataService.transValid(testData);
|
||||
return renderResult(Global.TRUE, "事务测试"+(bl?"成功,数据已":"失败,数据未")+"回滚!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.test.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.idgen.IdGen;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.test.entity.TestTree;
|
||||
import com.jeesite.modules.test.service.TestTreeService;
|
||||
|
||||
/**
|
||||
* 测试树表Controller
|
||||
* @author ThinkGem
|
||||
* @version 2018-04-22
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/test/testTree")
|
||||
public class TestTreeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TestTreeService testTreeService;
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public TestTree get(String treeCode, boolean isNewRecord) {
|
||||
return testTreeService.get(treeCode, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(TestTree testTree, Model model) {
|
||||
model.addAttribute("testTree", testTree);
|
||||
return "modules/test/testTreeList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public List<TestTree> listData(TestTree testTree) {
|
||||
if (StringUtils.isBlank(testTree.getParentCode())) {
|
||||
testTree.setParentCode(TestTree.ROOT_CODE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(testTree.getTreeName())){
|
||||
testTree.setParentCode(null);
|
||||
}
|
||||
if (StringUtils.isNotBlank(testTree.getRemarks())){
|
||||
testTree.setParentCode(null);
|
||||
}
|
||||
List<TestTree> list = testTreeService.findList(testTree);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(TestTree testTree, Model model) {
|
||||
// 创建并初始化下一个节点信息
|
||||
testTree = createNextNode(testTree);
|
||||
model.addAttribute("testTree", testTree);
|
||||
return "modules/test/testTreeForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建并初始化下一个节点信息,如:排序号、默认值
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:edit")
|
||||
@RequestMapping(value = "createNextNode")
|
||||
@ResponseBody
|
||||
public TestTree createNextNode(TestTree testTree) {
|
||||
if (StringUtils.isNotBlank(testTree.getParentCode())){
|
||||
testTree.setParent(testTreeService.get(testTree.getParentCode()));
|
||||
}
|
||||
if (testTree.getIsNewRecord()) {
|
||||
TestTree where = new TestTree();
|
||||
where.setParentCode(testTree.getParentCode());
|
||||
TestTree last = testTreeService.getLastByParentCode(where);
|
||||
// 获取到下级最后一个节点
|
||||
if (last != null){
|
||||
testTree.setTreeSort(last.getTreeSort() + 30);
|
||||
testTree.setTreeCode(IdGen.nextCode(last.getTreeCode()));
|
||||
}else if (testTree.getParent() != null){
|
||||
testTree.setTreeCode(testTree.getParent().getTreeCode() + "001");
|
||||
}
|
||||
}
|
||||
// 以下设置表单默认数据
|
||||
if (testTree.getTreeSort() == null){
|
||||
testTree.setTreeSort(TestTree.DEFAULT_TREE_SORT);
|
||||
}
|
||||
return testTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated TestTree testTree) {
|
||||
testTreeService.save(testTree);
|
||||
return renderResult(Global.TRUE, text("保存数据成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用数据
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:edit")
|
||||
@RequestMapping(value = "disable")
|
||||
@ResponseBody
|
||||
public String disable(TestTree testTree) {
|
||||
TestTree where = new TestTree();
|
||||
where.setStatus(TestTree.STATUS_NORMAL);
|
||||
where.setParentCodes("," + testTree.getId() + ",");
|
||||
long count = testTreeService.findCount(where);
|
||||
if (count > 0) {
|
||||
return renderResult(Global.FALSE, text("该数据包含未停用的子数据!"));
|
||||
}
|
||||
testTree.setStatus(TestTree.STATUS_DISABLE);
|
||||
testTreeService.updateStatus(testTree);
|
||||
return renderResult(Global.TRUE, text("停用数据成功"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用数据
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:edit")
|
||||
@RequestMapping(value = "enable")
|
||||
@ResponseBody
|
||||
public String enable(TestTree testTree) {
|
||||
testTree.setStatus(TestTree.STATUS_NORMAL);
|
||||
testTreeService.updateStatus(testTree);
|
||||
return renderResult(Global.TRUE, text("启用数据成功"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(TestTree testTree) {
|
||||
testTreeService.delete(testTree);
|
||||
return renderResult(Global.TRUE, text("删除数据成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取树结构数据
|
||||
* @param excludeCode 排除的Code
|
||||
* @param isShowCode 是否显示编码(true or 1:显示在左侧;2:显示在右侧;false or null:不显示)
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:view")
|
||||
@RequestMapping(value = "treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData(String excludeCode, String isShowCode) {
|
||||
List<Map<String, Object>> mapList = ListUtils.newArrayList();
|
||||
List<TestTree> list = testTreeService.findList(new TestTree());
|
||||
for (int i=0; i<list.size(); i++){
|
||||
TestTree e = list.get(i);
|
||||
// 过滤非正常的数据
|
||||
if (!TestTree.STATUS_NORMAL.equals(e.getStatus())){
|
||||
continue;
|
||||
}
|
||||
// 过滤被排除的编码(包括所有子级)
|
||||
if (StringUtils.isNotBlank(excludeCode)){
|
||||
if (e.getId().equals(excludeCode)){
|
||||
continue;
|
||||
}
|
||||
if (e.getParentCodes().contains("," + excludeCode + ",")){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = MapUtils.newHashMap();
|
||||
map.put("id", e.getId());
|
||||
map.put("pId", e.getParentCode());
|
||||
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.getTreeCode(), e.getTreeName()));
|
||||
mapList.add(map);
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修复表结构相关数据
|
||||
*/
|
||||
@RequiresPermissions("test:testTree:edit")
|
||||
@RequestMapping(value = "fixTreeData")
|
||||
@ResponseBody
|
||||
public String fixTreeData(TestTree testTree){
|
||||
if (!UserUtils.getUser().isAdmin()){
|
||||
return renderResult(Global.FALSE, "操作失败,只有管理员才能进行修复!");
|
||||
}
|
||||
testTreeService.fixTreeData();
|
||||
return renderResult(Global.TRUE, "数据修复成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
/* Create Tables */
|
||||
|
||||
-- 测试数据
|
||||
CREATE TABLE test_data
|
||||
(
|
||||
id varchar(64) NOT NULL,
|
||||
test_input varchar(200),
|
||||
test_textarea varchar(200),
|
||||
test_select varchar(10),
|
||||
test_select_multiple varchar(200),
|
||||
test_radio varchar(10),
|
||||
test_checkbox varchar(200),
|
||||
test_date datetime,
|
||||
test_datetime datetime,
|
||||
test_user_code varchar(64),
|
||||
test_office_code varchar(64),
|
||||
test_area_code varchar(64),
|
||||
test_area_name varchar(100),
|
||||
status char(1) DEFAULT '0' NOT NULL,
|
||||
create_by varchar(64) NOT NULL,
|
||||
create_date datetime NOT NULL,
|
||||
update_by varchar(64) NOT NULL,
|
||||
update_date datetime NOT NULL,
|
||||
remarks varchar(500),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
-- 测试数据子表
|
||||
CREATE TABLE test_data_child
|
||||
(
|
||||
id varchar(64) NOT NULL,
|
||||
test_sort int,
|
||||
test_data_id varchar(64),
|
||||
test_input varchar(200),
|
||||
test_textarea varchar(200),
|
||||
test_select varchar(10),
|
||||
test_select_multiple varchar(200),
|
||||
test_radio varchar(10),
|
||||
test_checkbox varchar(200),
|
||||
test_date datetime,
|
||||
test_datetime datetime,
|
||||
test_user_code varchar(64),
|
||||
test_office_code varchar(64),
|
||||
test_area_code varchar(64),
|
||||
test_area_name varchar(100),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
-- 测试树表
|
||||
CREATE TABLE test_tree
|
||||
(
|
||||
tree_code varchar(64) NOT NULL,
|
||||
parent_code varchar(64) NOT NULL,
|
||||
parent_codes varchar(767) NOT NULL,
|
||||
tree_sort decimal(10) NOT NULL,
|
||||
tree_sorts varchar(767) NOT NULL,
|
||||
tree_leaf char(1) NOT NULL,
|
||||
tree_level decimal(4) NOT NULL,
|
||||
tree_names varchar(767) NOT NULL,
|
||||
tree_name varchar(200) NOT NULL,
|
||||
status char(1) DEFAULT '0' NOT NULL,
|
||||
create_by varchar(64) NOT NULL,
|
||||
create_date datetime NOT NULL,
|
||||
update_by varchar(64) NOT NULL,
|
||||
update_date datetime NOT NULL,
|
||||
remarks varchar(500),
|
||||
PRIMARY KEY (tree_code)
|
||||
);
|
||||
|
||||
|
||||
|
||||
/* Comments */
|
||||
|
||||
COMMENT ON TABLE test_data IS '测试数据';
|
||||
COMMENT ON COLUMN test_data.id IS '编号';
|
||||
COMMENT ON COLUMN test_data.test_input IS '单行文本';
|
||||
COMMENT ON COLUMN test_data.test_textarea IS '多行文本';
|
||||
COMMENT ON COLUMN test_data.test_select IS '下拉框';
|
||||
COMMENT ON COLUMN test_data.test_select_multiple IS '下拉多选';
|
||||
COMMENT ON COLUMN test_data.test_radio IS '单选框';
|
||||
COMMENT ON COLUMN test_data.test_checkbox IS '复选框';
|
||||
COMMENT ON COLUMN test_data.test_date IS '日期选择';
|
||||
COMMENT ON COLUMN test_data.test_datetime IS '日期时间';
|
||||
COMMENT ON COLUMN test_data.test_user_code IS '用户选择';
|
||||
COMMENT ON COLUMN test_data.test_office_code IS '机构选择';
|
||||
COMMENT ON COLUMN test_data.test_area_code IS '区域选择';
|
||||
COMMENT ON COLUMN test_data.test_area_name IS '区域名称';
|
||||
COMMENT ON COLUMN test_data.status IS '状态(0正常 1删除 2停用)';
|
||||
COMMENT ON COLUMN test_data.create_by IS '创建者';
|
||||
COMMENT ON COLUMN test_data.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN test_data.update_by IS '更新者';
|
||||
COMMENT ON COLUMN test_data.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN test_data.remarks IS '备注信息';
|
||||
COMMENT ON TABLE test_data_child IS '测试数据子表';
|
||||
COMMENT ON COLUMN test_data_child.id IS '编号';
|
||||
COMMENT ON COLUMN test_data_child.test_sort IS '排序号';
|
||||
COMMENT ON COLUMN test_data_child.test_data_id IS '父表主键';
|
||||
COMMENT ON COLUMN test_data_child.test_input IS '单行文本';
|
||||
COMMENT ON COLUMN test_data_child.test_textarea IS '多行文本';
|
||||
COMMENT ON COLUMN test_data_child.test_select IS '下拉框';
|
||||
COMMENT ON COLUMN test_data_child.test_select_multiple IS '下拉多选';
|
||||
COMMENT ON COLUMN test_data_child.test_radio IS '单选框';
|
||||
COMMENT ON COLUMN test_data_child.test_checkbox IS '复选框';
|
||||
COMMENT ON COLUMN test_data_child.test_date IS '日期选择';
|
||||
COMMENT ON COLUMN test_data_child.test_datetime IS '日期时间';
|
||||
COMMENT ON COLUMN test_data_child.test_user_code IS '用户选择';
|
||||
COMMENT ON COLUMN test_data_child.test_office_code IS '机构选择';
|
||||
COMMENT ON COLUMN test_data_child.test_area_code IS '区域选择';
|
||||
COMMENT ON COLUMN test_data_child.test_area_name IS '区域名称';
|
||||
COMMENT ON TABLE test_tree IS '测试树表';
|
||||
COMMENT ON COLUMN test_tree.tree_code IS '节点编码';
|
||||
COMMENT ON COLUMN test_tree.parent_code IS '父级编号';
|
||||
COMMENT ON COLUMN test_tree.parent_codes IS '所有父级编号';
|
||||
COMMENT ON COLUMN test_tree.tree_sort IS '排序号(升序)';
|
||||
COMMENT ON COLUMN test_tree.tree_sorts IS '所有排序号';
|
||||
COMMENT ON COLUMN test_tree.tree_leaf IS '是否最末级';
|
||||
COMMENT ON COLUMN test_tree.tree_level IS '层次级别';
|
||||
COMMENT ON COLUMN test_tree.tree_names IS '全节点名';
|
||||
COMMENT ON COLUMN test_tree.tree_name IS '节点名称';
|
||||
COMMENT ON COLUMN test_tree.status IS '状态(0正常 1删除 2停用)';
|
||||
COMMENT ON COLUMN test_tree.create_by IS '创建者';
|
||||
COMMENT ON COLUMN test_tree.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN test_tree.update_by IS '更新者';
|
||||
COMMENT ON COLUMN test_tree.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN test_tree.remarks IS '备注信息';
|
||||
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
|
||||
|
||||
/* Create Tables */
|
||||
|
||||
-- 测试数据
|
||||
CREATE TABLE [test_data]
|
||||
(
|
||||
[id] varchar(64) NOT NULL,
|
||||
[test_input] varchar(200),
|
||||
[test_textarea] nvarchar(200),
|
||||
[test_select] varchar(10),
|
||||
[test_select_multiple] varchar(200),
|
||||
[test_radio] varchar(10),
|
||||
[test_checkbox] varchar(200),
|
||||
[test_date] datetime,
|
||||
[test_datetime] datetime,
|
||||
[test_user_code] varchar(64),
|
||||
[test_office_code] varchar(64),
|
||||
[test_area_code] varchar(64),
|
||||
[test_area_name] nvarchar(100),
|
||||
[status] char(1) DEFAULT '0' NOT NULL,
|
||||
[create_by] varchar(64) NOT NULL,
|
||||
[create_date] datetime NOT NULL,
|
||||
[update_by] varchar(64) NOT NULL,
|
||||
[update_date] datetime NOT NULL,
|
||||
[remarks] nvarchar(500),
|
||||
PRIMARY KEY ([id])
|
||||
);
|
||||
|
||||
|
||||
-- 测试数据子表
|
||||
CREATE TABLE [test_data_child]
|
||||
(
|
||||
[id] varchar(64) NOT NULL,
|
||||
[test_sort] int,
|
||||
[test_data_id] varchar(64),
|
||||
[test_input] varchar(200),
|
||||
[test_textarea] nvarchar(200),
|
||||
[test_select] varchar(10),
|
||||
[test_select_multiple] varchar(200),
|
||||
[test_radio] varchar(10),
|
||||
[test_checkbox] varchar(200),
|
||||
[test_date] datetime,
|
||||
[test_datetime] datetime,
|
||||
[test_user_code] varchar(64),
|
||||
[test_office_code] varchar(64),
|
||||
[test_area_code] varchar(64),
|
||||
[test_area_name] nvarchar(100),
|
||||
PRIMARY KEY ([id])
|
||||
);
|
||||
|
||||
|
||||
-- 测试树表
|
||||
CREATE TABLE [test_tree]
|
||||
(
|
||||
[tree_code] varchar(64) NOT NULL,
|
||||
[parent_code] varchar(64) NOT NULL,
|
||||
[parent_codes] varchar(767) NOT NULL,
|
||||
[tree_sort] decimal(10) NOT NULL,
|
||||
[tree_sorts] varchar(767) NOT NULL,
|
||||
[tree_leaf] char(1) NOT NULL,
|
||||
[tree_level] decimal(4) NOT NULL,
|
||||
[tree_names] varchar(767) NOT NULL,
|
||||
[tree_name] nvarchar(200) NOT NULL,
|
||||
[status] char(1) DEFAULT '0' NOT NULL,
|
||||
[create_by] varchar(64) NOT NULL,
|
||||
[create_date] datetime NOT NULL,
|
||||
[update_by] varchar(64) NOT NULL,
|
||||
[update_date] datetime NOT NULL,
|
||||
[remarks] nvarchar(500),
|
||||
PRIMARY KEY ([tree_code])
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
SET SESSION FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
|
||||
/* Create Tables */
|
||||
|
||||
-- 测试数据
|
||||
CREATE TABLE test_data
|
||||
(
|
||||
id varchar(64) NOT NULL COMMENT '编号',
|
||||
test_input varchar(200) COMMENT '单行文本',
|
||||
test_textarea varchar(200) COMMENT '多行文本',
|
||||
test_select varchar(10) COMMENT '下拉框',
|
||||
test_select_multiple varchar(200) COMMENT '下拉多选',
|
||||
test_radio varchar(10) COMMENT '单选框',
|
||||
test_checkbox varchar(200) COMMENT '复选框',
|
||||
test_date datetime COMMENT '日期选择',
|
||||
test_datetime datetime COMMENT '日期时间',
|
||||
test_user_code varchar(64) COMMENT '用户选择',
|
||||
test_office_code varchar(64) COMMENT '机构选择',
|
||||
test_area_code varchar(64) COMMENT '区域选择',
|
||||
test_area_name varchar(100) COMMENT '区域名称',
|
||||
status char(1) DEFAULT '0' NOT NULL COMMENT '状态(0正常 1删除 2停用)',
|
||||
create_by varchar(64) NOT NULL COMMENT '创建者',
|
||||
create_date datetime NOT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) NOT NULL COMMENT '更新者',
|
||||
update_date datetime NOT NULL COMMENT '更新时间',
|
||||
remarks varchar(500) COMMENT '备注信息',
|
||||
PRIMARY KEY (id)
|
||||
) COMMENT = '测试数据';
|
||||
|
||||
|
||||
-- 测试数据子表
|
||||
CREATE TABLE test_data_child
|
||||
(
|
||||
id varchar(64) NOT NULL COMMENT '编号',
|
||||
test_sort int COMMENT '排序号',
|
||||
test_data_id varchar(64) COMMENT '父表主键',
|
||||
test_input varchar(200) COMMENT '单行文本',
|
||||
test_textarea varchar(200) COMMENT '多行文本',
|
||||
test_select varchar(10) COMMENT '下拉框',
|
||||
test_select_multiple varchar(200) COMMENT '下拉多选',
|
||||
test_radio varchar(10) COMMENT '单选框',
|
||||
test_checkbox varchar(200) COMMENT '复选框',
|
||||
test_date datetime COMMENT '日期选择',
|
||||
test_datetime datetime COMMENT '日期时间',
|
||||
test_user_code varchar(64) COMMENT '用户选择',
|
||||
test_office_code varchar(64) COMMENT '机构选择',
|
||||
test_area_code varchar(64) COMMENT '区域选择',
|
||||
test_area_name varchar(100) COMMENT '区域名称',
|
||||
PRIMARY KEY (id)
|
||||
) COMMENT = '测试数据子表';
|
||||
|
||||
|
||||
-- 测试树表
|
||||
CREATE TABLE test_tree
|
||||
(
|
||||
tree_code varchar(64) NOT NULL COMMENT '节点编码',
|
||||
parent_code varchar(64) NOT NULL COMMENT '父级编号',
|
||||
parent_codes varchar(767) NOT NULL COMMENT '所有父级编号',
|
||||
tree_sort decimal(10) NOT NULL COMMENT '排序号(升序)',
|
||||
tree_sorts varchar(767) NOT NULL COMMENT '所有排序号',
|
||||
tree_leaf char(1) NOT NULL COMMENT '是否最末级',
|
||||
tree_level decimal(4) NOT NULL COMMENT '层次级别',
|
||||
tree_names varchar(767) NOT NULL COMMENT '全节点名',
|
||||
tree_name varchar(200) NOT NULL COMMENT '节点名称',
|
||||
status char(1) DEFAULT '0' NOT NULL COMMENT '状态(0正常 1删除 2停用)',
|
||||
create_by varchar(64) NOT NULL COMMENT '创建者',
|
||||
create_date datetime NOT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) NOT NULL COMMENT '更新者',
|
||||
update_date datetime NOT NULL COMMENT '更新时间',
|
||||
remarks varchar(500) COMMENT '备注信息',
|
||||
PRIMARY KEY (tree_code)
|
||||
) COMMENT = '测试树表';
|
||||
|
||||
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
/* Create Tables */
|
||||
|
||||
-- 测试数据
|
||||
CREATE TABLE test_data
|
||||
(
|
||||
id varchar2(64) NOT NULL,
|
||||
test_input varchar2(200),
|
||||
test_textarea nvarchar2(200),
|
||||
test_select varchar2(10),
|
||||
test_select_multiple varchar2(200),
|
||||
test_radio varchar2(10),
|
||||
test_checkbox varchar2(200),
|
||||
test_date timestamp,
|
||||
test_datetime timestamp,
|
||||
test_user_code varchar2(64),
|
||||
test_office_code varchar2(64),
|
||||
test_area_code varchar2(64),
|
||||
test_area_name nvarchar2(100),
|
||||
status char(1) DEFAULT '0' NOT NULL,
|
||||
create_by varchar2(64) NOT NULL,
|
||||
create_date timestamp NOT NULL,
|
||||
update_by varchar2(64) NOT NULL,
|
||||
update_date timestamp NOT NULL,
|
||||
remarks nvarchar2(500),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
-- 测试数据子表
|
||||
CREATE TABLE test_data_child
|
||||
(
|
||||
id varchar2(64) NOT NULL,
|
||||
test_sort number(10,0),
|
||||
test_data_id varchar2(64),
|
||||
test_input varchar2(200),
|
||||
test_textarea nvarchar2(200),
|
||||
test_select varchar2(10),
|
||||
test_select_multiple varchar2(200),
|
||||
test_radio varchar2(10),
|
||||
test_checkbox varchar2(200),
|
||||
test_date timestamp,
|
||||
test_datetime timestamp,
|
||||
test_user_code varchar2(64),
|
||||
test_office_code varchar2(64),
|
||||
test_area_code varchar2(64),
|
||||
test_area_name nvarchar2(100),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
-- 测试树表
|
||||
CREATE TABLE test_tree
|
||||
(
|
||||
tree_code varchar2(64) NOT NULL,
|
||||
parent_code varchar2(64) NOT NULL,
|
||||
parent_codes varchar2(767) NOT NULL,
|
||||
tree_sort number(10) NOT NULL,
|
||||
tree_sorts varchar2(767) NOT NULL,
|
||||
tree_leaf char(1) NOT NULL,
|
||||
tree_level number(4) NOT NULL,
|
||||
tree_names varchar2(767) NOT NULL,
|
||||
tree_name nvarchar2(200) NOT NULL,
|
||||
status char(1) DEFAULT '0' NOT NULL,
|
||||
create_by varchar2(64) NOT NULL,
|
||||
create_date timestamp NOT NULL,
|
||||
update_by varchar2(64) NOT NULL,
|
||||
update_date timestamp NOT NULL,
|
||||
remarks nvarchar2(500),
|
||||
PRIMARY KEY (tree_code)
|
||||
);
|
||||
|
||||
|
||||
|
||||
/* Comments */
|
||||
|
||||
COMMENT ON TABLE test_data IS '测试数据';
|
||||
COMMENT ON COLUMN test_data.id IS '编号';
|
||||
COMMENT ON COLUMN test_data.test_input IS '单行文本';
|
||||
COMMENT ON COLUMN test_data.test_textarea IS '多行文本';
|
||||
COMMENT ON COLUMN test_data.test_select IS '下拉框';
|
||||
COMMENT ON COLUMN test_data.test_select_multiple IS '下拉多选';
|
||||
COMMENT ON COLUMN test_data.test_radio IS '单选框';
|
||||
COMMENT ON COLUMN test_data.test_checkbox IS '复选框';
|
||||
COMMENT ON COLUMN test_data.test_date IS '日期选择';
|
||||
COMMENT ON COLUMN test_data.test_datetime IS '日期时间';
|
||||
COMMENT ON COLUMN test_data.test_user_code IS '用户选择';
|
||||
COMMENT ON COLUMN test_data.test_office_code IS '机构选择';
|
||||
COMMENT ON COLUMN test_data.test_area_code IS '区域选择';
|
||||
COMMENT ON COLUMN test_data.test_area_name IS '区域名称';
|
||||
COMMENT ON COLUMN test_data.status IS '状态(0正常 1删除 2停用)';
|
||||
COMMENT ON COLUMN test_data.create_by IS '创建者';
|
||||
COMMENT ON COLUMN test_data.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN test_data.update_by IS '更新者';
|
||||
COMMENT ON COLUMN test_data.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN test_data.remarks IS '备注信息';
|
||||
COMMENT ON TABLE test_data_child IS '测试数据子表';
|
||||
COMMENT ON COLUMN test_data_child.id IS '编号';
|
||||
COMMENT ON COLUMN test_data_child.test_sort IS '排序号';
|
||||
COMMENT ON COLUMN test_data_child.test_data_id IS '父表主键';
|
||||
COMMENT ON COLUMN test_data_child.test_input IS '单行文本';
|
||||
COMMENT ON COLUMN test_data_child.test_textarea IS '多行文本';
|
||||
COMMENT ON COLUMN test_data_child.test_select IS '下拉框';
|
||||
COMMENT ON COLUMN test_data_child.test_select_multiple IS '下拉多选';
|
||||
COMMENT ON COLUMN test_data_child.test_radio IS '单选框';
|
||||
COMMENT ON COLUMN test_data_child.test_checkbox IS '复选框';
|
||||
COMMENT ON COLUMN test_data_child.test_date IS '日期选择';
|
||||
COMMENT ON COLUMN test_data_child.test_datetime IS '日期时间';
|
||||
COMMENT ON COLUMN test_data_child.test_user_code IS '用户选择';
|
||||
COMMENT ON COLUMN test_data_child.test_office_code IS '机构选择';
|
||||
COMMENT ON COLUMN test_data_child.test_area_code IS '区域选择';
|
||||
COMMENT ON COLUMN test_data_child.test_area_name IS '区域名称';
|
||||
COMMENT ON TABLE test_tree IS '测试树表';
|
||||
COMMENT ON COLUMN test_tree.tree_code IS '节点编码';
|
||||
COMMENT ON COLUMN test_tree.parent_code IS '父级编号';
|
||||
COMMENT ON COLUMN test_tree.parent_codes IS '所有父级编号';
|
||||
COMMENT ON COLUMN test_tree.tree_sort IS '排序号(升序)';
|
||||
COMMENT ON COLUMN test_tree.tree_sorts IS '所有排序号';
|
||||
COMMENT ON COLUMN test_tree.tree_leaf IS '是否最末级';
|
||||
COMMENT ON COLUMN test_tree.tree_level IS '层次级别';
|
||||
COMMENT ON COLUMN test_tree.tree_names IS '全节点名';
|
||||
COMMENT ON COLUMN test_tree.tree_name IS '节点名称';
|
||||
COMMENT ON COLUMN test_tree.status IS '状态(0正常 1删除 2停用)';
|
||||
COMMENT ON COLUMN test_tree.create_by IS '创建者';
|
||||
COMMENT ON COLUMN test_tree.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN test_tree.update_by IS '更新者';
|
||||
COMMENT ON COLUMN test_tree.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN test_tree.remarks IS '备注信息';
|
||||
|
||||
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
/* Create Tables */
|
||||
|
||||
-- 测试数据
|
||||
CREATE TABLE test_data
|
||||
(
|
||||
id varchar(64) NOT NULL,
|
||||
test_input varchar(200),
|
||||
test_textarea varchar(200),
|
||||
test_select varchar(10),
|
||||
test_select_multiple varchar(200),
|
||||
test_radio varchar(10),
|
||||
test_checkbox varchar(200),
|
||||
test_date timestamp,
|
||||
test_datetime timestamp,
|
||||
test_user_code varchar(64),
|
||||
test_office_code varchar(64),
|
||||
test_area_code varchar(64),
|
||||
test_area_name varchar(100),
|
||||
status char(1) DEFAULT '0' NOT NULL,
|
||||
create_by varchar(64) NOT NULL,
|
||||
create_date timestamp NOT NULL,
|
||||
update_by varchar(64) NOT NULL,
|
||||
update_date timestamp NOT NULL,
|
||||
remarks varchar(500),
|
||||
PRIMARY KEY (id)
|
||||
) WITHOUT OIDS;
|
||||
|
||||
|
||||
-- 测试数据子表
|
||||
CREATE TABLE test_data_child
|
||||
(
|
||||
id varchar(64) NOT NULL,
|
||||
test_sort int,
|
||||
test_data_id varchar(64),
|
||||
test_input varchar(200),
|
||||
test_textarea varchar(200),
|
||||
test_select varchar(10),
|
||||
test_select_multiple varchar(200),
|
||||
test_radio varchar(10),
|
||||
test_checkbox varchar(200),
|
||||
test_date timestamp,
|
||||
test_datetime timestamp,
|
||||
test_user_code varchar(64),
|
||||
test_office_code varchar(64),
|
||||
test_area_code varchar(64),
|
||||
test_area_name varchar(100),
|
||||
PRIMARY KEY (id)
|
||||
) WITHOUT OIDS;
|
||||
|
||||
|
||||
-- 测试树表
|
||||
CREATE TABLE test_tree
|
||||
(
|
||||
tree_code varchar(64) NOT NULL,
|
||||
parent_code varchar(64) NOT NULL,
|
||||
parent_codes varchar(767) NOT NULL,
|
||||
tree_sort decimal(10) NOT NULL,
|
||||
tree_sorts varchar(767) NOT NULL,
|
||||
tree_leaf char(1) NOT NULL,
|
||||
tree_level decimal(4) NOT NULL,
|
||||
tree_names varchar(767) NOT NULL,
|
||||
tree_name varchar(200) NOT NULL,
|
||||
status char(1) DEFAULT '0' NOT NULL,
|
||||
create_by varchar(64) NOT NULL,
|
||||
create_date timestamp NOT NULL,
|
||||
update_by varchar(64) NOT NULL,
|
||||
update_date timestamp NOT NULL,
|
||||
remarks varchar(500),
|
||||
PRIMARY KEY (tree_code)
|
||||
) WITHOUT OIDS;
|
||||
|
||||
|
||||
|
||||
/* Comments */
|
||||
|
||||
COMMENT ON TABLE test_data IS '测试数据';
|
||||
COMMENT ON COLUMN test_data.id IS '编号';
|
||||
COMMENT ON COLUMN test_data.test_input IS '单行文本';
|
||||
COMMENT ON COLUMN test_data.test_textarea IS '多行文本';
|
||||
COMMENT ON COLUMN test_data.test_select IS '下拉框';
|
||||
COMMENT ON COLUMN test_data.test_select_multiple IS '下拉多选';
|
||||
COMMENT ON COLUMN test_data.test_radio IS '单选框';
|
||||
COMMENT ON COLUMN test_data.test_checkbox IS '复选框';
|
||||
COMMENT ON COLUMN test_data.test_date IS '日期选择';
|
||||
COMMENT ON COLUMN test_data.test_datetime IS '日期时间';
|
||||
COMMENT ON COLUMN test_data.test_user_code IS '用户选择';
|
||||
COMMENT ON COLUMN test_data.test_office_code IS '机构选择';
|
||||
COMMENT ON COLUMN test_data.test_area_code IS '区域选择';
|
||||
COMMENT ON COLUMN test_data.test_area_name IS '区域名称';
|
||||
COMMENT ON COLUMN test_data.status IS '状态(0正常 1删除 2停用)';
|
||||
COMMENT ON COLUMN test_data.create_by IS '创建者';
|
||||
COMMENT ON COLUMN test_data.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN test_data.update_by IS '更新者';
|
||||
COMMENT ON COLUMN test_data.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN test_data.remarks IS '备注信息';
|
||||
COMMENT ON TABLE test_data_child IS '测试数据子表';
|
||||
COMMENT ON COLUMN test_data_child.id IS '编号';
|
||||
COMMENT ON COLUMN test_data_child.test_sort IS '排序号';
|
||||
COMMENT ON COLUMN test_data_child.test_data_id IS '父表主键';
|
||||
COMMENT ON COLUMN test_data_child.test_input IS '单行文本';
|
||||
COMMENT ON COLUMN test_data_child.test_textarea IS '多行文本';
|
||||
COMMENT ON COLUMN test_data_child.test_select IS '下拉框';
|
||||
COMMENT ON COLUMN test_data_child.test_select_multiple IS '下拉多选';
|
||||
COMMENT ON COLUMN test_data_child.test_radio IS '单选框';
|
||||
COMMENT ON COLUMN test_data_child.test_checkbox IS '复选框';
|
||||
COMMENT ON COLUMN test_data_child.test_date IS '日期选择';
|
||||
COMMENT ON COLUMN test_data_child.test_datetime IS '日期时间';
|
||||
COMMENT ON COLUMN test_data_child.test_user_code IS '用户选择';
|
||||
COMMENT ON COLUMN test_data_child.test_office_code IS '机构选择';
|
||||
COMMENT ON COLUMN test_data_child.test_area_code IS '区域选择';
|
||||
COMMENT ON COLUMN test_data_child.test_area_name IS '区域名称';
|
||||
COMMENT ON TABLE test_tree IS '测试树表';
|
||||
COMMENT ON COLUMN test_tree.tree_code IS '节点编码';
|
||||
COMMENT ON COLUMN test_tree.parent_code IS '父级编号';
|
||||
COMMENT ON COLUMN test_tree.parent_codes IS '所有父级编号';
|
||||
COMMENT ON COLUMN test_tree.tree_sort IS '排序号(升序)';
|
||||
COMMENT ON COLUMN test_tree.tree_sorts IS '所有排序号';
|
||||
COMMENT ON COLUMN test_tree.tree_leaf IS '是否最末级';
|
||||
COMMENT ON COLUMN test_tree.tree_level IS '层次级别';
|
||||
COMMENT ON COLUMN test_tree.tree_names IS '全节点名';
|
||||
COMMENT ON COLUMN test_tree.tree_name IS '节点名称';
|
||||
COMMENT ON COLUMN test_tree.status IS '状态(0正常 1删除 2停用)';
|
||||
COMMENT ON COLUMN test_tree.create_by IS '创建者';
|
||||
COMMENT ON COLUMN test_tree.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN test_tree.update_by IS '更新者';
|
||||
COMMENT ON COLUMN test_tree.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN test_tree.remarks IS '备注信息';
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?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.jeesite.modules.test.dao.TestDataChildDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="TestDataChild">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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.jeesite.modules.test.dao.TestDataDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="TestData">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
<!-- 演示Map参数和返回值,支持分页 -->
|
||||
<select id="findListForMap" resultType="map">
|
||||
SELECT * FROM test_data a
|
||||
<where>
|
||||
<if test="testInput != null and testInput != ''">
|
||||
AND a.test_input = #{testInput}
|
||||
</if>
|
||||
</where>
|
||||
<if test="page != null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?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.jeesite.modules.test.dao.TestTreeDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="TestTree">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -1,264 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '编辑表格多行编辑', libs: ['dataGrid','validate']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> 编辑表格多行编辑
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
|
||||
<a href="#" id="dataGridAddRowBtn" class="btn btn-default"><i class="fa fa-plus"></i> 增行</a>
|
||||
<a href="#" id="btnGetData" class="btn btn-default"><i class="fa fa-hand-lizard-o"></i> 获取表格数据</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<#form:form id="searchForm" model="${testData}" action="${ctx}/test/testData/listData" method="post" class="form-inline hide"
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单行文本:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">多行文本:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testTextarea" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">下拉框:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">下拉多选:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单选框:</label>
|
||||
<div class="control-inline">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">复选框:</label>
|
||||
<div class="control-inline">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">日期选择:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="testDate_lte.click()"/>
|
||||
-
|
||||
<#form:input path="testDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">日期时间:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testDatetime_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" data-done="testDatetime_lte.click()"/>
|
||||
-
|
||||
<#form:input path="testDatetime_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">用户选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testUser" title="用户选择"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">机构选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testOffice" title="机构选择"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">区域选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testAreaCode" title="区域选择"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">状态:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">备注信息:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal table-form">
|
||||
<table id="dataGrid"></table>
|
||||
<div id="dataGridPage"></div>
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $('#searchForm'),
|
||||
// 设置数据表格列
|
||||
columnModel: [
|
||||
{header:'状态', name:'status', editable:true, hidden:true, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}},
|
||||
{header:'主键', name:'id', editable:true, hidden:true, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}},
|
||||
{header:'单行文本', name:'testInput', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}},
|
||||
{header:'多行文本', name:'testTextarea', width:150, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}},
|
||||
{header:'下拉框', name:'testSelect', width:100,
|
||||
editable:true, edittype:'select', editoptions:{'class':'form-control',
|
||||
items: $.merge([{dictLabel:' ',dictValue:''}], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}
|
||||
},
|
||||
// {header:'下拉多选', name:'testSelectMultiple', width:100,
|
||||
// editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
|
||||
// items: $.merge([], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
// itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
// js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
// }
|
||||
// }, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}
|
||||
// },
|
||||
{header:'日期选择', name:'testDate', width:150,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate required', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}
|
||||
},
|
||||
{header:'日期时间', name:'testDatetime', width:150,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate required', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'datetime', format:'yyyy-MM-dd HH:mm'});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#'+obj.rowId+'_'+obj.colModel.name, cell).val();}
|
||||
},
|
||||
{header:'用户选择', name:'testUser', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?isLoadUser=true', cssClass: ''
|
||||
});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#user_'+obj.rowId+'_'+obj.colModel.name+'Code', cell).val();}
|
||||
},
|
||||
{header:'机构选择', name:'testOffice', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testOffice.officeCode')+'|'+js.val(row, 'testOffice.officeName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'office_'+editOptions.id, title: '机构选择',
|
||||
name: 'testOffice.officeCode', value: val.split('|')[0],
|
||||
labelName: 'testOffice.officeName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?officeTypes=1,2', cssClass: ''
|
||||
});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#office_'+obj.rowId+'_'+obj.colModel.name+'Code', cell).val();}
|
||||
},
|
||||
{header:'区域选择', name:'testAreaCode', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testAreaCode')+'|'+js.val(row, 'testAreaName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'area_'+editOptions.id, title: '区域选择',
|
||||
name: 'testAreaCode', value: val.split('|')[0],
|
||||
labelName: 'testAreaName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/area/treeData', cssClass: ''
|
||||
});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#area_'+obj.rowId+'_'+obj.colModel.name+'Code', cell).val();}
|
||||
},
|
||||
{header:'列表选择', name:'testListSelect', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testListSelectCode')+'|'+js.val(row, 'testListSelectName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('listselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testListSelectCode', value: val.split('|')[0],
|
||||
labelName: 'testListSelectName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/empUser/empUserSelect',
|
||||
itemCode: 'userCode', itemName: 'userName',
|
||||
cssClass: ''
|
||||
});
|
||||
}
|
||||
}, unformat: function(val, obj, cell){return $('#user_'+obj.rowId+'_'+obj.colModel.name+'Code', cell).val();}
|
||||
},
|
||||
{header:'操作', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
if (val == 'new'){
|
||||
actions.push('<a href="#" onclick="js.confirm(\'你确认要删除这条数据吗?\', function(){$(\'#dataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}else{
|
||||
actions.push('<a href="#" onclick="js.confirm(\'你确认要删除这条数据吗?\', function(){$(\'#dataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'})});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}, editoptions: {defaultValue: 'new'}, unformat: function(val, obj, cell){return '';}}
|
||||
],
|
||||
|
||||
// 编辑表格参数
|
||||
editGrid: true, // 是否是编辑表格
|
||||
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
|
||||
editGridAddRowBtn: $('#dataGridAddRowBtn'), // 子表增行按钮
|
||||
editGridAddRowInitData: {id: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
||||
|
||||
// 编辑表格的提交数据参数
|
||||
editGridInputFormListName: 'testDataChildList', // 提交的数据列表名
|
||||
editGridInputFormListAttrs: 'status,id,testSort,testData.id,testInput,testTextarea,testSelect,testSelectMultiple,testRadio,testCheckbox,testDate,testDatetime,testUser.userCode,testOffice.officeCode,testAreaCode,testAreaName,', // 提交数据列表的属性字段
|
||||
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
$('#btnGetData').click(function(){
|
||||
var data = $('#dataGrid').dataGrid('getRowData');
|
||||
log(data)
|
||||
js.showMessage('请按 F12 打开控制台,查看数据');
|
||||
});
|
||||
</script>
|
||||
<script id="treeselectTpl" type="text/template">//<!--<div>
|
||||
<#form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true"/>
|
||||
</div>//--></script>
|
||||
<script id="listselectTpl" type="text/template">//<!--<div>
|
||||
<#form:listselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
itemCode="{{d.itemCode}}" itemName="{{d.itemName}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true"/>
|
||||
</div>//--></script>
|
||||
@@ -1,234 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '多表头分组小计合计', libs: ['dataGrid']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> 多表头分组小计合计
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
|
||||
<% if(hasPermi('test:testData:edit')){ %>
|
||||
<a href="${ctx}/test/testData/form" class="btn btn-default btnTool" title="新增数据"><i class="fa fa-plus"></i> 新增</a>
|
||||
<% } %>
|
||||
<a href="${ctx}/demo/dataGrid/stateGrid" class="btn btn-default btnTool" title="统计表样例"><i class="fa fa-hand-lizard-o"></i> 统计表样例</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<#form:form id="searchForm" model="${testData}" action="${ctx}/test/testData/listData" method="post" class="form-inline hide"
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单行文本:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">多行文本:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testTextarea" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">下拉框:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">下拉多选:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单选框:</label>
|
||||
<div class="control-inline">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">复选框:</label>
|
||||
<div class="control-inline">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">日期选择:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="testDate_lte.click()"/>
|
||||
-
|
||||
<#form:input path="testDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">日期时间:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testDatetime_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" data-done="testDatetime_lte.click()"/>
|
||||
-
|
||||
<#form:input path="testDatetime_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">用户选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testUser" title="用户选择"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">机构选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testOffice" title="机构选择"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">区域选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testAreaCode" title="区域选择"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">状态:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">备注信息:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
<div id="dataGridPage"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $('#searchForm'),
|
||||
columnModel: [
|
||||
{header:'单行文本', name:'testInput', index:'a.test_input', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){
|
||||
if(obj.rowId == ''){ return '小计:'; }
|
||||
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="编辑数据">'+(val||row.id)+'</a>';
|
||||
}, summaryTpl: "<em>{0}</em> ", summaryType: "count"},
|
||||
{header:'多行文本', name:'testTextarea', index:'a.test_textarea', width:200, align:"center", formatter: function(val, obj, row, act){
|
||||
if(obj.rowId == ''){ return '<em>' + val + '</em>个' }
|
||||
return val||'';
|
||||
}, summaryTpl: "<em>{0}</em>", summaryType: "count"},
|
||||
{header:'金额', name:'id', index:'a.id', width:150, align:"right", formatter: function(val, obj, row, act){
|
||||
val = js.formatMoney(val/(1000*1000*1000*1000));
|
||||
if(obj.rowId == ''){ return (val != '') ? ('¥' + val) : ''; }
|
||||
return val;
|
||||
}, summaryTpl: "<em>{0}</em> ", summaryType: "sum"},
|
||||
{header:'下拉框', name:'testSelect', index:'a.test_select', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '未知', true);
|
||||
}},
|
||||
{header:'下拉多选', name:'testSelectMultiple', index:'a.test_select_multiple', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '未知', true);
|
||||
}},
|
||||
{header:'单选框', name:'testRadio', index:'a.test_radio', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '未知', true);
|
||||
}},
|
||||
{header:'复选框', name:'testCheckbox', index:'a.test_checkbox', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '未知', true);
|
||||
}},
|
||||
{header:'日期选择', name:'testDate', index:'a.test_date', width:150, align:"center"},
|
||||
{header:'日期时间', name:'testDatetime', index:'a.test_datetime', width:150, align:"center"},
|
||||
{header:'用户选择', name:'testUser.userName', index:'a.test_user_code', width:150, align:"center"},
|
||||
{header:'机构选择', name:'testOffice.officeName', index:'a.test_office_code', width:150, align:"center"},
|
||||
{header:'区域选择', name:'testAreaName', index:'a.test_area_code', width:150, align:"center"},
|
||||
{header:'区域名称', name:'testAreaName', index:'a.test_area_name', width:150, align:"left"},
|
||||
{header:'状态', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_search_status')}", val, '未知', true);
|
||||
}},
|
||||
{header:'创建时间', name:'createDate', index:'a.create_date', width:150, align:"center"},
|
||||
{header:'备注信息', name:'remarks', index:'a.remarks', width:150, align:"left"},
|
||||
{header:'操作', name:'actions', width:120, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
//# if(hasPermi('test:testData:edit')){
|
||||
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="编辑数据"><i class="fa fa-pencil"></i></a> ');
|
||||
if (row.status == Global.STATUS_NORMAL){
|
||||
actions.push('<a href="${ctx}/test/testData/disable?id='+row.id+'" class="btnList" title="停用数据" data-confirm="确认要停用该数据吗?"><i class="glyphicon glyphicon-ban-circle"></i></a> ');
|
||||
} else if (row.status == Global.STATUS_DISABLE){
|
||||
actions.push('<a href="${ctx}/test/testData/enable?id='+row.id+'" class="btnList" title="启用数据" data-confirm="确认要启用该数据吗?"><i class="glyphicon glyphicon-ok-circle"></i></a> ');
|
||||
}
|
||||
actions.push('<a href="${ctx}/test/testData/delete?id='+row.id+'" class="btnList" title="删除数据" data-confirm="确认要删除该数据吗?"><i class="fa fa-trash-o"></i></a> ');
|
||||
//# }
|
||||
return actions.join('');
|
||||
}}
|
||||
],
|
||||
|
||||
shrinkToFit: false, // 是否按百分比自动调整列宽,当列比较多时,开启水平滚动,可设置为false
|
||||
frozenCols: true, // 启用冻结列,并在colModel中设置frozen:true
|
||||
showRownum: true, // 是否显示行号,默认true
|
||||
showFooter: true, // 是否显示底部合计行,数据载入详见 ajaxSuccess
|
||||
|
||||
// ================ 设置多级表头 BEGIN ==============
|
||||
// 设置多级表头
|
||||
groupHeaders: {
|
||||
twoLevel:[
|
||||
{startColumnName: 'testSelect', numberOfColumns: 2, titleText: '二级表头'},
|
||||
{startColumnName: 'testRadio', numberOfColumns:2, titleText:'二级表头2'}
|
||||
],
|
||||
threeLevel:[
|
||||
{startColumnName: 'testSelect', numberOfColumns:4, titleText:'三级表头'}
|
||||
]
|
||||
},
|
||||
// ================ 设置多级表头 END ==============
|
||||
|
||||
// ================ 分组,小计 BEGIN ==============
|
||||
grouping: true, // 是否分组显示
|
||||
groupingView: {
|
||||
groupField: ["status"], // 需要分组的列
|
||||
groupColumnShow: [false],// 是否显示分组的列
|
||||
groupText: ["<b>{0}</b>"], // 设置组标题,加粗标题:["<b>{0}</b>"],不显示标题:["none"]
|
||||
groupSummary: [true], // 是否显示[小计]列,数据载入详见 columnModel.formatter
|
||||
groupCollapse: false // false为默认展开,true默认为折叠
|
||||
},
|
||||
// ================ 分组,小计 END ==============
|
||||
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
// 分组和冻结列情况下的合并单元格测试
|
||||
//$('#dataGrid').dataGrid("mergeCell", "testInput,id");
|
||||
|
||||
// ================ 启用合计行 BEGIN ==============
|
||||
// showFooter: true, // 是否显示底部合计行
|
||||
// 第 1 种方法:请求完成之后通过js设置,举例如下:
|
||||
// 设置底部合计行数据(设置合计行)
|
||||
$('#dataGrid').dataGrid("footerData", "set", {
|
||||
"testInput" : "<center><em>合计:</em></center>",
|
||||
"testTextarea" : "<em>" + data.count + "</em>个",
|
||||
"id": "<em>¥900,000,000.00 </em>"
|
||||
}, false);
|
||||
// 第 2 种方法:在返回结果集中设置 otherData属性,举例格式如下:
|
||||
/* {"pageNo":1, "pageSize":30, "list":[返回结果集数据],
|
||||
"otherData":{
|
||||
"testInput" : "<center><em>合计:</em></center>",
|
||||
"testTextarea" : "<em>" + data.count + "</em>个",
|
||||
"id": "<em>¥900,000,000.00 </em>"
|
||||
}
|
||||
} */
|
||||
// ================ 启用合计行 END ================
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,115 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '多表格联动示例', libs: ['layout', 'dataGrid']}){ %>
|
||||
<div class="ui-layout-north">
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-trophy"></i> ${text('岗位列表')}(多表格联动示例)
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
<#form:form id="searchForm" model="${post!}" action="${ctx}/sys/post/listData" method="post" class="form-inline hide"
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize!3}"
|
||||
data-order-by="${parameter.orderBy!'post_code desc'}">
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
<div id="dataGridPage"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-center">
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-user"></i> ${text('用户列表')}(点击岗位查询对应用户)
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
<#form:form id="searchForm2" model="${empUser!}" action="${ctx}/sys/empUser/listData" method="post" class="form-inline hide"
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize!6}"
|
||||
data-order-by="${parameter.orderBy}">
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('岗位')}:</label>
|
||||
<div class="control-inline width-90">
|
||||
<#form:input name="employee.postCode" id="postCode" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid2"></table>
|
||||
<div id="dataGrid2Page"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
<script>
|
||||
//# // 初始化布局
|
||||
$('body').layout({
|
||||
north__size: 300,
|
||||
onresize: function(){
|
||||
$(window).resize();
|
||||
}
|
||||
});
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $('#searchForm'),
|
||||
dataGridPage: $('#dataGridPage'),
|
||||
autoGridHeight: function(){
|
||||
return $('#searchForm').parent().height() - $('#dataGridPage').height() - 58;
|
||||
},
|
||||
columnModel: [
|
||||
{header:'${text("岗位名称")}', name:'postName', index:'a.post_name', width:200, align:"center"},
|
||||
{header:'${text("岗位代码")}', name:'postCode', index:'a.post_code', width:200, align:"center"},
|
||||
{header:'${text("排序号")}', name:'postSort', index:'a.post_sort', width:80, align:"center"},
|
||||
{header:'${text("岗位分类")}', name:'postType', index:'a.post_type', width:100, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_post_type')}", val, '未知', true);
|
||||
}},
|
||||
{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
|
||||
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:200, align:"left"},
|
||||
{header:'${text("状态")}', name:'status', index:'a.status', width:80, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_status')}", val, '未知', true);
|
||||
}}
|
||||
],
|
||||
onSelectRow: function(id, isSelect, event){
|
||||
$('#postCode').val(id);
|
||||
$('#dataGrid2').dataGrid('refresh');
|
||||
},
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid2').dataGrid({
|
||||
searchForm: $('#searchForm2'),
|
||||
dataGridPage: $('#dataGrid2Page'),
|
||||
autoGridHeight: function(){
|
||||
return $('#searchForm2').parent().height() - $('#dataGrid2Page').height() - 58;
|
||||
},
|
||||
columnModel: [
|
||||
{header:'${text("登录账号")}', name:'loginCode', index:'a.login_code', width:200, align:"center"},
|
||||
{header:'${text("用户昵称")}', name:'userName', index:'a.user_name', width:200, align:"center"},
|
||||
{header:'${text("员工姓名")}', name:'refName', index:'a.ref_name', width:200, align:"center"},
|
||||
{header:'${text("归属机构")}', name:'employee.office.officeName', index:'o.office_name', width:200, align:"center"},
|
||||
{header:'${text("归属公司")}', name:'employee.company.companyName', index:'c.company_name', width:200, align:"center"},
|
||||
{header:'${text("电子邮箱")}', name:'email', index:'a.email', width:200, align:"center"},
|
||||
{header:'${text("手机号码")}', name:'mobile', index:'a.mobile', width:200, align:"center"},
|
||||
{header:'${text("办公电话")}', name:'phone', index:'a.phone', width:200, align:"center"},
|
||||
{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:200, align:"center"},
|
||||
{header:'${text("状态")}', name:'status', index:'a.status', width:140, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_status')}", val, '未知', true);
|
||||
}}
|
||||
],
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,149 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '统计表样例', libs: ['dataGrid']}){ %>
|
||||
<style>
|
||||
.ui-jqgrid tr.jqgrow td {
|
||||
padding: 0 !important;
|
||||
}
|
||||
.ui-jqgrid .sum-child{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
line-height: 35px;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.ui-jqgrid .sum-parent {
|
||||
background-color: #65a1db;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa fa-list-alt"></i> ${text('统计表样例')}
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
|
||||
<a href="${ctx}/psi/wechatUser/form" class="btn btn-default btnTool" title="${text('新增微信用户表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<#form:form id="searchForm" class="form-inline hide" >
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('时间')}:</label>
|
||||
<div class="control-inline width-150">
|
||||
<#form:input path="dateStart" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="date" />
|
||||
--
|
||||
<#form:input path="dateEnd" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="date" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">区域选择:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="areaId" title="区域选择"
|
||||
path="areaId" canSelectParent="true" canSelectRoot="true"
|
||||
url="${ctx}/sys/area/treeData?parentCode=0" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="button" id="search" class="btn btn-primary btn-sm">${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
var dataGridData = {
|
||||
data: [
|
||||
{name:"客户1-1-1",quantity:1,amount:0,return:0,virtual:0,balance:0,parentArea:'营销1部',childArea:'省区1-1'},
|
||||
{name:"客户1-1-2",quantity:0,amount:2,return:0,virtual:0,balance:0,parentArea:'营销1部',childArea:'省区1-1'},
|
||||
{name:"片区合计",quantity:1,amount:2,return:0,virtual:0,balance:0,sumSet:'child',parentArea:'营销1部',childArea:'片区合计'},
|
||||
{name:"大区合计",quantity:1,amount:2,return:0,virtual:0,balance:0,sumSet:'parent',parentArea:'大区合计',childArea:'大区合计'},
|
||||
{name:"客户2-1-1",quantity:0,amount:0,return:0,virtual:0,balance:0,parentArea:'营销2部',childArea:'省区2-1'},
|
||||
{name:"客户2-1-2",quantity:0,amount:0,return:3,virtual:0,balance:0,parentArea:'营销2部',childArea:'省区2-1'},
|
||||
{name:"片区合计",quantity:0,amount:0,return:3,virtual:4,balance:0,sumSet:'child',parentArea:'营销2部',childArea:'片区合计'},
|
||||
{name:"客户2-2-1",quantity:0,amount:0,return:0,virtual:0,balance:0,parentArea:'营销2部',childArea:'省区2-2'},
|
||||
{name:"客户2-2-2",quantity:0,amount:0,return:0,virtual:0,balance:5,parentArea:'营销2部',childArea:'省区2-2'},
|
||||
{name:"片区合计",quantity:0,amount:0,return:0,virtual:0,balance:5,sumSet:'child',parentArea:'营销2部',childArea:'片区合计'},
|
||||
{name:"大区合计",quantity:0,amount:0,return:3,virtual:4,balance:5,sumSet:'parent',parentArea:'大区合计',childArea:'大区合计'}
|
||||
], sum: {quantity:1,amount:2,return:3,virtual:4,balance:5}
|
||||
}
|
||||
|
||||
function formatter(val, obj, row, act) {
|
||||
if (row.sumSet === 'child') {
|
||||
return '<div class="sum-child">' + val + '</div>'
|
||||
} else if (row.sumSet === 'parent') {
|
||||
return '<div class="sum-child sum-parent">' + val + '</div>'
|
||||
} else {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $('#searchForm'),
|
||||
data: dataGridData.data,
|
||||
datatype: 'local', // 设置本地数据
|
||||
columnModel: [
|
||||
{
|
||||
header: '大区', name: 'parentArea', align: 'center', width: 150, sortable: false, formatter: formatter,
|
||||
cellattr: function (rowId, tv, row, cm, val) {
|
||||
if (row.sumSet === 'parent') {
|
||||
return ' colspan=3'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
header: '片区', name: 'childArea', align: 'center', width: 150, sortable: false, formatter: formatter,
|
||||
cellattr: function (rowId, tv, row, cm, val) {
|
||||
if (row.sumSet === 'parent') {
|
||||
return ' style="display:none;'
|
||||
}
|
||||
if (row.sumSet === 'child') {
|
||||
return ' colspan=2'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
header: '客户', name: 'name', align: 'center', width: 150, sortable: false, formatter: formatter,
|
||||
cellattr: function (rowId, tv, row, cm, val) {
|
||||
if (row.sumSet === 'parent' || row.sumSet === 'child') {
|
||||
return ' style="display:none;'
|
||||
}
|
||||
}
|
||||
},
|
||||
{header: '数量', name: 'quantity', align: 'center', width: 150, sortable: false, formatter: formatter},
|
||||
{header: '金额', name: 'amount', align: 'center', width: 150, sortable: false, formatter: formatter},
|
||||
{header: '总回款', name: 'return', align: 'center', width: 150, sortable: false, formatter: formatter},
|
||||
{header: '虚拟货款', name: 'virtual', align: 'center', width: 150, sortable: false, formatter: formatter},
|
||||
{header: '最新余额', name: 'balance', align: 'center', width: 150, sortable: false, formatter: formatter}
|
||||
],
|
||||
altRows: false,
|
||||
groupHeaders: {
|
||||
threeLevel: [
|
||||
{startColumnName: 'parentArea', numberOfColumns: 8, titleText: '时间'}
|
||||
],
|
||||
twoLevel: [
|
||||
{startColumnName: 'quantity', numberOfColumns: 2, titleText: '发货', width: 150},
|
||||
{startColumnName: 'return', numberOfColumns: 2, titleText: '回款', width: 150}
|
||||
]
|
||||
},
|
||||
showRownum: true, // 是否显示行号,默认true
|
||||
showFooter: true, // 是否显示底部合计行,数据载入详见 ajaxSuccess
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function (data) {
|
||||
$('#dataGrid').dataGrid('mergeCell', 'parentArea,childArea');
|
||||
$('#dataGrid').dataGrid("footerData", "set", {
|
||||
"parentArea": "<center><em>合计:</em></center>",
|
||||
"quantity": "<em>" + dataGridData.sum.quantity + "</em>",
|
||||
"amount": "<em>" + dataGridData.sum.amount + "</em>",
|
||||
"return": "<em>" + dataGridData.sum.return + "</em>",
|
||||
"virtual": "<em>" + dataGridData.sum.virtual + "</em>",
|
||||
"balance": "<em>" + dataGridData.sum.balance + "</em>",
|
||||
}, false);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,501 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '组件应用实例', libs: ['validate','fileupload','ueditor','dataGrid','inputmask']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> 组件应用实例
|
||||
</div>
|
||||
<div class="box-tools pull-right hide">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal">
|
||||
<div class="box-body">
|
||||
<div class="form-unit">基本信息</div>
|
||||
<#form:hidden path="id"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> 单行文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> 多行文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="testTextarea" rows="4" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 下拉框:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 下拉多选:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 单选框:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 复选框:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 日期选择:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDate" readonly="true" maxlength="20" class="form-control laydate "
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 日期时间:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control laydate "
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 金额格式:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="fa fa-fw fa-rmb"></i></span>
|
||||
<#form:input path="testInput_money" maxlength="200" class="form-control inputmask"
|
||||
data-inputmask-alias="money" data-inputmask="'digits':'2'"/>
|
||||
<span class="input-group-addon">(千分位,右对齐,保留2位小数)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 电子邮箱:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
<#form:input path="testInput_regex" maxlength="200" class="form-control inputmask"
|
||||
data-inputmask-regex="[a-zA-Z0-9._%-]+@[a-zA-Z0-9-]+\\.[a-zA-Z]{2,4}"/>
|
||||
<span class="input-group-addon">(正则表达式)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 用户选择:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testUser" title="用户选择"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 用户多选:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testUser2" title="用户选择"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true"
|
||||
class="" allowClear="true" checkbox="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 用户列表选择:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:listselect id="testUser3" title="用户选择"
|
||||
url="${ctx}/sys/empUser/empUserSelect" allowClear="false"
|
||||
checkbox="false" itemCode="userCode" itemName="userName"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 用户列表多选:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:listselect id="testUser4" title="用户选择"
|
||||
url="${ctx}/sys/empUser/empUserSelect" allowClear="false"
|
||||
checkbox="true" itemCode="userCode" itemName="userName"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 城市选择(异步):<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testAreaCode" title="区域选择"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData?parentCode=0"
|
||||
class="" allowClear="true" returnFullName="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 机构选择:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testOffice" title="机构选择"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 城市选择(联动):<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group" id="cascadeSelect"></div>
|
||||
<script src="${ctxStatic}/jquery-plugins/jquery.cascadeSelect.js?${_version}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
js.ajaxSubmit(ctx + '/sys/area/treeData', function(data){
|
||||
$("#cascadeSelect").cascadeSelect({
|
||||
data: data, cssStyle: 'width:150px',
|
||||
change: function(vals, names){
|
||||
$('#areaSelectValue').val(vals.join(',') + ' | ' + names.join('/'))
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 联动选择结果:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="areaSelectValue" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> 备注信息:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:ueditor path="remarks" maxlength="10000" height="200" class=""
|
||||
simpleToolbars="true" readonly="false" outline="false"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">图片上传:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadImage" bizKey="${testData.id}" bizType="testData_image"
|
||||
uploadType="image" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">返回路径:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadImage2" returnPath="true"
|
||||
filePathInputId="uploadImage2Path" fileNameInputId="uploadImage2Name"
|
||||
uploadType="image" readonly="false" preview="true" maxUploadNum="3" isMini="false"/>
|
||||
<#form:input name="uploadImage2Path" value="/js/userfiles/fileupload/201812/1073024549485039616.png|/js/userfiles/fileupload/201812/1073043095867133952.png" class="form-control"/>
|
||||
<#form:input name="uploadImage2Name" value="0 (1).png|0 (2).png" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">附件上传:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadFile" bizKey="${testData.id}" bizType="testData_file"
|
||||
uploadType="all" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-unit">测试数据子表</div>
|
||||
<div class="form-unit-wrap table-form">
|
||||
<table id="testDataChildDataGrid"></table>
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<a href="#" id="testDataChildDataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> 增行</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>
|
||||
<% } %>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//初始化测试数据子表DataGrid对象
|
||||
$('#testDataChildDataGrid').dataGrid({
|
||||
|
||||
data: "#{toJson(testData.testDataChildList)}",
|
||||
datatype: 'local', // 设置本地数据
|
||||
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
||||
|
||||
// 设置数据表格列
|
||||
columnModel: [
|
||||
{header:'状态', name:'status', editable:true, hidden:true},
|
||||
{header:'主键', name:'id', editable:true, hidden:true},
|
||||
{header:'排序号', name:'testSort', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'11', 'class':'form-control digits',
|
||||
// 'data-inputmask-alias':"money", 'data-inputmask': "'digits':'2'",
|
||||
dataInit: function(element){
|
||||
// $(element).addClass('inputmask').attr('data-inputmask-alias', "money").attr('data-inputmask', "'digits':'2'").inputmask()
|
||||
$(element).addClass('inputmask').attr({'data-inputmask-alias': "money", 'data-inputmask': "'digits':'2'"}).inputmask()
|
||||
// $(element).inputmask();
|
||||
}
|
||||
}},
|
||||
{header:'父表主键', name:'testData.id', editable:true, hidden:true},
|
||||
{header:'单行文本', name:'testInput', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}},
|
||||
{header:'多行文本', name:'testTextarea', width:150, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}},
|
||||
{header:'下拉框', name:'testSelect', width:100,
|
||||
editable:true, edittype:'select', editoptions:{'class':'form-control',
|
||||
items: $.merge([{dictLabel:' ',dictValue:''}], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'下拉多选', name:'testSelectMultiple', width:100,
|
||||
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
|
||||
items: $.merge([], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'单选框', name:'testRadio', width:100,
|
||||
editable:true, edittype:'select', editoptions:{'class':'form-control',
|
||||
items: $.merge([{dictLabel:' ',dictValue:''}], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'复选框', name:'testCheckbox', width:100,
|
||||
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
|
||||
items: $.merge([], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'日期选择', name:'testDate', width:150,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate ', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'日期时间', name:'testDatetime', width:150,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate ', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'datetime', format:'yyyy-MM-dd HH:mm'});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'用户选择', name:'testUser', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?isLoadUser=true', cssClass: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("用户列表选择")}', name:'testUser2', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('listselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/empUser/empUserSelect', cssClass: '',
|
||||
itemCode: 'userCode', itemName: 'userName'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'机构选择', name:'testOffice', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testOffice.officeCode')+'|'+js.val(row, 'testOffice.officeName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'office_'+editOptions.id, title: '机构选择',
|
||||
name: 'testOffice.officeCode', value: val.split('|')[0],
|
||||
labelName: 'testOffice.officeName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?officeTypes=1,2', cssClass: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'区域选择', name:'testAreaCode', width:150,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testAreaCode')+'|'+js.val(row, 'testAreaName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'area_'+editOptions.id, title: '区域选择',
|
||||
name: 'testAreaCode', value: val.split('|')[0],
|
||||
labelName: 'testAreaName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/area/treeData', cssClass: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'操作', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
if (val == 'new'){
|
||||
actions.push('<a href="#" onclick="js.confirm(\'你确认要删除这条数据吗?\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}else{
|
||||
actions.push('<a href="#" onclick="js.confirm(\'你确认要删除这条数据吗?\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'})});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}, editoptions: {defaultValue: 'new'}}
|
||||
],
|
||||
|
||||
// 编辑表格参数
|
||||
editGrid: true, // 是否是编辑表格
|
||||
editGridInitRowNum: 3, // 编辑表格的初始化新增行数
|
||||
editGridAddRowBtn: $('#testDataChildDataGridAddRowBtn'), // 子表增行按钮
|
||||
editGridAddRowInitData: {id: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
||||
|
||||
// 编辑表格的提交数据参数
|
||||
editGridInputFormListName: 'testDataChildList', // 提交的数据列表名
|
||||
editGridInputFormListAttrs: 'status,id,testSort,testData.id,testInput,testTextarea,testSelect,testSelectMultiple,testRadio,testCheckbox,testDate,testDatetime,testUser.userCode,testOffice.officeCode,testAreaCode,testAreaName,', // 提交数据列表的属性字段
|
||||
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script id="treeselectTpl" type="text/template">//<!--<div>
|
||||
<#form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true"/>
|
||||
</div>//--></script>
|
||||
<script id="listselectTpl" type="text/template">//<!--<div>
|
||||
<#form:listselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true"
|
||||
itemCode="{{d.itemCode}}" itemName="{{d.itemName}}"/>
|
||||
</div>//--></script>
|
||||
<script>
|
||||
$('#inputForm').validate({
|
||||
submitHandler: function(form){
|
||||
|
||||
// 数据格式化恢复(表单提交之前调用)
|
||||
$('.inputmask').inputmask('remove');
|
||||
|
||||
// js.ajaxSubmitForm($(form), function(data){
|
||||
// js.showMessage(data.message);
|
||||
// if(data.result == Global.TRUE){
|
||||
// js.closeCurrentTabPage(function(contentWindow){
|
||||
// contentWindow.page();
|
||||
// });
|
||||
// }
|
||||
// }, "json");
|
||||
log($(form).serializeArray());
|
||||
js.showMessage('模拟保存成功');
|
||||
|
||||
// 数据格式化(初始化完成表单后调用)
|
||||
$(".inputmask").inputmask();
|
||||
}
|
||||
});
|
||||
|
||||
//数据格式化(初始化完成表单后调用)
|
||||
$(".inputmask").inputmask();
|
||||
|
||||
</script>
|
||||
@@ -1,66 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '文书内容', libs: ['validate','dataGrid','fileupload']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<button type="button" class="btn btn-sm btn-primary" onclick="openEdit(1)" id="submitBtn"><i class="fa fa-arrow-right"></i> ${text('时间弹窗')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
function openEdit(docId){
|
||||
js.layer.open({
|
||||
type: 1,
|
||||
area: ['400px'],
|
||||
title: '${text("审核审批时间修改")}',
|
||||
resize: false,
|
||||
scrollbar: true,
|
||||
content: js.template('importTpl'),
|
||||
success: function(layero, index){
|
||||
layero.find('.laydate').on('click', function(e){
|
||||
var id = $(this).attr('id');
|
||||
top.laydate.render({
|
||||
elem: '#'+id, show: true, closeStop: '#'+id
|
||||
});
|
||||
});
|
||||
},
|
||||
btn: ['<i class="fa fa-check"></i> ${text("确认")}',
|
||||
'<i class="fa fa-remove"></i> ${text("关闭")}'],
|
||||
btn1: function(index, layero){
|
||||
var form = {
|
||||
inputForm: layero.find('#inputDateForm'),
|
||||
shDate: layero.find('#shDate').val(),
|
||||
spDate: layero.find('#spDate').val()
|
||||
};
|
||||
if (docId == '' || form.shDate == '' ||form.spDate == ''){
|
||||
js.showMessage("${text('请确认需要修改的内容')}", null, 'warning');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script id="importTpl" type="text/template">//<!--
|
||||
<form id="inputDateForm" action="${ctx}/doc/base/docBase/updateDate" method="post" enctype="multipart/form-data"
|
||||
class="form-horizontal mt20 mb10" style="overflow:auto;max-height:200px;">
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required">*</span> ${text('审核时间')}:<i class="fa icon-question hide"></i>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input name="shDate" dataFormat="yyyy-MM-dd" readonly="true" maxlength="20" class="form-control laydate width-250"
|
||||
data-type="date" lay-key="1"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required">*</span> ${text('审批时间')}:<i class="fa icon-question hide"></i>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input name="spDate" dataFormat="yyyy-MM-dd" readonly="true" maxlength="20" class="form-control laydate width-250"
|
||||
data-type="date" lay-key="2"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
//--></script>
|
||||
@@ -1,279 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['validate','fileupload','ueditor','dataGrid']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> ${testData.isNewRecord ? '新增数据' : '编辑数据'}
|
||||
</div>
|
||||
<div class="box-tools pull-right hide">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal">
|
||||
<div class="box-body">
|
||||
<div class="form-unit">一列</div>
|
||||
<#form:hidden path="id"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> 单行文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> 多行文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="testTextarea" rows="4" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-unit">两列</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 下拉框:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 下拉多选:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 单选框:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 复选框:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-unit">三列</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 日期:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDate" readonly="true" maxlength="20" class="form-control laydate "
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 时间:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control laydate "
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 用户:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testUser" title="用户选择"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 机构:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testOffice" title="机构选择"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 区域:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testAreaCode" title="区域选择"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 备注:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="remarks" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<style>
|
||||
/* 栅格9列布局 */
|
||||
@media (min-width: 768px){
|
||||
.col-sm-9-1{width:11.11%}
|
||||
.col-sm-9-2{width:22.22%}
|
||||
.col-sm-9-3{width:33.33%}
|
||||
.col-sm-9-4{width:44.44%}
|
||||
.col-sm-9-5{width:55.55%}
|
||||
.col-sm-9-6{width:66.66%}
|
||||
.col-sm-9-7{width:77.77%}
|
||||
.col-sm-9-8{width:88.88%}
|
||||
}
|
||||
</style>
|
||||
<label class="control-label col-sm-2 col-sm-9-1" title="">
|
||||
<span class="required hide">*</span> 单行文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10 col-sm-9-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-unit">四列</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> 文本:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>
|
||||
<% } %>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
$('#inputForm').validate({
|
||||
submitHandler: function(form){
|
||||
// js.ajaxSubmitForm($(form), function(data){
|
||||
// js.showMessage(data.message);
|
||||
// if(data.result == Global.TRUE){
|
||||
// js.closeCurrentTabPage(function(contentWindow){
|
||||
// contentWindow.page();
|
||||
// });
|
||||
// }
|
||||
// }, "json");
|
||||
js.showMessage('模拟保存成功');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,72 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '多页签应用示例', libs: ['tabPage']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> 多页签应用示例
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" onclick="js.addTabPage(null, '机构列表', '${ctx}/sys/office/list'+p)"><i class="fa fa-plus"></i> 添加页签(1)</button>
|
||||
<button type="button" class="btn btn-box-tool" onclick="b.addTabPage(null, '公司列表', '${ctx}/sys/company/list'+p)"><i class="fa fa-plus"></i> 添加页签(2)</button>
|
||||
<button type="button" class="btn btn-box-tool" onclick="top.js.closeCurrentTabPage()"><i class="fa fa-close"></i> 关闭窗口</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body pt0">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 pr0">
|
||||
<div id="tabpanel1"></div>
|
||||
</div>
|
||||
<div class="col-sm-6 pl0">
|
||||
<div id="tabpanel2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<style>
|
||||
.tabpanel {padding-top:4px;}
|
||||
.tabpanel_tab_content {border:0;}
|
||||
.tabpanel_tab_content .tabpanel_move_content {background: #fff;}
|
||||
.tabpanel_content .html_content {background:#fff;padding:0;}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// 一个页面一个 tab 控件
|
||||
js.initTabPage('tabpanel1', {
|
||||
height: function () {
|
||||
var windowHeight = $(window).height(),
|
||||
headerHeight = $('.box-header').outerHeight() || 0,
|
||||
footerHeight = $('.box-footer').outerHeight() || 0,
|
||||
height = windowHeight - headerHeight - footerHeight - 20;
|
||||
return height < 300 ? 300 : height;
|
||||
}
|
||||
});
|
||||
// 打开示例页面(不可关闭)
|
||||
var p = '?__layer=true'; // 隐藏标题
|
||||
js.addTabPage(null, "机构列表", "${ctx}/sys/office/list"+p, false);
|
||||
js.addTabPage(null, "用户列表", "${ctx}/sys/empUser/list"+p, false);
|
||||
// 用于机构保存后的刷新列表页面(示例)
|
||||
window.win = $('#tabpanel1 iframe:first')[0].contentWindow;
|
||||
// 激活第一个页签
|
||||
$('#tabpanel1 .tabpanel_mover li:first').click();
|
||||
|
||||
// 一个页面多个 tab 控件展示
|
||||
var b = $.extend([], tabPage);
|
||||
b.initTabPage('tabpanel2', {
|
||||
height: function () {
|
||||
var windowHeight = $(window).height(),
|
||||
headerHeight = $('.box-header').outerHeight() || 0,
|
||||
footerHeight = $('.box-footer').outerHeight() || 0,
|
||||
height = windowHeight - headerHeight - footerHeight - 20;
|
||||
return height < 300 ? 300 : height;
|
||||
}
|
||||
});
|
||||
b.addTabPage(null, "岗位列表", "${ctx}/sys/post/list"+p, false);
|
||||
b.addTabPage(null, "公司列表", "${ctx}/sys/company/list"+p, false);
|
||||
$('#tabpanel2 .tabpanel_mover li:first').click();
|
||||
|
||||
// 指定内页调用的 tab 对象
|
||||
window.tabPage = top.tabPage;
|
||||
</script>
|
||||
@@ -1,239 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['validate','fileupload','ueditor','dataGrid']}){ %>
|
||||
<div class="main-content print-form">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> 表格表单实例
|
||||
</div>
|
||||
<div class="box-tools pull-right hide">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal">
|
||||
<div class="table-fdiv width-960">
|
||||
<h3>产品信息情况</h3>
|
||||
<table class="table-form">
|
||||
<tr class="form-title"><td colspan="6">基本信息</td></tr>
|
||||
<tr>
|
||||
<td class="form-label" width="150"><span class="required">*</span> 负责人</td>
|
||||
<td>
|
||||
<#form:input path="testInput" maxlength="200" class="form-control required" defaultValue="小王"/>
|
||||
</td>
|
||||
<td class="form-label" width="150">所属部门</td>
|
||||
<td>
|
||||
<#form:treeselect id="testOffice" title="机构选择"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData" defaultLabel="技术部"
|
||||
class="required" allowClear="true"/>
|
||||
</td>
|
||||
<td rowspan="3" width="110">
|
||||
<div style="width:110px;height:110px;overflow:hidden;">
|
||||
<#form:fileupload id="uploadImage" bizKey="${testData.id}" bizType="testData_image"
|
||||
uploadType="image" class="" readonly="false" preview="true"
|
||||
maxUploadNum="1" isMini="true"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">单行文本</td>
|
||||
<td>
|
||||
<#form:input path="testInput" maxlength="200" class="form-control" defaultValue="演示文本"/>
|
||||
</td>
|
||||
<td class="form-label">单行文本</td>
|
||||
<td>
|
||||
<#form:input path="testInput" maxlength="200" class="form-control" defaultValue="演示文本"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">下拉框</td>
|
||||
<td>
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control" defaultValue="1"/>
|
||||
</td>
|
||||
<td class="form-label">下拉多选</td>
|
||||
<td>
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control" defaultValue="2"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">单选框</td>
|
||||
<td>
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" class="form-control" defaultValue="1"/>
|
||||
</td>
|
||||
<td class="form-label">复选框</td>
|
||||
<td colspan="2">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" class="form-control" defaultValue="1"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">日期选择</td>
|
||||
<td>
|
||||
<#form:input path="testDate" readonly="true" maxlength="20" class="form-control laydate "
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd" defaultValue="${date()}"/>
|
||||
</td>
|
||||
<td class="form-label">日期时间</td>
|
||||
<td colspan="2">
|
||||
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control laydate "
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" defaultValue="${date()}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">团队人数</td>
|
||||
<td colspan="4">共 <input class="text-center width-60" value="100"/> 人。其中技术人员
|
||||
<input class="text-center width-60 digits" value="60"/> 人。
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">办公面积</td>
|
||||
<td><input class="width-60 text-center number" value="200"/> M²</td>
|
||||
<td class="form-label">服务户数</td>
|
||||
<td colspan="2"><input class="width-60 text-center digits" value="9999"/> 家</td>
|
||||
</tr>
|
||||
<tr class="form-title"><td colspan="6">详细信息</td></tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<table class="table-form">
|
||||
<tr>
|
||||
<td class="form-label">项目编号</td>
|
||||
<td><input class="form-control" value="1234567890123"/></td>
|
||||
<td class="form-label">项目名称</td>
|
||||
<td><input class="form-control" value="JeeSite"/></td>
|
||||
<td class="form-label">项目版本</td>
|
||||
<td><input class="form-control" value="V4.3.0"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">新增产值</td>
|
||||
<td><input class="width-60 text-right" value="0.00"/> 万元</td>
|
||||
<td class="form-label">新增销售额</td>
|
||||
<td><input class="width-60 text-right" value="0.00"/> 万元</td>
|
||||
<td class="form-label">新增交税总额</td>
|
||||
<td><input class="width-60 text-right" value="0.00"/> 万元</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label">内容简介</td>
|
||||
<td colspan="4">
|
||||
<textarea name="remarks" rows="5" class="form-control autoHeight">这是一个文本,支持自动高度,在这里按回车看效果</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="form-label" nowrap="nowrap">子表数据</td>
|
||||
<td colspan="4">
|
||||
<table id="testDataChildDataGrid"></table>
|
||||
<a href="#" id="testDataChildDataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> 增行</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table-form mt10">
|
||||
<tr class="form-title"><td colspan="4">附件</td></tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<#form:fileupload id="uploadFile" bizKey="${testData.id}" bizType="testData_file"
|
||||
uploadType="all" class="" readonly="false" preview="true"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>
|
||||
<button type="button" class="btn btn-sm btn-info" id="btnPrint" onclick="window.print()"><i class="fa fa-print"></i> 打 印</button>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//初始化测试数据子表DataGrid对象
|
||||
$('#testDataChildDataGrid').dataGrid({
|
||||
|
||||
data: "#{toJson(testData.testDataChildList)}",
|
||||
datatype: 'local', // 设置本地数据
|
||||
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
||||
|
||||
// 设置数据表格列
|
||||
columnModel: [
|
||||
{header:'状态', name:'status', editable:true, hidden:true},
|
||||
{header:'主键', name:'id', editable:true, hidden:true},
|
||||
{header:'单行文本', name:'testInput', width:100, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}},
|
||||
{header:'多行文本', name:'testTextarea', width:100, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}},
|
||||
{header:'下拉框', name:'testSelect', width:100,
|
||||
editable:true, edittype:'select', editoptions:{'class':'form-control',
|
||||
items: $.merge([{dictLabel:' ',dictValue:''}], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'日期选择', name:'testDate', width:100,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate ', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'用户选择', name:'testUser', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?isLoadUser=true', cssClass: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'操作', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
if (val == 'new'){
|
||||
actions.push('<a href="#" onclick="js.confirm(\'你确认要删除这条数据吗?\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}else{
|
||||
actions.push('<a href="#" onclick="js.confirm(\'你确认要删除这条数据吗?\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'})});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}, editoptions: {defaultValue: 'new'}}
|
||||
],
|
||||
|
||||
// 编辑表格参数
|
||||
editGrid: true, // 是否是编辑表格
|
||||
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
|
||||
editGridAddRowBtn: $('#testDataChildDataGridAddRowBtn'), // 子表增行按钮
|
||||
editGridAddRowBtnToHeader: true, // 子表增行按钮是否显示到表头上 v4.1.7
|
||||
editGridAddRowInitData: {id: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
||||
|
||||
// 编辑表格的提交数据参数
|
||||
editGridInputFormListName: 'testDataChildList', // 提交的数据列表名
|
||||
editGridInputFormListAttrs: 'status,id,testSort,testData.id,testInput,testTextarea,testSelect,testSelectMultiple,testRadio,testCheckbox,testDate,testDatetime,testUser.userCode,testOffice.officeCode,testAreaCode,testAreaName,', // 提交数据列表的属性字段
|
||||
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script id="treeselectTpl" type="text/template">//<!--<div>
|
||||
<#form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true"/>
|
||||
</div>//--></script>
|
||||
<script>
|
||||
$('#inputForm').validate({
|
||||
submitHandler: function(form){
|
||||
// js.ajaxSubmitForm($(form), function(data){
|
||||
// js.showMessage(data.message);
|
||||
// if(data.result == Global.TRUE){
|
||||
// js.closeCurrentTabPage(function(contentWindow){
|
||||
// contentWindow.page();
|
||||
// });
|
||||
// }
|
||||
// }, "json");
|
||||
js.showMessage('模拟保存成功');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,403 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['validate','fileupload','dataGrid']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-note"></i> ${text(testData.isNewRecord ? '新增数据' : '编辑数据')}
|
||||
</div>
|
||||
<div class="box-tools pull-right hide">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal">
|
||||
<div class="box-body">
|
||||
<div class="form-unit">${text('基本信息')}</div>
|
||||
<#form:hidden path="id"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('单行文本')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('多行文本')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="testTextarea" rows="4" maxlength="200" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('下拉框')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('下拉多选')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('单选框')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('复选框')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('日期选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDate" readonly="true" maxlength="20" class="form-control laydate"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('日期时间')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control laydate"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('用户选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testUser" title="${text('用户选择')}"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('机构选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testOffice" title="${text('机构选择')}"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required hide">*</span> ${text('区域选择')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="testAreaCode" title="${text('区域选择')}"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData"
|
||||
class="" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('备注信息')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">${text('图片上传')}:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadImage" bizKey="${testData.id}" bizType="testData_image"
|
||||
uploadType="image" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">${text('附件上传')}:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadFile" bizKey="${testData.id}" bizType="testData_file"
|
||||
uploadType="all" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-unit">${text('子表数据')}</div>
|
||||
<div class="form-unit-wrap table-form">
|
||||
<table id="testDataChildDataGrid"></table>
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<a href="#" id="testDataChildDataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> ${text('增行')}</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<% if (hasPermi('test:testData:edit')){ %>
|
||||
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>
|
||||
<% } %>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//初始化测试数据子表DataGrid对象
|
||||
$('#testDataChildDataGrid').dataGrid({
|
||||
|
||||
data: "#{toJson(testData.testDataChildList)}",
|
||||
datatype: 'local', // 设置本地数据
|
||||
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
||||
|
||||
// 设置数据表格列
|
||||
columnModel: [
|
||||
|
||||
{header:'${text("操作")}', name:'actions', width:40, align:"center", formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
if (val == 'new'){
|
||||
actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗?")}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}else{
|
||||
actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗?")}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}, editoptions: {defaultValue: 'new'}},
|
||||
|
||||
{header:'状态', name:'status', editable:true, hidden:true},
|
||||
{header:'主键', name:'id', editable:true, hidden:true},
|
||||
{header:'${text("排序号")}', name:'testSort', width:100, editable:true, edittype:'text', editoptions:{'maxlength':'11', 'class':'form-control digits'}},
|
||||
{header:'${text("父表主键")}', name:'testData.id', editable:true, hidden:true},
|
||||
{header:'${text("单行文本")}', name:'testInput', width:100, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}},
|
||||
{header:'${text("多行文本")}', name:'testTextarea', width:100, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}},
|
||||
{header:'${text("下拉框")}', name:'testSelect', width:100,
|
||||
editable:true, edittype:'select', editoptions:{'class':'form-control',
|
||||
items: $.merge([{dictLabel:' ',dictValue:''}], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("下拉多选")}', name:'testSelectMultiple', width:90, fixed: true,
|
||||
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
|
||||
items: $.merge([], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.select2(element).on("change",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("单选框")}', name:'testRadio', width:135, fixed: true,
|
||||
editable:true, edittype:'radio', editoptions:{'class':'form-control icheck',
|
||||
items: $.merge([], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.iCheck(element).on("ifChanged",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("复选框")}', name:'testCheckbox', width:135, fixed: true,
|
||||
editable:true, edittype:'checkbox', editoptions:{'class':'form-control icheck',
|
||||
items: $.merge([], "#{@DictUtils.getDictListJson('sys_menu_type')}"),
|
||||
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
|
||||
js.iCheck(element).on("ifChanged",function(){$(this).resetValid()});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("日期选择")}', name:'testDate', width:120,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'date', format:'yyyy-MM-dd', done: function(){
|
||||
// 选择日期后,自动给下一个输入框赋值(联动实例)
|
||||
// $(element).closest('td').next().find('.form-control').val('2020-11-26 10:10');
|
||||
}});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("日期时间")}', name:'testDatetime', width:155,
|
||||
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i'},
|
||||
editable:true, edittype:'text', editoptions:{'class':'form-control laydate', 'readonly':'true',
|
||||
dataInit: function(element){
|
||||
laydate.render({elem:element, type:'datetime', format:'yyyy-MM-dd HH:mm'});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("用户选择")}', name:'testUser', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?isLoadUser=true', cssClass: '', readonly: false
|
||||
});
|
||||
},
|
||||
custom_value: function(element, act){
|
||||
return {userCode: element.find('[type=hidden]').val(),
|
||||
userName: element.find('[type=text]').val()};
|
||||
},
|
||||
dataInit: function(element){
|
||||
// 初始化控件后设置只读模式(实例)
|
||||
// $(element).find('.form-control, .btn').addClass('disabled');
|
||||
}
|
||||
},
|
||||
unformat: function(val, obj, cell){
|
||||
return $('#user_'+obj.rowId+'_'+obj.colModel.name+'Code', cell).val();
|
||||
}
|
||||
},
|
||||
{header:'${text("用户选择")}', name:'testUser2', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('listselectTpl', {
|
||||
id: 'user_'+editOptions.id, title: '用户选择',
|
||||
name: 'testUser2.userCode', value: val.split('|')[0],
|
||||
labelName: 'testUser2.userName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/empUser/empUserSelect', cssClass: '', readonly: false,
|
||||
itemCode: 'userCode', itemName: 'userName'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("机构选择")}', name:'testOffice', width:100, title:false,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testOffice.officeCode')+'|'+js.val(row, 'testOffice.officeName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'office_'+editOptions.id, title: '机构选择',
|
||||
name: 'testOffice.officeCode', value: val.split('|')[0],
|
||||
labelName: 'testOffice.officeName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/office/treeData?officeTypes=1,2', cssClass: '', readonly: false
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("区域选择")}', name:'testAreaCode', width:100,
|
||||
formatter: function(val, obj, row, act){
|
||||
return js.val(row, 'testAreaCode')+'|'+js.val(row, 'testAreaName');
|
||||
}, editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('treeselectTpl', {
|
||||
id: 'area_'+editOptions.id, title: '区域选择',
|
||||
name: 'testAreaCode', value: val.split('|')[0],
|
||||
labelName: 'testAreaName', labelValue: val.split('|')[1],
|
||||
url: '${ctx}/sys/area/treeData', cssClass: '', readonly: false
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{header:'${text("文件上传")}', name:'id', width:200,
|
||||
editable: true, edittype: "custom", editoptions: {
|
||||
custom_element: function(val, editOptions) {
|
||||
return js.template('fileuploadTpl', {
|
||||
id: 'fileupload_'+editOptions.id, title: '区域选择',
|
||||
bizKey: val, bizType: 'testDataChild_file', cssClass: '', readonly: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
shrinkToFit: false, // 是否按百分比自动调整列宽
|
||||
|
||||
// 编辑表格参数
|
||||
editGrid: true, // 是否是编辑表格
|
||||
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
|
||||
editGridAddRowBtn: $('#testDataChildDataGridAddRowBtn'), // 子表增行按钮
|
||||
editGridAddRowBtnToHeader: true, // 子表增行按钮是否显示到表头上 v4.1.7
|
||||
editGridAddRowInitData: {id: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
||||
|
||||
// 编辑表格的提交数据参数
|
||||
editGridInputFormListName: 'testDataChildList', // 提交的数据列表名
|
||||
editGridInputFormListAttrs: 'status,id,testSort,testData.id,testInput,testTextarea,testSelect,testSelectMultiple,'
|
||||
+'testRadio,testCheckbox,testDate,testDatetime,testUser.userCode,testOffice.officeCode,'
|
||||
+'testAreaCode,testAreaName,testDataChild_file,testDataChild_file__del', // 提交数据列表的属性字段
|
||||
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
// $('#jqgh_testDataChildDataGrid_rn').append('<a href="javascript:" onclick="'
|
||||
// + '$(\'#testDataChildDataGridAddRowBtn\').click();">'
|
||||
// + '<i class="fa fa-plus"></i></a>');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script id="treeselectTpl" type="text/template">//<!--<div>
|
||||
<#form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true" readonly="{{d.readonly}}"/>
|
||||
</div>//--></script>
|
||||
<script id="listselectTpl" type="text/template">//<!--<div>
|
||||
<#form:listselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
|
||||
labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
|
||||
class="{{d.cssClass}}" btnClass="btn-sm" allowClear="true" readonly="{{d.readonly}}"
|
||||
itemCode="{{d.itemCode}}" itemName="{{d.itemName}}"/>
|
||||
</div>//--></script>
|
||||
<script id="fileuploadTpl" type="text/template">//<!--<div>
|
||||
<#form:fileupload id="{{d.id}}" bizKey="{{d.bizKey}}" bizType="{{d.bizType}}" uploadType="all"
|
||||
class="{{d.cssClass}}" isMini="true" preview="true" readonly="{{d.readonly}}"/>
|
||||
</div>//--></script>
|
||||
<script>
|
||||
$('#inputForm').validate({
|
||||
submitHandler: function(form){
|
||||
js.ajaxSubmitForm($(form), function(data){
|
||||
js.showMessage(data.message);
|
||||
if(data.result == Global.TRUE){
|
||||
js.closeCurrentTabPage(function(contentWindow){
|
||||
contentWindow.page();
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,244 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['dataGrid']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> ${text('数据管理')}
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
|
||||
<% if(hasPermi('test:testData:edit')){ %>
|
||||
<a href="${ctx}/test/testData/form" class="btn btn-default btnTool" title="${text('新增数据')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
|
||||
<% } %>
|
||||
<a href="#" class="btn btn-default" id="btnTrunsTest" title="事务测试"><i class="fa fa-refresh"></i> 事务测试</a>
|
||||
<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<#form:form id="searchForm" model="${testData}" action="${ctx}/test/testData/listData" method="post" class="form-inline "
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('单行文本')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testInput" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hide">
|
||||
<label class="control-label">${text('多行文本')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testTextarea" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('下拉框')}:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('日期选择')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="testDate_lte.click()"/>
|
||||
-
|
||||
<#form:input path="testDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
|
||||
dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
|
||||
<button type="button" class="btn btn-default btn-sm btnFormMore"><i class="fa fa-angle-double-down"></i> ${text('更多')}</button>
|
||||
</div>
|
||||
<div class="form-more">
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('日期时间')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="testDatetime_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" data-done="testDatetime_lte.click()"/>
|
||||
-
|
||||
<#form:input path="testDatetime_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
|
||||
dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('用户选择')}:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testUser" title="${text('用户选择')}"
|
||||
path="testUser.userCode" labelPath="testUser.userName"
|
||||
url="${ctx}/sys/office/treeData?isLoadUser=true" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('机构选择')}:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testOffice" title="${text('机构选择')}"
|
||||
path="testOffice.officeCode" labelPath="testOffice.officeName"
|
||||
url="${ctx}/sys/office/treeData" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('区域选择')}:</label>
|
||||
<div class="control-inline width-120" >
|
||||
<#form:treeselect id="testAreaCode" title="${text('区域选择')}"
|
||||
path="testAreaCode" labelPath="testAreaName"
|
||||
url="${ctx}/sys/area/treeData" allowClear="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('下拉多选')}:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('数据状态')}:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('单选框')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:radio path="testRadio" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('复选框')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" blankOption="true" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
<div id="dataGridPage"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $('#searchForm'),
|
||||
columnModel: [
|
||||
{header:'${text("单行文本")}', name:'testInput', index:'a.test_input', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
|
||||
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
|
||||
}, searchoptions: { dataInit: function (element) {
|
||||
$(element).attr('form', 'searchForm').attr('name', 'testInput2');
|
||||
}}},
|
||||
{header:'${text("多行文本")}', name:'testTextarea', index:'a.test_textarea', width:150, align:"left"},
|
||||
{header:'${text("下拉框")}', name:'testSelect', index:'a.test_select', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("下拉多选")}', name:'testSelectMultiple', index:'a.test_select_multiple', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("单选框")}', name:'testRadio', index:'a.test_radio', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("复选框")}', name:'testCheckbox', index:'a.test_checkbox', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("日期选择")}', name:'testDate', index:'a.test_date', width:150, align:"center"},
|
||||
{header:'${text("日期时间")}', name:'testDatetime', index:'a.test_datetime', width:150, align:"center"},
|
||||
{header:'${text("用户选择")}', name:'testUser.userName', index:'a.test_user_code', width:150, align:"center"},
|
||||
{header:'${text("机构选择")}', name:'testOffice.officeName', index:'a.test_office_code', width:150, align:"center"},
|
||||
{header:'${text("区域选择")}', name:'testAreaName', index:'a.test_area_code', width:150, align:"center"},
|
||||
{header:'${text("区域名称")}', name:'testAreaName', index:'a.test_area_name', width:150, align:"left"},
|
||||
{header:'${text("状态")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_search_status')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', firstsortorder:'desc', width:150, align:"center"},
|
||||
{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
|
||||
{header:'${text("操作")}', name:'actions', width:100, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
//# if(hasPermi('test:testData:edit')){
|
||||
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="${text("编辑数据")}"><i class="fa fa-pencil"></i></a> ');
|
||||
if (row.status == Global.STATUS_NORMAL){
|
||||
actions.push('<a href="${ctx}/test/testData/disable?id='+row.id+'" class="btnList" title="${text("停用数据")}" data-confirm="${text("确认要停用该数据吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a> ');
|
||||
} else if (row.status == Global.STATUS_DISABLE){
|
||||
actions.push('<a href="${ctx}/test/testData/enable?id='+row.id+'" class="btnList" title="${text("启用数据")}" data-confirm="${text("确认要启用该数据吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a> ');
|
||||
}
|
||||
actions.push('<a href="${ctx}/test/testData/delete?id='+row.id+'" class="btnList" title="${text("删除数据")}" data-confirm="${text("确认要删除该数据吗?")}"><i class="fa fa-trash-o"></i></a> ');
|
||||
//# }
|
||||
return actions.join('');
|
||||
}}
|
||||
],
|
||||
// 双击表格行时调用
|
||||
ondblClickRow: function(id, rownum, colnum, event){
|
||||
js.addTabPage(null, '编辑数据', '${ctx}/test/testData/form?id='+id);
|
||||
},
|
||||
|
||||
// 子表格支持演示
|
||||
subGrid: true,
|
||||
subGridRowExpanded: function (subgridId, rowId) {
|
||||
$('#'+subgridId).html('<h5><i class="icon-docs"></i> 子表数据</h5>'
|
||||
+'<table id="'+subgridId+'_subgrid"></table>');
|
||||
$('#'+subgridId+'_subgrid').dataGrid({
|
||||
url: '${ctx}/test/testData/subListData',
|
||||
postData: {'testData.id': rowId},
|
||||
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
||||
autoGridWidth: function(){return $("#"+subgridId).width()}, // 设置自动高度
|
||||
// 设置数据表格列
|
||||
columnModel: [
|
||||
{header:'${text("单行文本")}', name:'testInput', width:150},
|
||||
{header:'${text("多行文本")}', name:'testTextarea', width:150},
|
||||
{header:'${text("下拉框")}', name:'testSelect', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("下拉多选")}', name:'testSelectMultiple', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("单选框")}', name:'testRadio', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("复选框")}', name:'testCheckbox', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_menu_type')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("日期时间")}', name:'testDatetime', width:150, align:"center"},
|
||||
{header:'${text("用户名称")}', name:'testUser.userName', sortable:false, width:150, align:"center"},
|
||||
{header:'${text("机构名称")}', name:'testOffice.officeName', sortable:false, width:150, align:"center"},
|
||||
{header:'${text("区域名称")}', name:'testAreaName', width:150, align:"center"}
|
||||
],
|
||||
emptyDataHint: true, // 表格内没有数据的时候提示 “无数据显示” v4.1.7
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
$(window).resize();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
multiSort: true, // 是否支持多列排序,给列指定 firstsortorder 可设定初次排序方式
|
||||
emptyDataHint: true, // 表格内没有数据的时候提示 “无数据显示” v4.1.7
|
||||
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
// // 无数据显示,v4.1.7 之前版本
|
||||
// if (data.count == 0){
|
||||
// $('#dataGrid').parent().append("<div class=\"ml10\">没有符合数据</div>");
|
||||
// }
|
||||
// // 分页控件后面追加附加信息实例
|
||||
// $('#dataGridPage ul:last').after('<ul class="pagination"><li class="disabled controls">分页附加信息</li></ul>');
|
||||
// // 根据数据状态,高亮行,变色行,着色行
|
||||
// $.each(data.list, function(k, v){
|
||||
// if (v.status == Global.STATUS_DISABLE){
|
||||
// $('#'+v.id+' td').css('background', '#e4fda8');
|
||||
// }
|
||||
// });
|
||||
}
|
||||
})
|
||||
// 开启表头下放搜索工具条
|
||||
//.jqGrid('filterToolbar')
|
||||
// 列表设置显示隐藏或排序后的事件(可用于设置持久化)
|
||||
.on('jqGridRemapColumns',function(){
|
||||
log($('#dataGrid').dataGrid('getParam', 'columnModel'));
|
||||
});
|
||||
$("#btnTrunsTest").click(function(){
|
||||
js.ajaxSubmit("${ctx}/test/testData/transTest", function(data){
|
||||
js.showMessage(data.message);
|
||||
page();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
@@ -1,131 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['validate','fileupload']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-note"></i> ${text(testTree.isNewRecord ? '新增数据' : '编辑数据')}
|
||||
</div>
|
||||
<div class="box-tools pull-right hide">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<#form:form id="inputForm" model="${testTree}" action="${ctx}/test/testTree/save" method="post" class="form-horizontal">
|
||||
<div class="box-body">
|
||||
<div class="form-unit">${text('基本信息')}</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4">${text('上级数据')}:</label>
|
||||
<div class="col-sm-8">
|
||||
<#form:treeselect id="parent" title="${text('上级数据')}"
|
||||
path="parent.id" labelPath="parent.treeName"
|
||||
url="${ctx}/test/testTree/treeData?excludeCode=${testTree.id}"
|
||||
class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required ">*</span> ${text('节点编码')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:hidden path="isNewRecord"/>
|
||||
<#form:input path="treeCode" maxlength="64" readonly="${!testTree.isNewRecord}" class="form-control required abc"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required ">*</span> ${text('节点名称')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="treeName" maxlength="200" class="form-control required"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required ">*</span> ${text('排序号')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:input path="treeSort" class="form-control required digits"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" title="">
|
||||
<span class="required hide">*</span> ${text('备注信息')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-10">
|
||||
<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">${text('图片上传')}:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadImage" bizKey="${testTree.id}" bizType="testTree_image"
|
||||
uploadType="image" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2">${text('附件上传')}:</label>
|
||||
<div class="col-sm-10">
|
||||
<#form:fileupload id="uploadFile" bizKey="${testTree.id}" bizType="testTree_file"
|
||||
uploadType="all" class="" readonly="false" preview="true"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<% if (hasPermi('test:testTree:edit')){ %>
|
||||
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>
|
||||
<% } %>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#form:form>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
$('#inputForm').validate({
|
||||
submitHandler: function(form){
|
||||
js.ajaxSubmitForm($(form), function(data){
|
||||
js.showMessage(data.message);
|
||||
if(data.result == Global.TRUE){
|
||||
js.closeCurrentTabPage(function(contentWindow){
|
||||
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
|
||||
$('#parentCode').val(), '${testTree.id}');
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
|
||||
// 选择上级节点回调方法
|
||||
function treeselectCallback(id, act, index, layero){
|
||||
if (id == 'parent' && (act == 'ok' || act == 'clear')){
|
||||
// 创建并初始化下一个节点信息,如:排序号、默认值
|
||||
$.get('${ctx}/test/testTree/createNextNode?parentCode='
|
||||
+$('#parentCode').val(), function(data){
|
||||
$('#treeSort').val(data.treeSort);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,96 +0,0 @@
|
||||
<% layout('/layouts/default.html', {title: '数据管理', libs: ['dataGrid']}){ %>
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-notebook"></i> ${text('数据管理')}
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
|
||||
<a href="#" class="btn btn-default" id="btnRefreshTree" title="${text('刷新')}"><i class="fa fa-refresh"></i> ${text('刷新')}</a>
|
||||
<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="${text('展开一级')}"><i class="fa fa-angle-double-down"></i> ${text('展开')}</a>
|
||||
<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> ${text('折叠')}</a>
|
||||
<% if(hasPermi('test:testTree:edit')){ %>
|
||||
<a href="${ctx}/test/testTree/form" class="btn btn-default btnTool" title="${text('新增数据')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
|
||||
<a href="#" class="btn btn-default" id="btnFixTreeData" title="修复树表数据(包含字段:parentCodes、treeLeaf、treeLevel、treeSorts、treeNames)"><i class="fa fa-refresh"></i> 修复</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<#form:form id="searchForm" model="${testTree}" action="${ctx}/test/testTree/listData" method="post" class="form-inline hide"
|
||||
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('节点名称')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="treeName" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('备注信息')}:</label>
|
||||
<div class="control-inline">
|
||||
<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">${text('状态')}:</label>
|
||||
<div class="control-inline width-120">
|
||||
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
|
||||
<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
|
||||
</div>
|
||||
</#form:form>
|
||||
<table id="dataGrid"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
<script>
|
||||
//# // 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $('#searchForm'),
|
||||
columnModel: [
|
||||
{header:'${text("节点名称")}', name:'treeName', index:'a.tree_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
|
||||
return '( '+row.treeCode+' ) '+'<a href="${ctx}/test/testTree/form?treeCode='+row.treeCode+'" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
|
||||
}},
|
||||
{header:'${text("排序号")}', name:'treeSort', index:'a.tree_sort', width:150, align:"center"},
|
||||
{header:'${text("节点名称")}', name:'treeName', index:'a.tree_name', width:150, align:"left"},
|
||||
{header:'${text("状态")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
|
||||
return js.getDictLabel("#{@DictUtils.getDictListJson('sys_search_status')}", val, '${text("未知")}', true);
|
||||
}},
|
||||
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
|
||||
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
|
||||
{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
//# if(hasPermi('test:testTree:edit')){
|
||||
actions.push('<a href="${ctx}/test/testTree/form?treeCode='+row.treeCode+'" class="btnList" title="${text("编辑数据")}"><i class="fa fa-pencil"></i></a> ');
|
||||
if (row.status == Global.STATUS_NORMAL){
|
||||
actions.push('<a href="${ctx}/test/testTree/disable?treeCode='+row.treeCode+'" class="btnList" title="${text("停用数据")}" data-confirm="${text("确认要停用该数据吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a> ');
|
||||
} else if (row.status == Global.STATUS_DISABLE){
|
||||
actions.push('<a href="${ctx}/test/testTree/enable?treeCode='+row.treeCode+'" class="btnList" title="${text("启用数据")}" data-confirm="${text("确认要启用该数据吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a> ');
|
||||
}
|
||||
actions.push('<a href="${ctx}/test/testTree/delete?treeCode='+row.treeCode+'" class="btnList" title="${text("删除数据")}" data-confirm="${text("确认要删除该数据及所有子数据吗?")}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a> ');
|
||||
actions.push('<a href="${ctx}/test/testTree/form?parentCode='+row.id+'" class="btnList" title="${text("新增下级数据")}"><i class="fa fa-plus-square"></i></a> ');
|
||||
//# }
|
||||
return actions.join('');
|
||||
}}
|
||||
],
|
||||
treeGrid: true, // 启用树结构表格
|
||||
defaultExpandLevel: 0, // 默认展开的层次
|
||||
expandNodeClearPostData: 'treeName,remarks,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)
|
||||
//# // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//# // 修复树表数据(包含字段:parentCodes、treeLeaf、treeLevel、treeSorts、treeNames)
|
||||
$("#btnFixTreeData").click(function(){
|
||||
js.ajaxSubmit("${ctx}/test/testTree/fixTreeData", function(data){
|
||||
js.showMessage(data.message);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user