|
@@ -12,6 +12,7 @@ |
|
|
var _top = 0; |
|
|
var _top = 0; |
|
|
var _deep = 0; |
|
|
var _deep = 0; |
|
|
var _frozen = false; |
|
|
var _frozen = false; |
|
|
|
|
|
//var _ishide = false; |
|
|
|
|
|
|
|
|
if (parent) { |
|
|
if (parent) { |
|
|
_left = parent.left; |
|
|
_left = parent.left; |
|
@@ -21,67 +22,74 @@ |
|
|
} |
|
|
} |
|
|
var _width = 0; |
|
|
var _width = 0; |
|
|
var len = data.length; |
|
|
var len = data.length; |
|
|
$.each(data, function (_index, _item) {//_item:label 显示列名 /name 字段名 /width 宽度 /align 对齐方式 /frozen 冻结列 /statistics 统计 /isMerge 合并 |
|
|
|
|
|
//设置列表头数据 |
|
|
|
|
|
var col = { |
|
|
|
|
|
data: _item, |
|
|
|
|
|
height: 28, |
|
|
|
|
|
width: _item.width || 100, |
|
|
|
|
|
top: _top, |
|
|
|
|
|
left: _left, |
|
|
|
|
|
frozen: _frozen, |
|
|
|
|
|
deep: _deep, |
|
|
|
|
|
last: true, |
|
|
|
|
|
parent: parent |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (!parent && _item.frozen) { |
|
|
|
|
|
col.frozen = true; |
|
|
|
|
|
col.left = _frozenleft; |
|
|
|
|
|
} |
|
|
|
|
|
headData.push(col); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.each(data, function (_index, _item) {//_item:label 显示列名 /name 字段名 /width 宽度 /align 对齐方式 /frozen 冻结列 /statistics 统计 /isMerge 合并//ishide 是否隐藏 |
|
|
|
|
|
if (!_item.ishide) { |
|
|
|
|
|
//设置列表头数据 |
|
|
|
|
|
var col = { |
|
|
|
|
|
data: _item, |
|
|
|
|
|
height: 28, |
|
|
|
|
|
width: _item.width || 100, |
|
|
|
|
|
top: _top, |
|
|
|
|
|
left: _left, |
|
|
|
|
|
frozen: _frozen, |
|
|
|
|
|
deep: _deep, |
|
|
|
|
|
last: true, |
|
|
|
|
|
parent: parent, |
|
|
|
|
|
//hide: _item.ishide || _ishide |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (!parent && _item.frozen) { |
|
|
|
|
|
col.frozen = true; |
|
|
|
|
|
col.left = _frozenleft; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 如果有子节点 |
|
|
|
|
|
if (_item.children && _item.children.length > 0) { |
|
|
|
|
|
col.last = false; |
|
|
|
|
|
col.width = headDataInit(_item.children, col, headData, cols, frozenCols, running); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
running.MaxDeep = running.MaxDeep > col.deep ? running.MaxDeep : col.deep; |
|
|
|
|
|
|
|
|
headData.push(col); |
|
|
|
|
|
|
|
|
if (col.frozen) { |
|
|
|
|
|
frozenCols.push(col); |
|
|
|
|
|
|
|
|
// 如果有子节点 |
|
|
|
|
|
if (_item.children && _item.children.length > 0) { |
|
|
|
|
|
col.last = false; |
|
|
|
|
|
col.width = headDataInit(_item.children, col, headData, cols, frozenCols, running); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
cols.push(col); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
running.MaxDeep = running.MaxDeep > col.deep ? running.MaxDeep : col.deep; |
|
|
|
|
|
|
|
|
// 判断是否需要和并行 |
|
|
|
|
|
if (_item.isMerge) { |
|
|
|
|
|
running.mergeCols.push(col); |
|
|
|
|
|
} |
|
|
|
|
|
// 如果有统计列 |
|
|
|
|
|
if (_item.statistics) { |
|
|
|
|
|
running.isStatistic = true; |
|
|
|
|
|
|
|
|
if (col.frozen) { |
|
|
|
|
|
frozenCols.push(col); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
cols.push(col); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 判断是否需要和并行 |
|
|
|
|
|
if (_item.isMerge) { |
|
|
|
|
|
running.mergeCols.push(col); |
|
|
|
|
|
} |
|
|
|
|
|
// 如果有统计列 |
|
|
|
|
|
if (_item.statistics) { |
|
|
|
|
|
running.isStatistic = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!parent) { |
|
|
|
|
|
if (col.frozen) { |
|
|
|
|
|
_frozenleft += col.width; |
|
|
|
|
|
running.frozenleft += col.width; |
|
|
|
|
|
|
|
|
if (!parent) { |
|
|
|
|
|
if (col.frozen) { |
|
|
|
|
|
_frozenleft += col.width; |
|
|
|
|
|
running.frozenleft += col.width; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
_left += col.width; |
|
|
|
|
|
running.left += col.width; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
_left += col.width; |
|
|
_left += col.width; |
|
|
running.left += col.width; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
_width += col.width; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
_left += col.width; |
|
|
|
|
|
|
|
|
running.hideHead = running.hideHead || []; |
|
|
|
|
|
running.hideHead.push(_item); |
|
|
} |
|
|
} |
|
|
_width += col.width; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -129,9 +137,9 @@ |
|
|
}; |
|
|
}; |
|
|
// 单元格数据格式化 |
|
|
// 单元格数据格式化 |
|
|
var formatterCell = function (value, item, row, rowItem, op) { |
|
|
var formatterCell = function (value, item, row, rowItem, op) { |
|
|
if (value !== 0) { |
|
|
|
|
|
value = value || ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//if (value !== 0) { |
|
|
|
|
|
// value = value || ''; |
|
|
|
|
|
//} |
|
|
if (item.formatter) { |
|
|
if (item.formatter) { |
|
|
var text = item.formatter(value, row, op, rowItem.$cell); |
|
|
var text = item.formatter(value, row, op, rowItem.$cell); |
|
|
rowItem.text = $('<div>' + (text || '') + '</div>').text(); |
|
|
rowItem.text = $('<div>' + (text || '') + '</div>').text(); |
|
@@ -288,6 +296,7 @@ |
|
|
case 'checkbox': // 多选 |
|
|
case 'checkbox': // 多选 |
|
|
if (value != undefined && value != null && value != "") { |
|
|
if (value != undefined && value != null && value != "") { |
|
|
if (item.edit.data) { |
|
|
if (item.edit.data) { |
|
|
|
|
|
value = value + ''; |
|
|
var _vlist = value.split(','); |
|
|
var _vlist = value.split(','); |
|
|
var _vmap = {}; |
|
|
var _vmap = {}; |
|
|
$.each(_vlist, function (_index, _item) { |
|
|
$.each(_vlist, function (_index, _item) { |
|
@@ -392,36 +401,38 @@ |
|
|
rowItem.$cell.find('.fa-ellipsis-h')[0].op = item; |
|
|
rowItem.$cell.find('.fa-ellipsis-h')[0].op = item; |
|
|
rowItem.$cell.find('.fa-ellipsis-h')[0].row = row; |
|
|
rowItem.$cell.find('.fa-ellipsis-h')[0].row = row; |
|
|
|
|
|
|
|
|
rowItem.$cell.find('.fa-ellipsis-h').on('click', function () { |
|
|
|
|
|
var $this = $(this); |
|
|
|
|
|
var op = $this[0].op; |
|
|
|
|
|
var _row = $this[0].row; |
|
|
|
|
|
var rownum = $this.attr('value'); |
|
|
|
|
|
op.edit.init && op.edit.init(_row, $this.parent(), rownum); |
|
|
|
|
|
top.lrGirdLayerEdit = op; |
|
|
|
|
|
top.lrGirdLayerEditCallBack = function (data) { |
|
|
|
|
|
op.edit.change && op.edit.change(_row, rownum, data); |
|
|
|
|
|
top.lrGirdLayerEdit = null; |
|
|
|
|
|
top.lrGirdLayerEditCallBack = null; |
|
|
|
|
|
}; |
|
|
|
|
|
if (item.edit.op) { |
|
|
|
|
|
learun.layerForm({ |
|
|
|
|
|
id: 'lrgridlayerform', |
|
|
|
|
|
title: '选择' + item.label, |
|
|
|
|
|
url: top.$.rootUrl + '/Utility/JfGirdLayerForm', |
|
|
|
|
|
height: item.edit.op.height || 400, |
|
|
|
|
|
width: item.edit.op.width || 600, |
|
|
|
|
|
callBack: function (id) { |
|
|
|
|
|
var res = top[id].acceptClick(function (data) { |
|
|
|
|
|
op.edit.change && op.edit.change(_row, rownum, data); |
|
|
|
|
|
}); |
|
|
|
|
|
top.lrGirdLayerEdit = null; |
|
|
|
|
|
return res; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
if (item.isRead != '1') { |
|
|
|
|
|
rowItem.$cell.find('.fa-ellipsis-h').on('click', function () { |
|
|
|
|
|
var $this = $(this); |
|
|
|
|
|
var op = $this[0].op; |
|
|
|
|
|
var _row = $this[0].row; |
|
|
|
|
|
var rownum = $this.attr('value'); |
|
|
|
|
|
op.edit.init && op.edit.init(_row, $this.parent(), rownum); |
|
|
|
|
|
top.lrGirdLayerEdit = op; |
|
|
|
|
|
top.lrGirdLayerEditCallBack = function (data) { |
|
|
|
|
|
op.edit.change && op.edit.change(_row, rownum, data); |
|
|
|
|
|
top.lrGirdLayerEdit = null; |
|
|
|
|
|
top.lrGirdLayerEditCallBack = null; |
|
|
|
|
|
}; |
|
|
|
|
|
if (item.edit.op) { |
|
|
|
|
|
learun.layerForm({ |
|
|
|
|
|
id: 'lrgridlayerform', |
|
|
|
|
|
title: '选择' + item.label, |
|
|
|
|
|
url: top.$.rootUrl + '/Utility/JfGirdLayerForm', |
|
|
|
|
|
height: item.edit.op.height || 400, |
|
|
|
|
|
width: item.edit.op.width || 600, |
|
|
|
|
|
callBack: function (id) { |
|
|
|
|
|
var res = top[id].acceptClick(function (data) { |
|
|
|
|
|
op.edit.change && op.edit.change(_row, rownum, data); |
|
|
|
|
|
}); |
|
|
|
|
|
top.lrGirdLayerEdit = null; |
|
|
|
|
|
return res; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
return; |
|
|
return; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@@ -756,7 +767,6 @@ |
|
|
$footer = null; |
|
|
$footer = null; |
|
|
}, |
|
|
}, |
|
|
bind: function ($self, op) { |
|
|
bind: function ($self, op) { |
|
|
|
|
|
|
|
|
// 点击事件 |
|
|
// 点击事件 |
|
|
$self.on('click', function (e) { |
|
|
$self.on('click', function (e) { |
|
|
var $this = $(this); |
|
|
var $this = $(this); |
|
@@ -1095,18 +1105,16 @@ |
|
|
bindex = bindex || 0; |
|
|
bindex = bindex || 0; |
|
|
op.running.rowdata = []; |
|
|
op.running.rowdata = []; |
|
|
op.running.statisticData = {}; |
|
|
op.running.statisticData = {}; |
|
|
|
|
|
|
|
|
|
|
|
$self.hide(); |
|
|
|
|
|
|
|
|
$self.find('#jfgrid_left_' + op.id).find('.jfgrid-data-cell').remove(); |
|
|
$self.find('#jfgrid_left_' + op.id).find('.jfgrid-data-cell').remove(); |
|
|
$self.find('#jfgrid_right_' + op.id).find('.jfgrid-data-cell').remove(); |
|
|
$self.find('#jfgrid_right_' + op.id).find('.jfgrid-data-cell').remove(); |
|
|
|
|
|
$self.find('#jfgrid_left_' + op.id).find('.jfgrid-sub').remove(); |
|
|
|
|
|
|
|
|
hideEditCell(); |
|
|
hideEditCell(); |
|
|
var isAllCheck = 3; |
|
|
var isAllCheck = 3; |
|
|
if (op.isTree) { |
|
|
if (op.isTree) { |
|
|
var treeList = _jfgrid.listTotree(data, op); |
|
|
|
|
|
if (treeList.length > 0) { |
|
|
|
|
|
_treeRender(treeList, 1); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
function _treeRender(_data, deep) { |
|
|
function _treeRender(_data, deep) { |
|
|
$.each(_data, function (_index, _item) { |
|
|
$.each(_data, function (_index, _item) { |
|
|
_jfgrid.rowRender($self, op, _item, bindex, deep); |
|
|
_jfgrid.rowRender($self, op, _item, bindex, deep); |
|
@@ -1115,6 +1123,21 @@ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
var treeList = _jfgrid.listTotree(data, op); |
|
|
|
|
|
if (treeList.length > 0) { |
|
|
|
|
|
_treeRender(treeList, 1); |
|
|
|
|
|
if (op.isTreeClose) { |
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
$.each(treeList, function (_treeIndex, _treeItem) { |
|
|
|
|
|
$('.jfgrid-data-cell[rowindex="' + _treeItem._lrindex + '"] .jfgrid-data-cell-expendi').trigger('click'); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
$.each(data, function (_index, _item) { |
|
|
$.each(data, function (_index, _item) { |
|
@@ -1197,12 +1220,11 @@ |
|
|
else { |
|
|
else { |
|
|
$self.find('#jfgrid_nodata_img_' + op.id).show(); |
|
|
$self.find('#jfgrid_nodata_img_' + op.id).show(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$self.show(); |
|
|
}, |
|
|
}, |
|
|
rowRender: function ($self, op, _item, bindex, deep) { |
|
|
rowRender: function ($self, op, _item, bindex, deep) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lastCell = null; |
|
|
var lastCell = null; |
|
|
|
|
|
|
|
|
var rowdata = op.running.rowdata; |
|
|
var rowdata = op.running.rowdata; |
|
|
bindex = bindex || 0; |
|
|
bindex = bindex || 0; |
|
|
|
|
|
|
|
@@ -1216,6 +1238,7 @@ |
|
|
|
|
|
|
|
|
var $expendcell = null; |
|
|
var $expendcell = null; |
|
|
if (op.isTree) { |
|
|
if (op.isTree) { |
|
|
|
|
|
_item._lrindex = _index; |
|
|
row['jfgridRowData'] = _item.data; |
|
|
row['jfgridRowData'] = _item.data; |
|
|
row.childRows = _item.childRows; |
|
|
row.childRows = _item.childRows; |
|
|
row.jfdeep = deep; |
|
|
row.jfdeep = deep; |
|
@@ -1241,7 +1264,7 @@ |
|
|
row['jfnum'].$cell = $('<div class="jfgrid-data-cell" rowindex="' + _index + '" rownum="' + op.id + '_' + _index + '" colname="jfgrid_num" >' + (_index + bindex * (op.isPage ? op.running.pageparam.rows : 1) + 1) + '</div>'); |
|
|
row['jfnum'].$cell = $('<div class="jfgrid-data-cell" rowindex="' + _index + '" rownum="' + op.id + '_' + _index + '" colname="jfgrid_num" >' + (_index + bindex * (op.isPage ? op.running.pageparam.rows : 1) + 1) + '</div>'); |
|
|
row['jfnum'].$cell.css({ 'top': row['jfnum'].top, 'left': row['jfnum'].left, 'text-align': 'center', 'height': op.rowHeight, 'line-height': (op.rowHeight - 1) + 'px' }); |
|
|
row['jfnum'].$cell.css({ 'top': row['jfnum'].top, 'left': row['jfnum'].left, 'text-align': 'center', 'height': op.rowHeight, 'line-height': (op.rowHeight - 1) + 'px' }); |
|
|
$left.append(row['jfnum'].$cell); |
|
|
$left.append(row['jfnum'].$cell); |
|
|
_left += 30; |
|
|
|
|
|
|
|
|
_left += op.numRowWitdh;// 30 |
|
|
} |
|
|
} |
|
|
// 是否多选 |
|
|
// 是否多选 |
|
|
if (op.isMultiselect) { |
|
|
if (op.isMultiselect) { |
|
@@ -1370,6 +1393,16 @@ |
|
|
op.running.pageparam.page = op.running.pageparam.page || 1; |
|
|
op.running.pageparam.page = op.running.pageparam.page || 1; |
|
|
op.running.pageparam.records = 0; |
|
|
op.running.pageparam.records = 0; |
|
|
op.running.pageparam.total = 0; |
|
|
op.running.pageparam.total = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
op.param = op.param || {}; |
|
|
|
|
|
delete op.param['pagination']; |
|
|
|
|
|
var _paramString = JSON.stringify(op.param); |
|
|
|
|
|
if (op.running.paramString != _paramString) { |
|
|
|
|
|
op.running.paramString = _paramString; |
|
|
|
|
|
op.running.pageparam.page = 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
op.param['pagination'] = JSON.stringify(op.running.pageparam); |
|
|
op.param['pagination'] = JSON.stringify(op.running.pageparam); |
|
|
|
|
|
|
|
|
learun.httpAsync('GET', op.url, op.param, function (data) { |
|
|
learun.httpAsync('GET', op.url, op.param, function (data) { |
|
@@ -1387,6 +1420,7 @@ |
|
|
op.running.pageparam.records = 0; |
|
|
op.running.pageparam.records = 0; |
|
|
op.running.pageparam.total = 0; |
|
|
op.running.pageparam.total = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
op.onRenderBefore && op.onRenderBefore(op.rowdatas); |
|
|
_jfgrid.dataRender($self, op, op.rowdatas, (op.running.pageparam.page - 1)); |
|
|
_jfgrid.dataRender($self, op, op.rowdatas, (op.running.pageparam.page - 1)); |
|
|
op.onRenderComplete && op.onRenderComplete(op.rowdatas); |
|
|
op.onRenderComplete && op.onRenderComplete(op.rowdatas); |
|
|
}); |
|
|
}); |
|
@@ -1395,6 +1429,7 @@ |
|
|
learun.httpAsync('GET', op.url, op.param, function (data) { |
|
|
learun.httpAsync('GET', op.url, op.param, function (data) { |
|
|
learun.loading(false); |
|
|
learun.loading(false); |
|
|
op.rowdatas = data || []; |
|
|
op.rowdatas = data || []; |
|
|
|
|
|
op.onRenderBefore && op.onRenderBefore(op.rowdatas); |
|
|
_jfgrid.dataRender($self, op, op.rowdatas, 0); |
|
|
_jfgrid.dataRender($self, op, op.rowdatas, 0); |
|
|
op.onRenderComplete && op.onRenderComplete(op.rowdatas); |
|
|
op.onRenderComplete && op.onRenderComplete(op.rowdatas); |
|
|
}); |
|
|
}); |
|
@@ -1500,7 +1535,6 @@ |
|
|
var head = op.running.headData[path]; |
|
|
var head = op.running.headData[path]; |
|
|
if (head.last && !head.data.sort && op.isPage) { |
|
|
if (head.last && !head.data.sort && op.isPage) { |
|
|
var isup = true; |
|
|
var isup = true; |
|
|
|
|
|
|
|
|
if (op.running.sorthead) { |
|
|
if (op.running.sorthead) { |
|
|
op.running.sorthead.$cell.find('.jfgrid-heed-sort').hide(); |
|
|
op.running.sorthead.$cell.find('.jfgrid-heed-sort').hide(); |
|
|
if (head == op.running.sorthead) { |
|
|
if (head == op.running.sorthead) { |
|
@@ -1564,7 +1598,7 @@ |
|
|
var isEdit = false; |
|
|
var isEdit = false; |
|
|
$.each(op.running.headData, function (i, col) { |
|
|
$.each(op.running.headData, function (i, col) { |
|
|
if (col.data.name == colname) { |
|
|
if (col.data.name == colname) { |
|
|
if (col.data.edit && col.data.edit.type != 'layer') { |
|
|
|
|
|
|
|
|
if (col.data.edit && col.$edit && col.data.edit.type != 'layer' && col.data.isRead != '1' && rowData.lrnotedit != '1') { |
|
|
isEdit = true; |
|
|
isEdit = true; |
|
|
var _top = $cell.css('top'); |
|
|
var _top = $cell.css('top'); |
|
|
var _left = $cell.css('left'); |
|
|
var _left = $cell.css('left'); |
|
@@ -1579,18 +1613,32 @@ |
|
|
switch (col.data.edit.type) { |
|
|
switch (col.data.edit.type) { |
|
|
case 'input': // 输入框 文本,数字,密码 |
|
|
case 'input': // 输入框 文本,数字,密码 |
|
|
$edit.unbind('input propertychange'); |
|
|
$edit.unbind('input propertychange'); |
|
|
$edit.val(rowData[colname] || ''); |
|
|
|
|
|
|
|
|
var texttmp = rowData[colname] |
|
|
|
|
|
if (texttmp == null || texttmp == undefined) { |
|
|
|
|
|
texttmp = '' |
|
|
|
|
|
} |
|
|
|
|
|
$edit.val(texttmp); |
|
|
|
|
|
formatterCell(texttmp, col.data, rowData, rowItem[col.data.name], op); |
|
|
$edit.select(); |
|
|
$edit.select(); |
|
|
$edit.on("input propertychange", function (e) { |
|
|
$edit.on("input propertychange", function (e) { |
|
|
var value = $(this).val(); |
|
|
var value = $(this).val(); |
|
|
rowData[colname] = value; |
|
|
rowData[colname] = value; |
|
|
col.data.edit.change && col.data.edit.change(rowData, rowIndex); |
|
|
col.data.edit.change && col.data.edit.change(rowData, rowIndex); |
|
|
|
|
|
value = rowData[colname]; |
|
|
|
|
|
$(this).val(value); |
|
|
formatterCell(value, col.data, rowData, rowItem[col.data.name], op); |
|
|
formatterCell(value, col.data, rowData, rowItem[col.data.name], op); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 'select': // 下拉框选择 |
|
|
case 'select': // 下拉框选择 |
|
|
$edit.lrselectSet(rowData[colname] || ''); |
|
|
|
|
|
|
|
|
if (rowData[colname] == 0) { |
|
|
|
|
|
$edit.lrselectSet(rowData[colname]); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$edit.lrselectSet(rowData[colname] || ''); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$edit.on('change', function () { |
|
|
$edit.on('change', function () { |
|
|
var $this = $(this); |
|
|
var $this = $(this); |
|
|
var value = $this.lrselectGet(); |
|
|
var value = $this.lrselectGet(); |
|
@@ -1622,6 +1670,7 @@ |
|
|
var _oldv = rowData[colname] || ''; |
|
|
var _oldv = rowData[colname] || ''; |
|
|
var _cbmap = {}; |
|
|
var _cbmap = {}; |
|
|
var _cbValue = rowData[colname] || col.data.edit.dfvalue || ''; |
|
|
var _cbValue = rowData[colname] || col.data.edit.dfvalue || ''; |
|
|
|
|
|
_cbValue += ''; |
|
|
rowData[colname] = _cbValue; |
|
|
rowData[colname] = _cbValue; |
|
|
var _cbValueList = _cbValue.split(','); |
|
|
var _cbValueList = _cbValue.split(','); |
|
|
$.each(_cbValueList, function (_index, _item) { |
|
|
$.each(_cbValueList, function (_index, _item) { |
|
@@ -1799,8 +1848,11 @@ |
|
|
|
|
|
|
|
|
var $left = $self.find('#jfgrid_left_' + op.id); |
|
|
var $left = $self.find('#jfgrid_left_' + op.id); |
|
|
var $right = $self.find('#jfgrid_right_' + op.id); |
|
|
var $right = $self.find('#jfgrid_right_' + op.id); |
|
|
|
|
|
$left.hide(); |
|
|
|
|
|
$right.hide(); |
|
|
|
|
|
|
|
|
var subid = op.id + '_sub_' + rowIndex; |
|
|
var subid = op.id + '_sub_' + rowIndex; |
|
|
var height = $left.height(); |
|
|
|
|
|
|
|
|
var height = $('#' + op.id + '_sub_' + (op.running.rowdata.length - 1)).height() + op.running.rowdata[op.running.rowdata.length - 1]['jfsubGrid'].top + op.rowHeight; |
|
|
|
|
|
|
|
|
if (rowItem['jfsubGrid'].value) { |
|
|
if (rowItem['jfsubGrid'].value) { |
|
|
rowItem['jfsubGrid'].value = false; |
|
|
rowItem['jfsubGrid'].value = false; |
|
@@ -1818,6 +1870,10 @@ |
|
|
_item.$cell.css({ 'top': _item.top }); |
|
|
_item.$cell.css({ 'top': _item.top }); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
var _$subid = $('#' + op.id + '_sub_' + i); |
|
|
|
|
|
if (_$subid.length > 0) { |
|
|
|
|
|
_$subid.css({ top: item['jfsubGrid'].top + op.rowHeight }); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
$left.css({ 'height': height - op.subGridHeight }); |
|
|
$left.css({ 'height': height - op.subGridHeight }); |
|
|
$right.css({ 'height': height - op.subGridHeight }); |
|
|
$right.css({ 'height': height - op.subGridHeight }); |
|
@@ -1837,6 +1893,11 @@ |
|
|
_item.$cell.css({ 'top': _item.top }); |
|
|
_item.$cell.css({ 'top': _item.top }); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// |
|
|
|
|
|
var _$subid = $('#' + op.id + '_sub_' + i); |
|
|
|
|
|
if (_$subid.length > 0) { |
|
|
|
|
|
_$subid.css({ top: item['jfsubGrid'].top + op.rowHeight }); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
$left.append($sub); |
|
|
$left.append($sub); |
|
|
|
|
|
|
|
@@ -1845,6 +1906,10 @@ |
|
|
|
|
|
|
|
|
op.subGridExpanded && op.subGridExpanded(subContentId, rowItem['jfgridRowData']); |
|
|
op.subGridExpanded && op.subGridExpanded(subContentId, rowItem['jfgridRowData']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$left.show(); |
|
|
|
|
|
$right.show(); |
|
|
}, |
|
|
}, |
|
|
// 获取选中行 |
|
|
// 获取选中行 |
|
|
getCheckRow: function ($self, op) { |
|
|
getCheckRow: function ($self, op) { |
|
@@ -2066,6 +2131,7 @@ |
|
|
onSelectRow: false, // 选中一行后回调函数 |
|
|
onSelectRow: false, // 选中一行后回调函数 |
|
|
dblclick: false, |
|
|
dblclick: false, |
|
|
onRenderComplete: false, // 表格加载完后调用 |
|
|
onRenderComplete: false, // 表格加载完后调用 |
|
|
|
|
|
onRenderBefore: false, // 渲染表单前执行 |
|
|
|
|
|
|
|
|
onAddRow: false, // 添加一行数据后执行 |
|
|
onAddRow: false, // 添加一行数据后执行 |
|
|
onMinusRow: false, // 删除一行数据后执行 |
|
|
onMinusRow: false, // 删除一行数据后执行 |
|
@@ -2076,6 +2142,7 @@ |
|
|
sidx: '', |
|
|
sidx: '', |
|
|
sord: 'ASC', |
|
|
sord: 'ASC', |
|
|
|
|
|
|
|
|
|
|
|
isTreeClose: false, // 默认打开 |
|
|
isTree: false, // 是否树形显示(没有分页的情况下才支持) (只有在数据不多情况下才建议使用) |
|
|
isTree: false, // 是否树形显示(没有分页的情况下才支持) (只有在数据不多情况下才建议使用) |
|
|
mainId: 'id', // 关联的主键 |
|
|
mainId: 'id', // 关联的主键 |
|
|
parentId: 'parentId', // 树形关联字段 |
|
|
parentId: 'parentId', // 树形关联字段 |
|
@@ -2085,7 +2152,8 @@ |
|
|
|
|
|
|
|
|
isAutoHeight: false, // 自动适应表格高度 |
|
|
isAutoHeight: false, // 自动适应表格高度 |
|
|
height: 0, |
|
|
height: 0, |
|
|
rowHeight: 28 // 行高 |
|
|
|
|
|
|
|
|
rowHeight: 28, // 行高 |
|
|
|
|
|
numRowWitdh: 30 // 序号列宽度 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
@@ -2113,15 +2181,23 @@ |
|
|
|
|
|
|
|
|
$.fn.jfGridSet = function (name, data) { |
|
|
$.fn.jfGridSet = function (name, data) { |
|
|
var $self = $(this); |
|
|
var $self = $(this); |
|
|
|
|
|
if (!$self[0]) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
var dfop = $self[0].dfop; |
|
|
var dfop = $self[0].dfop; |
|
|
if (!dfop) { |
|
|
if (!dfop) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
switch (name) { |
|
|
switch (name) { |
|
|
case 'reload': // 重新加载一边数据 |
|
|
case 'reload': // 重新加载一边数据 |
|
|
data = data || dfop.param || {}; |
|
|
|
|
|
dfop.param = data.param || data; |
|
|
|
|
|
_jfgrid.reload($self, dfop); |
|
|
|
|
|
|
|
|
if (data == undefined || data == null) { |
|
|
|
|
|
_jfgrid.reload($self, dfop); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
data = data || dfop.param || {}; |
|
|
|
|
|
dfop.param = data.param || data; |
|
|
|
|
|
_jfgrid.reload($self, dfop); |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
case 'reloadall'://重新加载所有数据 |
|
|
case 'reloadall'://重新加载所有数据 |
|
|
dfop.rows = 1000000; |
|
|
dfop.rows = 1000000; |
|
@@ -2135,6 +2211,7 @@ |
|
|
if (data) { |
|
|
if (data) { |
|
|
dfop.rowdatas = data.rowdatas || data; |
|
|
dfop.rowdatas = data.rowdatas || data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_jfgrid.dataRender($self, dfop, dfop.rowdatas); |
|
|
_jfgrid.dataRender($self, dfop, dfop.rowdatas); |
|
|
//liang解决刷新后选择的行不能清除的问题 |
|
|
//liang解决刷新后选择的行不能清除的问题 |
|
|
dfop.running.rowSelected = undefined; |
|
|
dfop.running.rowSelected = undefined; |
|
@@ -2179,13 +2256,26 @@ |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case 'updateRow': |
|
|
|
|
|
if (dfop.running.rowSelected) { |
|
|
|
|
|
_jfgrid.updateRow(dfop.running.rowSelected, dfop); |
|
|
|
|
|
|
|
|
case 'setcheck': |
|
|
|
|
|
if (dfop.isMultiselect) { |
|
|
|
|
|
$.each(dfop.running.rowdata, function (_index, _item) { |
|
|
|
|
|
if (_item['jfgridRowData'][dfop.mainId] == data) { |
|
|
|
|
|
if (_item['jfcheck'].value == 0) { |
|
|
|
|
|
_item['jfcheck'].$cell.trigger('click'); |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
else if (dfop.running.rowdata[data]) { |
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
case 'updateRow': |
|
|
|
|
|
if (dfop.running.rowdata[data]) { |
|
|
_jfgrid.updateRow(dfop.running.rowdata[data], dfop); |
|
|
_jfgrid.updateRow(dfop.running.rowdata[data], dfop); |
|
|
} |
|
|
} |
|
|
|
|
|
else if (dfop.running.rowSelected) { |
|
|
|
|
|
_jfgrid.updateRow(dfop.running.rowSelected, dfop); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
case 'moveUp': |
|
|
case 'moveUp': |
|
|
return _jfgrid.moveUp($self, dfop, data); |
|
|
return _jfgrid.moveUp($self, dfop, data); |
|
@@ -2211,7 +2301,13 @@ |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
if (op.running.rowSelected) { |
|
|
if (op.running.rowSelected) { |
|
|
return op.running.rowSelected['jfgridRowData']; |
|
|
|
|
|
|
|
|
if (op.running.rowdata[op.running.rowSelected.jfnum.value - 1] && op.running.rowSelected.jfgridRowData == op.running.rowdata[op.running.rowSelected.jfnum.value - 1].jfgridRowData) { |
|
|
|
|
|
return op.running.rowSelected['jfgridRowData']; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
op.running.rowSelected = null; |
|
|
|
|
|
return {}; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
return {}; |
|
|
return {}; |
|
@@ -2237,8 +2333,15 @@ |
|
|
point[_jindex] = _jitem.text; |
|
|
point[_jindex] = _jitem.text; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (op.running.hideHead) { |
|
|
|
|
|
$.each(op.running.hideHead, function (_hindex, _hitem) { |
|
|
|
|
|
point[_hitem.name] = _item.jfgridRowData[_hitem.name]; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
res.push(point); |
|
|
res.push(point); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return res; |
|
|
return res; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@@ -2262,7 +2365,14 @@ |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
if (op.running.rowSelected) { |
|
|
if (op.running.rowSelected) { |
|
|
return op.running.rowSelected['jfgridRowData'][name]; |
|
|
|
|
|
|
|
|
if (op.running.rowdata[op.running.rowSelected.jfnum.value - 1] && op.running.rowSelected.jfgridRowData == op.running.rowdata[op.running.rowSelected.jfnum.value - 1].jfgridRowData) { |
|
|
|
|
|
return op.running.rowSelected['jfgridRowData'][name]; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
op.running.rowSelected = null; |
|
|
|
|
|
return ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
return ''; |
|
|
return ''; |
|
|