mirror of https://gitee.com/y_project/RuoYi.git
treegrid居中
parent
60f982e315
commit
ec8d651e3b
|
@ -73,16 +73,16 @@
|
||||||
hasSelectItem = true;
|
hasSelectItem = true;
|
||||||
var td = $('<td style="text-align:center;width:36px"></td>');
|
var td = $('<td style="text-align:center;width:36px"></td>');
|
||||||
if(column.radio){
|
if(column.radio){
|
||||||
var _ipt = $('<input name="select_item" type="radio" value="'+item[options.id]+'"></input>');
|
var _ipt = $('<input text="select_item" type="radio" value="'+item[options.id]+'"></input>');
|
||||||
td.append(_ipt);
|
td.append(_ipt);
|
||||||
}
|
}
|
||||||
if(column.checkbox){
|
if(column.checkbox){
|
||||||
var _ipt = $('<input name="select_item" type="checkbox" value="'+item[options.id]+'"></input>');
|
var _ipt = $('<input text="select_item" type="checkbox" value="'+item[options.id]+'"></input>');
|
||||||
td.append(_ipt);
|
td.append(_ipt);
|
||||||
}
|
}
|
||||||
tr.append(td);
|
tr.append(td);
|
||||||
}else{
|
}else{
|
||||||
var td = $('<td style="'+((column.width)?('width:'+column.width):'')+'"></td>');
|
var td = $('<td style="text-align:'+column.align+';'+((column.width)?('width:'+column.width):'')+'"></td>');
|
||||||
// 增加formatter渲染
|
// 增加formatter渲染
|
||||||
if (column.formatter) {
|
if (column.formatter) {
|
||||||
td.html(column.formatter.call(this, item, index));
|
td.html(column.formatter.call(this, item, index));
|
||||||
|
@ -104,9 +104,9 @@
|
||||||
// 判断有没有选择列
|
// 判断有没有选择列
|
||||||
if(i==0&&item.field=='selectItem'){
|
if(i==0&&item.field=='selectItem'){
|
||||||
hasSelectItem = true;
|
hasSelectItem = true;
|
||||||
th = $('<th style="width:36px"></th>');
|
th = $('<th style="text-align:'+item.valign+';width:36px"></th>');
|
||||||
}else{
|
}else{
|
||||||
th = $('<th style="padding:10px;'+((item.width)?('width:'+item.width):'')+'"></th>');
|
th = $('<th style="text-align:'+item.valign+';padding:10px;'+((item.width)?('width:'+item.width):'')+'"></th>');
|
||||||
}
|
}
|
||||||
th.text(item.title);
|
th.text(item.title);
|
||||||
thr.append(th);
|
thr.append(th);
|
||||||
|
@ -170,7 +170,7 @@
|
||||||
// 行点击选中事件
|
// 行点击选中事件
|
||||||
target.find("tbody").find("tr").click(function(){
|
target.find("tbody").find("tr").click(function(){
|
||||||
if(hasSelectItem){
|
if(hasSelectItem){
|
||||||
var _ipt = $(this).find("input[name='select_item']");
|
var _ipt = $(this).find("input[text='select_item']");
|
||||||
if(_ipt.attr("type")=="radio"){
|
if(_ipt.attr("type")=="radio"){
|
||||||
_ipt.prop('checked',true);
|
_ipt.prop('checked',true);
|
||||||
target.find("tbody").find("tr").removeClass("treegrid-selected");
|
target.find("tbody").find("tr").removeClass("treegrid-selected");
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
// 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id
|
// 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id
|
||||||
getSelections : function(target, data) {
|
getSelections : function(target, data) {
|
||||||
// 所有被选中的记录input
|
// 所有被选中的记录input
|
||||||
var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked");
|
var _ipt = target.find("tbody").find("tr").find("input[text='select_item']:checked");
|
||||||
var chk_value =[];
|
var chk_value =[];
|
||||||
// 如果是radio
|
// 如果是radio
|
||||||
if(_ipt.attr("type")=="radio"){
|
if(_ipt.attr("type")=="radio"){
|
||||||
|
|
|
@ -7,15 +7,17 @@ window.onload = function() {
|
||||||
function loading() {
|
function loading() {
|
||||||
var columns = [{
|
var columns = [{
|
||||||
field : 'deptName',
|
field : 'deptName',
|
||||||
title : '部门名称'
|
title : '部门名称',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field : 'orderNum',
|
field : 'orderNum',
|
||||||
title : '排序'
|
title : '排序',
|
||||||
|
align : "center"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field : 'status',
|
field : 'status',
|
||||||
title : '状态',
|
title : '状态',
|
||||||
|
align : "center",
|
||||||
formatter : function(item, index) {
|
formatter : function(item, index) {
|
||||||
if (item.status == '0') {
|
if (item.status == '0') {
|
||||||
return '<span class="badge badge-primary">正常</span>';
|
return '<span class="badge badge-primary">正常</span>';
|
||||||
|
@ -26,7 +28,8 @@ function loading() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createTimeStr',
|
field: 'createTimeStr',
|
||||||
title : '创建时间'
|
title : '创建时间',
|
||||||
|
align : "center"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title : '操作',
|
title : '操作',
|
||||||
|
|
|
@ -22,16 +22,19 @@ function loading() {
|
||||||
field : 'orderNum',
|
field : 'orderNum',
|
||||||
title : '排序',
|
title : '排序',
|
||||||
width : '10%',
|
width : '10%',
|
||||||
|
align : "center"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field : 'url',
|
field : 'url',
|
||||||
title : '请求地址',
|
title : '请求地址',
|
||||||
width : '15%',
|
width : '15%',
|
||||||
|
align : "center"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title : '类型',
|
title : '类型',
|
||||||
field : 'menuType',
|
field : 'menuType',
|
||||||
width : '10%',
|
width : '10%',
|
||||||
|
align : "center",
|
||||||
formatter : function(item, index) {
|
formatter : function(item, index) {
|
||||||
if (item.menuType == 'M') {
|
if (item.menuType == 'M') {
|
||||||
return '<span class="label label-success">目录</span>';
|
return '<span class="label label-success">目录</span>';
|
||||||
|
@ -48,6 +51,7 @@ function loading() {
|
||||||
field: 'visible',
|
field: 'visible',
|
||||||
title: '可见',
|
title: '可见',
|
||||||
width : '10%',
|
width : '10%',
|
||||||
|
align : "center",
|
||||||
formatter: function(row, index) {
|
formatter: function(row, index) {
|
||||||
if (row.visible == 0) {
|
if (row.visible == 0) {
|
||||||
return '<span class="badge badge-primary">显示</span>';
|
return '<span class="badge badge-primary">显示</span>';
|
||||||
|
@ -60,10 +64,12 @@ function loading() {
|
||||||
field : 'perms',
|
field : 'perms',
|
||||||
title : '权限标识',
|
title : '权限标识',
|
||||||
width : '15%',
|
width : '15%',
|
||||||
|
align : "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title : '操作',
|
title : '操作',
|
||||||
width : '20%',
|
width : '20%',
|
||||||
|
align : "center",
|
||||||
formatter : function(row, index) {
|
formatter : function(row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" mce_href="#" onclick="edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" mce_href="#" onclick="edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||||
|
|
Loading…
Reference in New Issue