@@ -14,11 +14,11 @@
< div class = "form-unit" > ${text('基本信息')}< / div >
< div class = "form-unit" > ${text('基本信息')}< / div >
< #form:hidden path="id"/>
< #form:hidden path="id"/>
< div class = "row" >
< div class = "row" >
< div class = "col-xs-6 " >
< div class = "col-xs-12 " >
< div class = "form-group" >
< div class = "form-group" >
< label class = "control-label col-sm-4 " title = "" >
< label class = "control-label col-sm-2 " title = "" >
< span class = "required hide" > *< / span > ${text('单行文本')}: < i class = "fa icon-question hide" > < / i > < / label >
< span class = "required hide" > *< / span > ${text('单行文本')}: < i class = "fa icon-question hide" > < / i > < / label >
< div class = "col-sm-8 " >
< div class = "col-sm-10 " >
< #form:input path="testInput" maxlength="200" class="form-control"/>
< #form:input path="testInput" maxlength="200" class="form-control"/>
< / div >
< / div >
< / div >
< / div >
@@ -202,73 +202,100 @@ $("#testDataChildDataGrid").dataGrid({
// 设置数据表格列
// 设置数据表格列
columnModel : [
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 : 'status' , editable : true , hidden : true } ,
{ header : '主键' , name : 'id' , editable : true , hidden : true } ,
{ header : '主键' , name : 'id' , editable : true , hidden : true } ,
{ header : '${text("排序号")}' , name : 'testSort' , width : 13 0 , editable : true , edittype : 'text' , editoptions : { 'maxlength' : '11' , 'class' : 'form-control digits' } } ,
{ header : '${text("排序号")}' , name : 'testSort' , width : 10 0 , editable : true , edittype : 'text' , editoptions : { 'maxlength' : '11' , 'class' : 'form-control digits' } } ,
{ header : '${text("父表主键")}' , name : 'testData.id' , editable : true , hidden : true } ,
{ header : '${text("父表主键")}' , name : 'testData.id' , editable : true , hidden : true } ,
{ header : '${text("单行文本")}' , name : 'testInput' , width : 13 0 , editable : true , edittype : 'text' , editoptions : { 'maxlength' : '200' , 'class' : 'form-control' } } ,
{ header : '${text("单行文本")}' , name : 'testInput' , width : 10 0 , editable : true , edittype : 'text' , editoptions : { 'maxlength' : '200' , 'class' : 'form-control' } } ,
{ header : '${text("多行文本")}' , name : 'testTextarea' , width : 13 0 , editable : true , edittype : 'textarea' , editoptions : { 'maxlength' : '200' , 'class' : 'form-control' , 'rows' : '1' } } ,
{ header : '${text("多行文本")}' , name : 'testTextarea' , width : 10 0 , editable : true , edittype : 'textarea' , editoptions : { 'maxlength' : '200' , 'class' : 'form-control' , 'rows' : '1' } } ,
{ header : '${text("下拉框")}' , name : 'testSelect' , width : 100 ,
{ header : '${text("下拉框")}' , name : 'testSelect' , width : 100 ,
editable : true , edittype : 'select' , editoptions : { 'class' : 'form-control' ,
editable : true , edittype : 'select' , editoptions : { 'class' : 'form-control' ,
items : $ . merge ( [ { dictLabel : ' ' , dictValue : '' } ] , $ { @ DictUtils . getDictListJson ( 'sys_menu_type' ) } ) ,
items : $ . merge ( [ { dictLabel : ' ' , dictValue : '' } ] , $ { @ DictUtils . getDictListJson ( 'sys_menu_type' ) } ) ,
itemLabel : 'dictLabel' , itemValue : 'dictValue' , dataInit : function ( element ) {
itemLabel : 'dictLabel' , itemValue : 'dictValue' , dataInit : function ( element ) {
$ ( element ) . s elect2 ( ) . on ( "change" , function ( ) { $ ( this ) . resetValid ( ) } ) ;
js . s elect2 ( element ) . on ( "change" , function ( ) { $ ( this ) . resetValid ( ) } ) ;
}
}
}
}
} ,
} ,
{ header : '${text("下拉多选")}' , name : 'testSelectMultiple' , width : 13 0,
{ header : '${text("下拉多选")}' , name : 'testSelectMultiple' , width : 9 0, fixed : true ,
editable : true , edittype : 'select' , editoptions : { multiple : true , 'class' : 'form-control' ,
editable : true , edittype : 'select' , editoptions : { multiple : true , 'class' : 'form-control' ,
items : $ . merge ( [ ] , $ { @ DictUtils . getDictListJson ( 'sys_menu_type' ) } ) ,
items : $ . merge ( [ ] , $ { @ DictUtils . getDictListJson ( 'sys_menu_type' ) } ) ,
itemLabel : 'dictLabel' , itemValue : 'dictValue' , dataInit : function ( element ) {
itemLabel : 'dictLabel' , itemValue : 'dictValue' , dataInit : function ( element ) {
$ ( element ) . s elect2 ( ) . on ( "change" , function ( ) { $ ( this ) . resetValid ( ) } ) ;
js . s elect2 ( element ) . on ( "change" , function ( ) { $ ( this ) . resetValid ( ) } ) ;
}
}
}
}
} ,
} ,
{ header : '${text("单选框")}' , name : 'testRadio' , width : 100 ,
{ header : '${text("单选框")}' , name : 'testRadio' , width : 135 , fixed : true ,
editable : true , edittype : 'select ' , editoptions : { 'class' : 'form-control' ,
editable : true , edittype : 'radio ' , editoptions : { 'class' : 'form-control icheck ' ,
items : $ . merge ( [ { dictLabel : ' ' , dictValue : '' } ], $ { @ DictUtils . getDictListJson ( 'sys_menu_type' ) } ) ,
items : $ . merge ( [ ] , $ { @ DictUtils . getDictListJson ( 'sys_menu_type' ) } ) ,
itemLabel : 'dictLabel' , itemValue : 'dictValue' , dataInit : function ( element ) {
itemLabel : 'dictLabel' , itemValue : 'dictValue' , dataInit : function ( element ) {
$ ( element ) . s elect2 ( ) . on ( "c hange" , function ( ) { $ ( this ) . resetValid ( ) } ) ;
js . iCheck ( element ) . on ( "ifC hanged " , function ( ) { $ ( this ) . resetValid ( ) } ) ;
}
}
}
}
} ,
} ,
{ header : '${text("日期选择 ")}' , name : 'testDate ' , width : 150 ,
{ 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' } ,
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' ,
editable : true , edittype : 'text' , editoptions : { 'class' : 'form-control laydate' , 'readonly' : 'true' ,
dataInit : function ( element ) {
dataInit : function ( element ) {
laydate . render ( { elem : element , type : 'date' , format : 'yyyy-MM-dd' , done : function ( ) {
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:10 ');
// $(element).closest('td').next().find('.form-control').val('2020-11-26 10:10');
} } ) ;
} } ) ;
}
}
}
}
} ,
} ,
// { header: '${text("用户选择")}', name:'testUser', width:150,
{ header: '${text("日期时间")}' , name : 'testDatetime' , width : 155 ,
// formatter: function(val, obj, row, act){
formatter: 'date' , formatoptions : { srcformat : 'Y-m-d H:i:s' , newformat : 'Y-m-d H:i' } ,
// return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
editable : true , edittype : 'text' , editoptions : { 'class' : 'form-control laydate' , 'readonly' : 'true' ,
// }, editable: true, edittype: "custom", editoptions: {
dataInit : function ( element ) {
// custom_element: function(val, editOptions) {
laydate . render ( { elem : element , type : 'datetime' , format : 'yyyy-MM-dd HH:mm' } ) ;
// return js.template('treeselectTpl', {
}
// id: 'user_'+editOptions.id, title: '用户选择',
}
// name: 'testUser.userCode', value: val.split('|')[0],
} ,
// labelName: 'testUser.userName', labelValue: val.split('|')[1],
{ header : '${text("用户选择")}' , name : 'testUser' , width : 100 ,
// url: '${ctx}/sys/office/treeData?isLoadUser=true', cssClass: '', readonly: false
formatter : function ( val , obj , row , act ) {
// });
return js . val ( row , 'testUser.userCode' ) + '|' + js . val ( row , 'testUser.userName' ) ;
// },
} , editable : true , edittype : "custom" , editoptions : {
// custom_value: function(element, act){
custom_element : function ( val , editOptions ) {
// return {userCode: element.find('[type=hidden]').val(),
return js . template ( 'treeselectTpl' , {
// userName: element.find('[type=text]').val()};
id : 'user_' + editOptions . id , title : '用户选择' ,
// },
name : 'testUser.userCode' , value : val . split ( '|' ) [ 0 ] ,
// dataInit: function(element){
labelName : 'testUser.userName' , labelValue : val . split ( '|' ) [ 1 ] ,
// // 初始化控件后设置只读模式(实例)
url : '${ctx}/sys/office/treeData?isLoadUser=true' , cssClass : '' , readonly : false
// // $(element).find('.form-control, .btn').addClass('disabled');
} ) ;
// }
} ,
// },
custom _value : function ( element , act ) {
// unformat: function(val, obj, cell){
return { userCode : element . find ( '[type=hidden]' ) . val ( ) ,
// return $('#user_'+obj.rowId+'_'+obj.colModel.name+'Code', cell).val();
userName : element . find ( '[type=text]' ) . val ( ) } ;
// }
} ,
// },
dataInit : function ( element ) {
{ header : '${text("用户选择")}' , name : 'testUser2' , width : 150 ,
// 初始化控件后设置只读模式(实例)
// $(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 ) {
formatter : function ( val , obj , row , act ) {
return js . val ( row , 'testUser.userCode' ) + '|' + js . val ( row , 'testUser.userName' ) ;
return js . val ( row , 'testUser.userCode' ) + '|' + js . val ( row , 'testUser.userName' ) ;
} , editable : true , edittype : "custom" , editoptions : {
} , editable : true , edittype : "custom" , editoptions : {
@@ -283,7 +310,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
}
}
} ,
} ,
{ header : '${text("机构选择")}' , name : 'testOffice' , width : 15 0 , title : false ,
{ header : '${text("机构选择")}' , name : 'testOffice' , width : 10 0 , title : false ,
formatter : function ( val , obj , row , act ) {
formatter : function ( val , obj , row , act ) {
return js . val ( row , 'testOffice.officeCode' ) + '|' + js . val ( row , 'testOffice.officeName' ) ;
return js . val ( row , 'testOffice.officeCode' ) + '|' + js . val ( row , 'testOffice.officeName' ) ;
} , editable : true , edittype : "custom" , editoptions : {
} , editable : true , edittype : "custom" , editoptions : {
@@ -297,7 +324,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
}
}
} ,
} ,
{ header : '${text("区域选择")}' , name : 'testAreaCode' , width : 15 0 ,
{ header : '${text("区域选择")}' , name : 'testAreaCode' , width : 10 0 ,
formatter : function ( val , obj , row , act ) {
formatter : function ( val , obj , row , act ) {
return js . val ( row , 'testAreaCode' ) + '|' + js . val ( row , 'testAreaName' ) ;
return js . val ( row , 'testAreaCode' ) + '|' + js . val ( row , 'testAreaName' ) ;
} , editable : true , edittype : "custom" , editoptions : {
} , editable : true , edittype : "custom" , editoptions : {
@@ -320,17 +347,9 @@ $("#testDataChildDataGrid").dataGrid({
} ) ;
} ) ;
}
}
}
}
} ,
}
{ header : '${text("操作")}' , name : 'actions' , width : 60 , sortable : false , fixed : true , 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' } }
] ,
] ,
shrinkToFit : false , // 是否按百分比自动调整列宽
// 编辑表格参数
// 编辑表格参数
editGrid : true , // 是否是编辑表格
editGrid : true , // 是否是编辑表格