From 73e1897349be2fa09ce0f163cf4a1123baf0cef2 Mon Sep 17 00:00:00 2001 From: zhichao lei <442149704@qq.com> Date: Wed, 28 Oct 2020 14:56:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=B5=B7=E5=A7=8B=E8=A1=A8=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Form1.Designer.cs | 22 +++++++++++++++++++ .../Quanjiang.DigitalScholl.DataSync/Form1.cs | 2 ++ .../Program.cs | 1 + .../SyncWindow.cs | 10 +++++++++ 4 files changed, 35 insertions(+) diff --git a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.Designer.cs b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.Designer.cs index 1ec1a3b52..485ac4b5b 100644 --- a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.Designer.cs +++ b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.Designer.cs @@ -45,6 +45,8 @@ this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.系统工具ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.查找密码为123456的ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.txtBeginTable = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -204,11 +206,29 @@ this.查找密码为123456的ToolStripMenuItem.Text = "查找密码为123456的"; this.查找密码为123456的ToolStripMenuItem.Click += new System.EventHandler(this.查找密码为123456的ToolStripMenuItem_Click); // + // txtBeginTable + // + this.txtBeginTable.Location = new System.Drawing.Point(305, 189); + this.txtBeginTable.Name = "txtBeginTable"; + this.txtBeginTable.Size = new System.Drawing.Size(128, 21); + this.txtBeginTable.TabIndex = 13; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(222, 192); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(77, 12); + this.label5.TabIndex = 14; + this.label5.Text = "由此开始同步"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 561); + this.Controls.Add(this.label5); + this.Controls.Add(this.txtBeginTable); this.Controls.Add(this.btsyncmis); this.Controls.Add(this.btsynccore); this.Controls.Add(this.clbmodule); @@ -254,6 +274,8 @@ private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem 系统工具ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 查找密码为123456的ToolStripMenuItem; + private System.Windows.Forms.TextBox txtBeginTable; + private System.Windows.Forms.Label label5; } } diff --git a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.cs b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.cs index 44a36baf1..dd2bf2a83 100644 --- a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.cs +++ b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Form1.cs @@ -116,6 +116,7 @@ namespace Quanjiang.DigitalScholl.DataSync Thread mainthread = null; private void btsynccore_Click(object sender, EventArgs e) { + Program.beginTable = txtBeginTable.Text; ThreadStart threadstart = new ThreadStart(TransferCoreData); mainthread = new Thread(threadstart); mainthread.Name = "main"; @@ -124,6 +125,7 @@ namespace Quanjiang.DigitalScholl.DataSync private void btsyncmis_Click(object sender, EventArgs e) { + Program.beginTable = txtBeginTable.Text; ThreadStart threadstart = new ThreadStart(TransferMisData); mainthread = new Thread(threadstart); mainthread.Name = "main"; diff --git a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Program.cs b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Program.cs index 9c844fca8..5169a3a60 100644 --- a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Program.cs +++ b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/Program.cs @@ -7,6 +7,7 @@ namespace Quanjiang.DigitalScholl.DataSync { static class Program { + public static string beginTable = ""; /// /// 应用程序的主入口点。 /// diff --git a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/SyncWindow.cs b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/SyncWindow.cs index 280da1759..e29275fc8 100644 --- a/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/SyncWindow.cs +++ b/Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.DataSync/SyncWindow.cs @@ -88,6 +88,11 @@ namespace Quanjiang.DigitalScholl.DataSync { AppendTextValue("正在检测" + sourcetable.Name + "表结构...\r\n"); SetValueProgressBar(SetValue, GetProgressValue()+1); + if (Program.beginTable != "") + { + if(sourcetable.Name!=Program.beginTable) + continue; + } if (targettables.Contains(sourcetable.Name)) { ColumnCollection sourcecolumns = sourcetable.Columns; @@ -194,6 +199,11 @@ namespace Quanjiang.DigitalScholl.DataSync { AppendTextValue("正在检测" + sourcetable.Name + "表结构...\r\n"); SetValueProgressBar(SetValue, GetProgressValue() + 1); + if (Program.beginTable != "") + { + if (sourcetable.Name != Program.beginTable) + continue; + } if (targettables.Contains(sourcetable.Name)) { ColumnCollection sourcecolumns = sourcetable.Columns; From 9eb99dc1fd662204f161473bab038ae124ba0c9b Mon Sep 17 00:00:00 2001 From: dyy <18335927079@163.com> Date: Wed, 28 Oct 2020 17:53:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=85=8D=E7=BD=AE=E4=B8=AD=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=AD=97=E6=AE=B5=E5=94=AF=E4=B8=80=E6=80=A7?= =?UTF-8?q?=E3=80=81excel=E5=88=97=E5=90=8D=E7=A7=B0=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LR_SystemModule/Views/ExcelImport/Form.js | 20 +- .../Views/ExcelImport/Index.js | 3 +- .../Views/LR_Content/plugin/grid/jfgrid.js | 322 ++++++++++++------ .../Import/ExcelImportBLL.cs | 18 +- .../Import/ExcelImportFieldEntity.cs | 2 +- 5 files changed, 239 insertions(+), 126 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Form.js index b9fc82094..b16cd407f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Form.js @@ -74,15 +74,21 @@ var bootstrap = function ($, learun) { $('#F_ErrorType').lrselect({ placeholder: false }).lrselectSet('1'); $('#gridtable').jfGrid({ headData: [ - { label: "字段", name: "F_Name", width: 170, align: "left", editType: 'label' }, - { label: "Excel列名", name: "F_ColName", width: 170, align: "left", editType: 'input' }, - { label: "唯一性", name: "F_OnlyOne", width: 60, align: "center", editType: 'checkbox' }, + { label: "字段", name: "F_Name", width: 170, align: "left" }, + { label: "Excel列名", name: "F_ColName", width: 170, align: "left", edit: { type: 'input' } }, { - label: "是否必填", name: "F_IsMandatory", width: 60, align: "center", editType: 'select', formatter: function (cellvalue) { - return cellvalue == true||cellvalue=='true' ? "" : ""; + label: "唯一性", name: "F_OnlyOne", width: 60, align: "center", edit: { + type: 'checkbox', data: [ + { 'id': '1', 'text': '唯一' } + ], } }, - { label: "描述", name: "F_Description", width: 180, align: "left", editType: 'label' }, + { + label: "是否必填", name: "F_IsMandatory", width: 60, align: "center", formatter: function (cellvalue) { + return cellvalue == true || cellvalue == 'true' ? "" : ""; + } + }, + { label: "描述", name: "F_Description", width: 180, align: "left" }, { label: "", name: "F_Op", width: 50, align: "center", formatter: function (cellvalue, row, dfop, $dcell) { @@ -208,8 +214,6 @@ var bootstrap = function ($, learun) { formData.F_DbTable = dbTable; formData.F_BtnName = btnName; - console.log(cols); - var postData = { keyValue: keyValue, strEntity: JSON.stringify(formData), diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Index.js index 50fdc86fd..9fe75669f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelImport/Index.js @@ -59,11 +59,12 @@ var bootstrap = function ($, learun) { // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_Id'); + var moduleId = $('#gridtable').jfGridValue('F_ModuleId'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'Form', title: '编辑快速导入', - url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/Form?keyValue=' + keyValue, + url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/Form?keyValue=' + keyValue + '&moduleId=' + moduleId, width: 1200, height: 700, maxmin: true, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/grid/jfgrid.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/grid/jfgrid.js index a9736ccd8..e78391a95 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/grid/jfgrid.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/grid/jfgrid.js @@ -12,6 +12,7 @@ var _top = 0; var _deep = 0; var _frozen = false; + //var _ishide = false; if (parent) { _left = parent.left; @@ -21,67 +22,74 @@ } var _width = 0; 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 { - 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 { _left += col.width; - running.left += col.width; } + _width += col.width; } 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) { - if (value !== 0) { - value = value || ''; - } + //if (value !== 0) { + // value = value || ''; + //} if (item.formatter) { var text = item.formatter(value, row, op, rowItem.$cell); rowItem.text = $('
' + (text || '') + '
').text(); @@ -288,6 +296,7 @@ case 'checkbox': // 多选 if (value != undefined && value != null && value != "") { if (item.edit.data) { + value = value + ''; var _vlist = value.split(','); var _vmap = {}; $.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].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; break; } @@ -756,7 +767,6 @@ $footer = null; }, bind: function ($self, op) { - // 点击事件 $self.on('click', function (e) { var $this = $(this); @@ -1095,18 +1105,16 @@ bindex = bindex || 0; op.running.rowdata = []; op.running.statisticData = {}; + + $self.hide(); + $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_left_' + op.id).find('.jfgrid-sub').remove(); + hideEditCell(); var isAllCheck = 3; if (op.isTree) { - var treeList = _jfgrid.listTotree(data, op); - if (treeList.length > 0) { - _treeRender(treeList, 1); - } - else { - - } function _treeRender(_data, deep) { $.each(_data, function (_index, _item) { _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 { $.each(data, function (_index, _item) { @@ -1197,12 +1220,11 @@ else { $self.find('#jfgrid_nodata_img_' + op.id).show(); } + + $self.show(); }, rowRender: function ($self, op, _item, bindex, deep) { - - var lastCell = null; - var rowdata = op.running.rowdata; bindex = bindex || 0; @@ -1216,6 +1238,7 @@ var $expendcell = null; if (op.isTree) { + _item._lrindex = _index; row['jfgridRowData'] = _item.data; row.childRows = _item.childRows; row.jfdeep = deep; @@ -1241,7 +1264,7 @@ row['jfnum'].$cell = $('
' + (_index + bindex * (op.isPage ? op.running.pageparam.rows : 1) + 1) + '
'); 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 += 30; + _left += op.numRowWitdh;// 30 } // 是否多选 if (op.isMultiselect) { @@ -1370,6 +1393,16 @@ op.running.pageparam.page = op.running.pageparam.page || 1; op.running.pageparam.records = 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); learun.httpAsync('GET', op.url, op.param, function (data) { @@ -1387,6 +1420,7 @@ op.running.pageparam.records = 0; op.running.pageparam.total = 0; } + op.onRenderBefore && op.onRenderBefore(op.rowdatas); _jfgrid.dataRender($self, op, op.rowdatas, (op.running.pageparam.page - 1)); op.onRenderComplete && op.onRenderComplete(op.rowdatas); }); @@ -1395,6 +1429,7 @@ learun.httpAsync('GET', op.url, op.param, function (data) { learun.loading(false); op.rowdatas = data || []; + op.onRenderBefore && op.onRenderBefore(op.rowdatas); _jfgrid.dataRender($self, op, op.rowdatas, 0); op.onRenderComplete && op.onRenderComplete(op.rowdatas); }); @@ -1500,7 +1535,6 @@ var head = op.running.headData[path]; if (head.last && !head.data.sort && op.isPage) { var isup = true; - if (op.running.sorthead) { op.running.sorthead.$cell.find('.jfgrid-heed-sort').hide(); if (head == op.running.sorthead) { @@ -1564,7 +1598,7 @@ var isEdit = false; $.each(op.running.headData, function (i, col) { 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; var _top = $cell.css('top'); var _left = $cell.css('left'); @@ -1579,18 +1613,32 @@ switch (col.data.edit.type) { case 'input': // 输入框 文本,数字,密码 $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.on("input propertychange", function (e) { var value = $(this).val(); rowData[colname] = value; 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); }); break; + case 'select': // 下拉框选择 - $edit.lrselectSet(rowData[colname] || ''); + if (rowData[colname] == 0) { + $edit.lrselectSet(rowData[colname]); + } + else { + $edit.lrselectSet(rowData[colname] || ''); + } + $edit.on('change', function () { var $this = $(this); var value = $this.lrselectGet(); @@ -1622,6 +1670,7 @@ var _oldv = rowData[colname] || ''; var _cbmap = {}; var _cbValue = rowData[colname] || col.data.edit.dfvalue || ''; + _cbValue += ''; rowData[colname] = _cbValue; var _cbValueList = _cbValue.split(','); $.each(_cbValueList, function (_index, _item) { @@ -1799,8 +1848,11 @@ var $left = $self.find('#jfgrid_left_' + op.id); var $right = $self.find('#jfgrid_right_' + op.id); + $left.hide(); + $right.hide(); + 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) { rowItem['jfsubGrid'].value = false; @@ -1818,6 +1870,10 @@ _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 }); $right.css({ 'height': height - op.subGridHeight }); @@ -1837,6 +1893,11 @@ _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); @@ -1845,6 +1906,10 @@ op.subGridExpanded && op.subGridExpanded(subContentId, rowItem['jfgridRowData']); } + + + $left.show(); + $right.show(); }, // 获取选中行 getCheckRow: function ($self, op) { @@ -2066,6 +2131,7 @@ onSelectRow: false, // 选中一行后回调函数 dblclick: false, onRenderComplete: false, // 表格加载完后调用 + onRenderBefore: false, // 渲染表单前执行 onAddRow: false, // 添加一行数据后执行 onMinusRow: false, // 删除一行数据后执行 @@ -2076,6 +2142,7 @@ sidx: '', sord: 'ASC', + isTreeClose: false, // 默认打开 isTree: false, // 是否树形显示(没有分页的情况下才支持) (只有在数据不多情况下才建议使用) mainId: 'id', // 关联的主键 parentId: 'parentId', // 树形关联字段 @@ -2085,7 +2152,8 @@ isAutoHeight: false, // 自动适应表格高度 height: 0, - rowHeight: 28 // 行高 + rowHeight: 28, // 行高 + numRowWitdh: 30 // 序号列宽度 }; @@ -2113,15 +2181,23 @@ $.fn.jfGridSet = function (name, data) { var $self = $(this); + if (!$self[0]) { + return null; + } var dfop = $self[0].dfop; if (!dfop) { return null; } switch (name) { 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; case 'reloadall'://重新加载所有数据 dfop.rows = 1000000; @@ -2135,6 +2211,7 @@ if (data) { dfop.rowdatas = data.rowdatas || data; } + _jfgrid.dataRender($self, dfop, dfop.rowdatas); //liang解决刷新后选择的行不能清除的问题 dfop.running.rowSelected = undefined; @@ -2179,13 +2256,26 @@ }); } 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); } + else if (dfop.running.rowSelected) { + _jfgrid.updateRow(dfop.running.rowSelected, dfop); + } + break; case 'moveUp': return _jfgrid.moveUp($self, dfop, data); @@ -2211,7 +2301,13 @@ } else { 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 { return {}; @@ -2237,8 +2333,15 @@ 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); }); + return res; break; } @@ -2262,7 +2365,14 @@ } else { 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 { return ''; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs index 1be541e3f..8e276ce9f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs @@ -298,16 +298,6 @@ namespace Learun.Application.Excel string paramName = "@" + col.F_Name; DbType dbType = FieldTypeHepler.ToDbType(fieldMap[col.F_Name]); - //判断当前列是否必填 - if (col.F_IsMandatory.HasValue && col.F_IsMandatory.Value) - { - if (string.IsNullOrEmpty(dr[col.F_ColName].ToString())) - { - throw (new Exception("【" + col.F_ColName + "】 此项数据为必填项")); - } - } - - if (col.F_Name == "IDCard") { @@ -322,6 +312,14 @@ namespace Learun.Application.Excel switch (col.F_RelationType) { case 0://无关联 + //判断当前列是否必填 + if (col.F_IsMandatory.HasValue && col.F_IsMandatory.Value) + { + if (string.IsNullOrEmpty(dr[col.F_ColName].ToString())) + { + throw (new Exception("【" + col.F_ColName + "】 此项数据为必填项")); + } + } if (dbType == System.Data.DbType.DateTime || dbType == System.Data.DbType.Decimal) { if (string.IsNullOrEmpty(dr[col.F_ColName].ToString())) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportFieldEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportFieldEntity.cs index 6124d101f..d04bb6c93 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportFieldEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportFieldEntity.cs @@ -38,7 +38,7 @@ namespace Learun.Application.Excel [Column("F_COLNAME")] public string F_ColName { get; set; } /// - /// 唯一性验证:0要,1需要 + /// 唯一性验证:0不要,1需要 /// /// [Column("F_ONLYONE")]