SVN r1104
SVN-Revision: r1104
This commit is contained in:
@@ -146,6 +146,10 @@ namespace Lskj.Control
|
||||
/// 分段审批
|
||||
/// </summary>
|
||||
public DataRow SectionAccradit;
|
||||
/// <summary>
|
||||
/// 辅助功能按钮菜单集合
|
||||
/// </summary>
|
||||
public List<SimpleButton> itemCommonList = new List<SimpleButton>();
|
||||
#region 私有变量
|
||||
/// <summary>
|
||||
/// 数量名称
|
||||
@@ -728,6 +732,11 @@ namespace Lskj.Control
|
||||
{
|
||||
this.pMenu.ClearLinks();
|
||||
this.pMprint.ClearLinks();
|
||||
foreach (SimpleButton item in itemCommonList)
|
||||
{
|
||||
if (this.pcTool.Contains(item)) this.pcTool.Controls.Remove(item);
|
||||
}
|
||||
this.itemCommonList.Clear();
|
||||
this.SysModel = SysModel;
|
||||
this._isInitFinish = false;
|
||||
this.splitMain.Visible = false;
|
||||
@@ -1020,7 +1029,10 @@ namespace Lskj.Control
|
||||
dpb_Tools.Enabled = false;
|
||||
return;
|
||||
}
|
||||
int i = 0, x = 4;
|
||||
foreach (DataRow item in tableCommon.Rows)
|
||||
{
|
||||
if (i > 1)
|
||||
{
|
||||
BarButtonItem itemCommon = new BarButtonItem();
|
||||
itemCommon.Caption = item["menuname"] + "";
|
||||
@@ -1028,6 +1040,21 @@ namespace Lskj.Control
|
||||
itemCommon.ItemClick += new ItemClickEventHandler(itemCommon_ItemClick);
|
||||
this.pMenu.AddItem(itemCommon);
|
||||
}
|
||||
else
|
||||
{
|
||||
SimpleButton itemCommon = new SimpleButton();
|
||||
//itemCommon.AutoSize = true;
|
||||
itemCommon.Text = item["menuname"] + "";
|
||||
itemCommon.Tag = item;
|
||||
itemCommon.Size = new System.Drawing.Size(90, 26);
|
||||
itemCommon.Click += new EventHandler(itemCommon_Click);
|
||||
itemCommon.Location = new Point(x + 6, 6);
|
||||
x += itemCommon.Width + 6;
|
||||
pcTool.Controls.Add(itemCommon);
|
||||
itemCommonList.Add(itemCommon);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 常用工具
|
||||
@@ -1048,6 +1075,30 @@ namespace Lskj.Control
|
||||
CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj);
|
||||
menu.Apply(rowItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 常用工具点击
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void itemCommon_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
SimpleButton btn = sender as SimpleButton;
|
||||
DataRow rowItem = btn.Tag as DataRow;
|
||||
CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj);
|
||||
menu.Apply(rowItem);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
#region 设置窗体大小
|
||||
/// <summary>
|
||||
@@ -2020,24 +2071,46 @@ namespace Lskj.Control
|
||||
/// <returns>System.String.</returns>
|
||||
private string GetDetailRecord(string guid)
|
||||
{
|
||||
|
||||
// 构造明细
|
||||
StringBuilder detailBuilder = new StringBuilder();
|
||||
DataTable DetailedProperties = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", BillModelObj.DetailTable + "_temp"));//单据明细性表
|
||||
DataTable detailTable = this.gcDetail.GridControl.DataSourceTable().TrimDeleteRows();
|
||||
//if (this.BillModelObj.DetailTreeTable)
|
||||
//{
|
||||
// detailTable = ((this.gcDetail as TreeGridControlEx).TreeListObj.DataSource as DataTable).TrimDeleteRows();
|
||||
//}
|
||||
if (detailTable.Rows.Count > 0)
|
||||
{
|
||||
DataTable BillColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", BillModelObj.DetailTable));
|
||||
IEnumerable<DataColumn> detailColumns = BillColumns.Columns.Cast<DataColumn>();
|
||||
DataTable BillTempColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", BillModelObj.DetailTable + "_temp"));
|
||||
foreach (DataRow dataRow in detailTable.Rows)
|
||||
{
|
||||
StringBuilder fields = new StringBuilder();
|
||||
StringBuilder values = new StringBuilder();
|
||||
string detailSql = @"insert into " + BillModelObj.DetailTable + "_temp" + "({0}) values({1})";
|
||||
|
||||
fields.Append("sysstr,");
|
||||
values.Append("'" + guid + "',");
|
||||
foreach (DataColumn item in detailTable.Columns)
|
||||
{
|
||||
if (item.ColumnName.Equals(guidField) || item.ColumnName.Equals(mRecordPrimaryField) || item.ColumnName.Equals(ERPInfo.Instance.isAddRows)) continue;
|
||||
var selectColumn = detailColumns.Where(n => n.ColumnName.Equals(item.ColumnName, StringComparison.OrdinalIgnoreCase));
|
||||
if (selectColumn.Count() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
fields.Append(item.ColumnName + ",");
|
||||
string fieldValue = (dataRow[item] + "").Replace("'", "''");
|
||||
|
||||
if (!BillTempColumns.Columns.Contains(item.ColumnName))
|
||||
{
|
||||
string type = "varchar(50)";
|
||||
if (item.DataType == typeof(DateTime))
|
||||
{
|
||||
type = "datetime";
|
||||
}
|
||||
BaseImpl.ExecSqlValue(string.Format("alter table {0} add {1} {2}", BillModelObj.DetailTable + "_temp", item.ColumnName, type));
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(fieldValue))
|
||||
{
|
||||
values.Append(item.DataType == typeof(DateTime) ? "N'" + Convert.ToDateTime(fieldValue).ToString("yyyy-MM-dd HH:mm:ss") + "'," : "N'" + fieldValue + "',");
|
||||
@@ -2056,11 +2129,54 @@ namespace Lskj.Control
|
||||
values.Append("'',");
|
||||
}
|
||||
}
|
||||
|
||||
detailBuilder.AppendFormat(detailSql, fields.ToString().Trim(','), values.ToString().Trim(','));
|
||||
}
|
||||
}
|
||||
|
||||
return detailBuilder.ToString();
|
||||
|
||||
|
||||
// 构造明细
|
||||
//StringBuilder detailBuilder = new StringBuilder();
|
||||
//DataTable detailTable = this.gcDetail.GridControl.DataSourceTable().TrimDeleteRows();
|
||||
//if (detailTable.Rows.Count > 0)
|
||||
//{
|
||||
// foreach (DataRow dataRow in detailTable.Rows)
|
||||
// {
|
||||
// StringBuilder fields = new StringBuilder();
|
||||
// StringBuilder values = new StringBuilder();
|
||||
// string detailSql = @"insert into " + BillModelObj.DetailTable + "_temp" + "({0}) values({1})";
|
||||
// fields.Append("sysstr,");
|
||||
// values.Append("'" + guid + "',");
|
||||
// foreach (DataColumn item in detailTable.Columns)
|
||||
// {
|
||||
// if (item.ColumnName.Equals(guidField) || item.ColumnName.Equals(mRecordPrimaryField) || item.ColumnName.Equals(ERPInfo.Instance.isAddRows)) continue;
|
||||
// fields.Append(item.ColumnName + ",");
|
||||
// string fieldValue = (dataRow[item] + "").Replace("'", "''");
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(fieldValue))
|
||||
// {
|
||||
// values.Append(item.DataType == typeof(DateTime) ? "N'" + Convert.ToDateTime(fieldValue).ToString("yyyy-MM-dd HH:mm:ss") + "'," : "N'" + fieldValue + "',");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (item.DataType == typeof(Decimal) ||
|
||||
// item.DataType == typeof(Double) ||
|
||||
// item.DataType == typeof(Int16) ||
|
||||
// item.DataType == typeof(Int32) ||
|
||||
// item.DataType == typeof(Int64))
|
||||
// values.Append("0,");
|
||||
// else if (item.DataType == typeof(DateTime))
|
||||
// values.Append("NULL,");
|
||||
// else
|
||||
// values.Append("'',");
|
||||
// }
|
||||
// }
|
||||
|
||||
// detailBuilder.AppendFormat(detailSql, fields.ToString().Trim(','), values.ToString().Trim(','));
|
||||
// }
|
||||
//}
|
||||
//return detailBuilder.ToString();
|
||||
}
|
||||
#endregion
|
||||
#region 审核保存时候
|
||||
@@ -2198,6 +2314,22 @@ namespace Lskj.Control
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取当前页签的GridControlEx和选中行行号
|
||||
int oldRowHandle = 0;
|
||||
GridControlEx SelectGridControlEx = null;
|
||||
foreach (TabPageObj tab in this._tabPageObjs)
|
||||
{
|
||||
if (tab.TabPage == this.tabMain.SelectedTabPage)
|
||||
{
|
||||
foreach (TabPageItemObj item in tab.TabPageItemObjs)
|
||||
{
|
||||
SelectGridControlEx = item.GridControlObj;
|
||||
oldRowHandle = item.GridControlObj.GridView.FocusedRowHandle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<DataRow> rowItems = new List<DataRow>();
|
||||
if (BaseAccraditModelObj.MuitlAuditBackFlag)
|
||||
{
|
||||
@@ -2237,11 +2369,12 @@ namespace Lskj.Control
|
||||
foreach (DataRow item in rowItems)
|
||||
{
|
||||
if (firstLoad) ret = ExecuteBackSelect(item);
|
||||
if (ret == -9) return;
|
||||
string nextSelectStepCode = string.Empty;
|
||||
string nextSelectStepOper = string.Empty;
|
||||
WaitForm.ShowForm("正在返退[" + item[this.BaseAccraditModelObj.TmpParmaryField] + "]单据!");
|
||||
//string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret);
|
||||
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret);
|
||||
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, item[this.BaseAccraditModelObj.TmpStepField] + "", item[this.BaseAccraditModelObj.TmpParmaryField] + "", "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret);
|
||||
|
||||
if ("1".Equals(result))
|
||||
{
|
||||
@@ -2255,6 +2388,7 @@ namespace Lskj.Control
|
||||
firstLoad = false;
|
||||
}
|
||||
MessageUtil.Show("返退成功:" + success + "\r\n" + "返退失败:" + fault + (string.IsNullOrEmpty(tipMsg) ? "" : "\r\n失败原因如下:" + tipMsg));
|
||||
RefreshTabPage();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2282,6 +2416,7 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -404,6 +404,8 @@ namespace Lskj.Control
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void CalcPopupLocation()
|
||||
{
|
||||
try
|
||||
{
|
||||
this._popup.Parent = this.GetParent(this.Parent);
|
||||
|
||||
@@ -461,6 +463,13 @@ namespace Lskj.Control
|
||||
}
|
||||
this._popup.BringToFront();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -1150,6 +1159,9 @@ namespace Lskj.Control
|
||||
{
|
||||
this.Invoke((EventHandler)delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.Popup == null) return;
|
||||
int calcLen = this.Popup.GridViewObj.DataRowCount > 20 ? 20 : this.Popup.GridViewObj.DataRowCount;
|
||||
DataTable table = this.Popup.GridControlObj.DataSourceTable();
|
||||
|
||||
@@ -1186,11 +1198,13 @@ namespace Lskj.Control
|
||||
iValueWidth = iValueWidth < 50 ? 50 : iValueWidth + 10;
|
||||
iTextWidth = iTextWidth < 50 ? 50 : iTextWidth + 10;
|
||||
|
||||
popupObj.GridViewObj.Columns[ValueMember].Width = iValueWidth;
|
||||
popupObj.GridViewObj.Columns[TextMember].Width = iTextWidth;
|
||||
if(popupObj.GridViewObj.Columns.ColumnByFieldName(ValueMember)!=null) popupObj.GridViewObj.Columns[ValueMember].Width = iValueWidth;
|
||||
|
||||
if(popupObj.GridViewObj.Columns.ColumnByFieldName(TextMember) != null) popupObj.GridViewObj.Columns[TextMember].Width = iTextWidth;
|
||||
|
||||
if (hasReamrkField)
|
||||
{
|
||||
popupObj.GridViewObj.Columns[RemarkField].Width = iRemarkWidth;
|
||||
if (popupObj.GridViewObj.Columns.ColumnByFieldName(RemarkField) != null) popupObj.GridViewObj.Columns[RemarkField].Width = iRemarkWidth;
|
||||
iRemarkWidth = iRemarkWidth + 10;
|
||||
}
|
||||
int popupWidth = iIndexWidth + iValueWidth + iTextWidth + iRemarkWidth + iOtherWidth + 40;
|
||||
@@ -1212,6 +1226,13 @@ namespace Lskj.Control
|
||||
popupObj.Width = popupWidth;
|
||||
this.CalcPopupLocation();
|
||||
this._Handed = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,11 @@ namespace Lskj.Control
|
||||
/// 虚拟列关联字段
|
||||
/// </summary>
|
||||
public string virtualPrimaryKey;
|
||||
|
||||
/// <summary>
|
||||
/// 行数合计列
|
||||
/// 合计xx行 列,因为默认给的在最前面插入空白表头列,按照工具顺序加载列,可能会出现有2列合计行,所以在重新创建时就把之前的清空
|
||||
/// </summary>
|
||||
public GridColumn TotalColumn;
|
||||
|
||||
public BandedGridControlEx()
|
||||
{
|
||||
@@ -1075,6 +1079,11 @@ namespace Lskj.Control
|
||||
// 设置底部合计
|
||||
if (gridColumn.VisibleIndex == 0 && isBlankHeader)//只有空白表头才设置 合计xxx行
|
||||
{
|
||||
if (this.TotalColumn != null)
|
||||
{
|
||||
this.TotalColumn.Summary.Clear();
|
||||
}
|
||||
this.TotalColumn = gridColumn;
|
||||
|
||||
bandedGridView.OptionsView.ShowFooter = true;
|
||||
gridColumn.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, gridColumn.FieldName, TotalFormat) });
|
||||
|
||||
@@ -116,5 +116,4 @@ namespace Lskj.Control.BrowserSetting
|
||||
else if (message.Name.Equals("SelectPro"))
|
||||
{
|
||||
string arg0 = message.Arguments.GetString(0);
|
||||
if (frmWebBrowser != null && frmWebBrowser.Parent != null && frmWebBrowser.Parent.Parent != null && frmWebBrowser.Parent.Parent is BaseForm baseForm)
|
||||
|
||||
if (frmWebBrowser != null && frmWebBrowser.Parent != null && frmWebBrowser.Parent.Parent != null && frmWebBrowser.Parent.Parent is BaseForm
|
||||
@@ -11,11 +11,15 @@ using System.Web;
|
||||
using System.Windows.Forms;
|
||||
using Xilium.CefGlue;
|
||||
using Lskj.Control.Model;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Lskj.Control.BrowserSetting
|
||||
{
|
||||
public class BsDownloadHandler : CefDownloadHandler
|
||||
{
|
||||
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr GetParent(IntPtr hWnd);
|
||||
|
||||
private BsClient BsClient;
|
||||
public BsDownloadHandler(BsClient bsClient)
|
||||
{
|
||||
@@ -72,7 +76,9 @@ namespace Lskj.Control.BrowserSetting
|
||||
bool success = rowItem != null ? AttachImpl.CheckAttachOperation(2, "", Convert.ToInt32(rowItem["fileId"]), "", 0, out tipMsg) == 1 : isMultipleLoad;
|
||||
if (success)
|
||||
{
|
||||
Download(downloadItem.Url, fileTitle);
|
||||
string ModuleCode = string.Empty;
|
||||
GetParentForm(browser, out ModuleCode);
|
||||
Download(downloadItem.Url, fileTitle, ModuleCode);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -160,7 +166,26 @@ namespace Lskj.Control.BrowserSetting
|
||||
/// </summary>
|
||||
/// <param name="URL">The URL.</param>
|
||||
/// <param name="FileName">Name of the file.</param>
|
||||
public static void Download(string URL, string FileName)
|
||||
public static void Download(string URL, string FileName,string ModuleCode)
|
||||
{
|
||||
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
||||
frmSelectDownl
|
||||
frmSelectDownload.URL = URL;
|
||||
frmSelectDownload.FileName = FileName;
|
||||
frmSelectDownload.ModelId = ModuleCode;
|
||||
frmSelectDownload.Show();
|
||||
//SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
//saveFileDialog.FileName = FileName;
|
||||
//saveFileDialog.Title = "下载模板文件到";
|
||||
//saveFileDialog.RestoreDirectory = true;
|
||||
////点了保存按钮进入
|
||||
//if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
//{
|
||||
// string localFilePath = System.IO.Path.GetFullPath(saveFileDialog.FileName);//获得文件路径,含文件名
|
||||
// string fileNameExt = localFilePath.Substring(localFilePath.LastIndexOf("\\") + 1);//获取文件名,不带路径
|
||||
// string FilePath = localFilePath.Substring(0, localFilePath.LastIndexOf("\\"));//获取文件路径,不带文件名
|
||||
// FrmDownload frm = new FrmDownload(URL, FileName, localFilePath);
|
||||
// frm.Show();
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过 CefBrowser 获取所在��
|
||||
@@ -322,46 +322,4 @@ namespace Lskj.Control.BrowserSetting
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(rowdata) && StaticControl.RightMenuGridView != null)
|
||||
{
|
||||
JObject rowObject = JsonConvert.DeserializeObject<JObject>(rowdata);
|
||||
JArray jArray = new JArray();
|
||||
jArray.Add(rowObject);
|
||||
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(jArray));
|
||||
DataRow rowItem = dataTable.Rows[0];
|
||||
|
||||
DataTable gridTable = (StaticControl.RightMenuGridView.GridControl.DataSource as DataTable).TrimDeleteRows();
|
||||
if (gridTable == null) return;
|
||||
DataRow newRow = gridTable.NewRow();
|
||||
GridColumnCollection gridColumns = StaticControl.RightMenuGridView.Columns;
|
||||
StaticControl.RightMenuGridView.BeginDataUpdate();
|
||||
|
||||
// 赋值明细字段
|
||||
foreach (GridColumn col in gridColumns)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 未包含字段,则使用控件默认值.
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
string colFieldName = col.FieldName;
|
||||
if (!string.IsNullOrWhiteSpace(StaticControl.Comprefix) && colFieldName.Equals(StaticControl.Comprefix + "ProductId", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
colFieldName = colFieldName.Replace(StaticControl.Comprefix, "");
|
||||
}
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
if (rowItem.Table.Columns.Contains(colFieldName))
|
||||
{
|
||||
// 来源列中是否包含对应字段,包含则使用值
|
||||
newRow[col.FieldName] = rowItem[colFieldName];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (rowItem.Table.Columns.Contains(colFieldName))
|
||||
{
|
||||
// 来源列中是否包含对应字段,包含则使用值
|
||||
newRow[col.FieldName] = rowItem[colFieldName];
|
||||
}
|
||||
if (model.LimitLength > 0)
|
||||
{
|
||||
DataRow HandleRow = newRow;
|
||||
|
||||
JObject
|
||||
+27
-25
@@ -36,11 +36,14 @@
|
||||
this.pl_buttom = new DevExpress.XtraEditors.PanelControl();
|
||||
this.gridControlEx1 = new Lskj.Control.GridControlEx();
|
||||
this.pl_main = new DevExpress.XtraEditors.PanelControl();
|
||||
this.splitMain = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
this.cmMain = new DevExpress.XtraCharts.ChartControl();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_buttom)).BeginInit();
|
||||
this.pl_buttom.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main)).BeginInit();
|
||||
this.pl_main.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitMain)).BeginInit();
|
||||
this.splitMain.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cmMain)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(series1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(pieSeriesLabel1)).BeginInit();
|
||||
@@ -53,10 +56,10 @@
|
||||
//
|
||||
this.pl_buttom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pl_buttom.Controls.Add(this.gridControlEx1);
|
||||
this.pl_buttom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pl_buttom.Location = new System.Drawing.Point(0, 230);
|
||||
this.pl_buttom.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pl_buttom.Location = new System.Drawing.Point(0, 0);
|
||||
this.pl_buttom.Name = "pl_buttom";
|
||||
this.pl_buttom.Size = new System.Drawing.Size(588, 149);
|
||||
this.pl_buttom.Size = new System.Drawing.Size(588, 120);
|
||||
this.pl_buttom.TabIndex = 0;
|
||||
this.pl_buttom.Visible = false;
|
||||
//
|
||||
@@ -68,7 +71,8 @@
|
||||
this.gridControlEx1.Margin = new System.Windows.Forms.Padding(4, 7, 4, 7);
|
||||
this.gridControlEx1.Name = "gridControlEx1";
|
||||
this.gridControlEx1.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gridControlEx1.Size = new System.Drawing.Size(588, 149);
|
||||
this.gridControlEx1.Size = new System.Drawing.Size(588, 120);
|
||||
this.gridControlEx1.SysModel = null;
|
||||
this.gridControlEx1.TabIndex = 0;
|
||||
//
|
||||
// pl_main
|
||||
@@ -78,9 +82,25 @@
|
||||
this.pl_main.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pl_main.Location = new System.Drawing.Point(0, 0);
|
||||
this.pl_main.Name = "pl_main";
|
||||
this.pl_main.Size = new System.Drawing.Size(588, 230);
|
||||
this.pl_main.Size = new System.Drawing.Size(588, 254);
|
||||
this.pl_main.TabIndex = 1;
|
||||
//
|
||||
// splitMain
|
||||
//
|
||||
this.splitMain.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2;
|
||||
this.splitMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitMain.Horizontal = false;
|
||||
this.splitMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitMain.Name = "splitMain";
|
||||
this.splitMain.Panel1.Controls.Add(this.pl_main);
|
||||
this.splitMain.Panel1.Text = "Panel1";
|
||||
this.splitMain.Panel2.Controls.Add(this.pl_buttom);
|
||||
this.splitMain.Panel2.Text = "Panel2";
|
||||
this.splitMain.Size = new System.Drawing.Size(588, 379);
|
||||
this.splitMain.SplitterPosition = 254;
|
||||
this.splitMain.TabIndex = 5;
|
||||
this.splitMain.Text = "splitContainerControl1";
|
||||
//
|
||||
// cmMain
|
||||
//
|
||||
this.cmMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@@ -96,7 +116,7 @@
|
||||
pointSeriesLabel1.LineVisibility = DevExpress.Utils.DefaultBoolean.True;
|
||||
this.cmMain.SeriesTemplate.Label = pointSeriesLabel1;
|
||||
this.cmMain.SeriesTemplate.View = lineSeriesView1;
|
||||
this.cmMain.Size = new System.Drawing.Size(588, 230);
|
||||
this.cmMain.Size = new System.Drawing.Size(588, 254);
|
||||
this.cmMain.TabIndex = 2;
|
||||
this.cmMain.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.cmMain_MouseDoubleClick);
|
||||
this.cmMain.MouseMove += new System.Windows.Forms.MouseEventHandler(this.cmMain_MouseMove);
|
||||
@@ -104,29 +124,11 @@
|
||||
// ChartControlEx
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.pl_main);
|
||||
this.Controls.Add(this.pl_buttom);
|
||||
this.Controls.Add(this.splitMain);
|
||||
this.Name = "ChartControlEx";
|
||||
this.Size = new System.Drawing.Size(588, 379);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_buttom)).EndInit();
|
||||
this.pl_buttom.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main)).EndInit();
|
||||
this.pl_main.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(pieSeriesLabel1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(pieSeriesView1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(series1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(pointSeriesLabel1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(lineSeriesView1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cmMain)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevExpress.XtraEditors.PanelControl pl_buttom;
|
||||
private DevExpress.XtraEditors.PanelControl pl_main;
|
||||
private GridControlEx gridControlEx1;
|
||||
public DevExpress.XtraCharts.ChartControl cmMain;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,11 +57,22 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
public bool transverseHistogram;
|
||||
|
||||
/// <summary>
|
||||
/// 分割条
|
||||
/// </summary>
|
||||
/// <value>The chart control object.</value>
|
||||
public DevExpress.XtraEditors.SplitContainerControl SplitMain { get { return this.splitMain; } }
|
||||
|
||||
|
||||
public ChartControlEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.splitMain.PanelVisibility = SplitPanelVisibility.Panel1;//初始化时默认隐藏下方
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -91,6 +102,7 @@ namespace Lskj.Control
|
||||
{
|
||||
series.Label.TextPattern = "{V:0.00%}";
|
||||
}
|
||||
|
||||
switch (chart.ChartType)
|
||||
{
|
||||
default:
|
||||
@@ -265,6 +277,10 @@ namespace Lskj.Control
|
||||
chart.YValueField = item["YValueField"] + "";
|
||||
chart.IsAbsolutely = item.Table.Columns.Contains("IsAbsolutely") ? item["IsAbsolutely"] + "" : null;
|
||||
chart.YScale = item.Table.Columns.Contains("YScale") && !string.IsNullOrWhiteSpace(item["YScale"].ToString()) ? double.Parse(item["YScale"].ToString()) : 0;
|
||||
|
||||
chart.ChartColor= item.Table.Columns.Contains("ChartColor") ? item["ChartColor"] + "" : "";
|
||||
chart.ValueVisible = item.Table.Columns.Contains("valueVisible") ? "1".Equals(item["valueVisible"] + "") : false;
|
||||
chart.ChartTitle = item.Table.Columns.Contains("ChartTitle") ? item["ChartTitle"] + "" : "";
|
||||
this._models.Add(chart);
|
||||
}
|
||||
}
|
||||
@@ -290,25 +306,26 @@ namespace Lskj.Control
|
||||
|
||||
Series series = null;
|
||||
|
||||
|
||||
string Title = !string.IsNullOrWhiteSpace(chart.ChartTitle) ? chart.ChartTitle : chart.YAxisTitle;
|
||||
|
||||
switch (chart.ChartType)
|
||||
{
|
||||
case ChartType.LineChart:
|
||||
default:
|
||||
series = new Series(chart.YAxisTitle, chart.Chart3D == 1 ? ViewType.Line3D : ViewType.Line);
|
||||
series = new Series(Title, chart.Chart3D == 1 ? ViewType.Line3D : ViewType.Line);
|
||||
break;
|
||||
case ChartType.BarChart:
|
||||
series = new Series(chart.YAxisTitle, chart.Chart3D == 1 ? ViewType.Bar3D : ViewType.Bar);
|
||||
series = new Series(Title, chart.Chart3D == 1 ? ViewType.Bar3D : ViewType.Bar);
|
||||
//柱状图显示值出现在顶端
|
||||
BarSeriesLabel label = (BarSeriesLabel)series.Label;
|
||||
label.Position = BarSeriesLabelPosition.Top;
|
||||
|
||||
break;
|
||||
case ChartType.PieChart:
|
||||
{
|
||||
if (chart.Chart3D == 1)
|
||||
{
|
||||
series = new Series(chart.YAxisTitle, ViewType.Doughnut3D);
|
||||
series = new Series(Title, ViewType.Doughnut3D);
|
||||
PiePointOptions options = series.Label.PointOptions as PiePointOptions;
|
||||
((PiePointOptions)series.LegendPointOptions).PointView = PointView.ArgumentAndValues;
|
||||
Doughnut3DSeriesView view = series.View as Doughnut3DSeriesView;
|
||||
@@ -323,7 +340,7 @@ namespace Lskj.Control
|
||||
}
|
||||
else
|
||||
{
|
||||
series = new Series(chart.YAxisTitle, ViewType.Pie);
|
||||
series = new Series(Title, ViewType.Pie);
|
||||
PiePointOptions options = series.Label.PointOptions as PiePointOptions;
|
||||
series.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
|
||||
((PiePointOptions)series.LegendPointOptions).PointView = PointView.ArgumentAndValues;
|
||||
@@ -344,8 +361,12 @@ namespace Lskj.Control
|
||||
}
|
||||
if (series != null)
|
||||
{
|
||||
|
||||
this.CreateSeriesChart(chart, series, chartData, gridView);
|
||||
series.View.Color = System.Drawing.ColorTranslator.FromHtml(chart.ChartColor);
|
||||
|
||||
if(chart.ValueVisible) series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
||||
|
||||
this.cmMain.Series.Add(series);
|
||||
//if (chart.ChartType == ChartType.LineChart)
|
||||
//{
|
||||
@@ -382,8 +403,11 @@ namespace Lskj.Control
|
||||
this.cmMain.CustomDrawCrosshair += OnCmMainCustomDrawCrosshair;
|
||||
this.cmMain.CustomDrawSeriesPoint += OnCmMainCustomDrawSeriesPoint;
|
||||
// this.cmMain.Legend.AlignmentVertical = LegendAlignmentVertical.Top;
|
||||
this.cmMain.CrosshairOptions.ShowOnlyInFocusedPane = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:双击图表</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -520,6 +544,30 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置图标标题
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="color"></param>
|
||||
public void SetTitle(string text,string color)
|
||||
{
|
||||
|
||||
// 清空标题
|
||||
cmMain.Titles.Clear();
|
||||
// 创建标题
|
||||
ChartTitle chartTitle = new ChartTitle();
|
||||
chartTitle.Text = text; // 替换为你的实际标题内容
|
||||
chartTitle.Font = new Font("微软雅黑", 12, FontStyle.Bold); // 字体样式
|
||||
if(!string.IsNullOrWhiteSpace(color))chartTitle.TextColor = System.Drawing.ColorTranslator.FromHtml(color);
|
||||
chartTitle.Dock = ChartTitleDockStyle.Bottom; // 固定在顶部
|
||||
// 添加到图表
|
||||
cmMain.Titles.Add(chartTitle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -544,4 +592,13 @@ namespace Lskj.Control
|
||||
/// <summary>
|
||||
/// 图表对象
|
||||
/// </summary>
|
||||
public class ChartMo
|
||||
public class ChartModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The chart3 d
|
||||
/// </summary>
|
||||
public int Chart3D;
|
||||
/// <summary>
|
||||
/// The y axis shared
|
||||
/// </summary>
|
||||
public int YAxisShar
|
||||
Generated
+115
@@ -0,0 +1,115 @@
|
||||
namespace Lskj.Control
|
||||
{
|
||||
partial class FrmCover
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pl_top = new DevExpress.XtraEditors.PanelControl();
|
||||
this.btnCover = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnRead = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.pl_bottom = new DevExpress.XtraEditors.PanelControl();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.gcMain = new Lskj.Control.GridControlEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_top)).BeginInit();
|
||||
this.pl_top.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_bottom)).BeginInit();
|
||||
this.pl_bottom.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pl_top
|
||||
//
|
||||
this.pl_top.Appearance.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pl_top.Appearance.Options.UseBackColor = true;
|
||||
this.pl_top.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pl_top.Controls.Add(this.btnCover);
|
||||
this.pl_top.Controls.Add(this.btnRead);
|
||||
this.pl_top.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pl_top.Location = new System.Drawing.Point(0, 0);
|
||||
this.pl_top.Name = "pl_top";
|
||||
this.pl_top.Size = new System.Drawing.Size(751, 43);
|
||||
this.pl_top.TabIndex = 1;
|
||||
//
|
||||
// btnCover
|
||||
//
|
||||
this.btnCover.Appearance.ForeColor = System.Drawing.Color.Red;
|
||||
this.btnCover.Appearance.Options.UseForeColor = true;
|
||||
this.btnCover.Location = new System.Drawing.Point(92, 8);
|
||||
this.btnCover.Name = "btnCover";
|
||||
this.btnCover.Size = new System.Drawing.Size(73, 25);
|
||||
this.btnCover.TabIndex = 11;
|
||||
this.btnCover.Text = "导入覆盖";
|
||||
this.btnCover.Click += new System.EventHandler(this.OnCoverButtonClick);
|
||||
//
|
||||
// btnRead
|
||||
//
|
||||
this.btnRead.Location = new System.Drawing.Point(13, 8);
|
||||
this.btnRead.Name = "btnRead";
|
||||
this.btnRead.Size = new System.Drawing.Size(73, 25);
|
||||
this.btnRead.TabIndex = 10;
|
||||
this.btnRead.Text = "读取Excel";
|
||||
this.btnRead.Click += new System.EventHandler(this.OnReadButtonClick);
|
||||
//
|
||||
// pl_bottom
|
||||
//
|
||||
this.pl_bottom.Appearance.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pl_bottom.Appearance.Options.UseBackColor = true;
|
||||
this.pl_bottom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pl_bottom.Controls.Add(this.label1);
|
||||
this.pl_bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pl_bottom.Location = new System.Drawing.Point(0, 514);
|
||||
this.pl_bottom.Name = "pl_bottom";
|
||||
this.pl_bottom.Size = new System.Drawing.Size(751, 28);
|
||||
this.pl_bottom.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 8);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(551, 14);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "操作提示:请先读取需要导入的Excel文件,然后对需要导入的数据进行核对修改后,点击【确认导入】";
|
||||
//
|
||||
// gcMain
|
||||
//
|
||||
this.gcMain.AdapterObj = null;
|
||||
this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gcMain.Location = new System.Drawing.Point(0, 43);
|
||||
this.gcMain.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.gcMain.Name = "gcMain";
|
||||
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gcMain.Size = new System.Drawing.Size(751, 471);
|
||||
this.gcMain.SysModel = null;
|
||||
this.gcMain.TabIndex = 3;
|
||||
//
|
||||
// FrmCover
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
this.Appearance.Options.UseFont = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -752,14 +752,34 @@ namespace Lskj.Control
|
||||
{
|
||||
string columnName = this.gridView1.Columns[i].FieldName;
|
||||
GridSummaryItem gsi = gridView.Columns[columnName].SummaryItem;
|
||||
|
||||
if (gsi.SummaryType != DevExpress.Data.SummaryItemType.None) //gsi.SummaryValue!=null&& !string.IsNullOrEmpty(gsi.SummaryValue.ToString())
|
||||
{
|
||||
this.gridView1.Columns[i].Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(gsi.SummaryType, this.gridView1.Columns[i].FieldName.ToString(), gsi.DisplayFormat) });
|
||||
|
||||
string originalFormat = gsi.DisplayFormat;
|
||||
// 匹配 {0:#.##}、{0:0.##} 等格式 避免出现没有小数但是还有小数点的情况,如 0.
|
||||
try
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(originalFormat, @"\{0:(.*?)\}");
|
||||
if (match.Success)
|
||||
{
|
||||
string innerFormat = match.Groups[1].Value;
|
||||
if (innerFormat.Contains("."))
|
||||
{
|
||||
// 生成条件格式:正数;负数;零(整数无小数点)
|
||||
string newInnerFormat = $"{innerFormat};{innerFormat};{innerFormat.Split('.')[0]}";
|
||||
originalFormat = originalFormat.Replace(innerFormat, newInnerFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
originalFormat = gsi.DisplayFormat;
|
||||
}
|
||||
|
||||
this.gridView1.Columns[i].Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(gsi.SummaryType, this.gridView1.Columns[i].FieldName.ToString(), originalFormat) });
|
||||
if (SystemInfo.Instance.GroupSpecialMode)
|
||||
{
|
||||
this.gridView1.GroupSummary.Add(new DevExpress.XtraGrid.GridGroupSummaryItem(gsi.SummaryType, this.gridView1.Columns[i].FieldName.ToString(), this.gridView1.Columns[i], gsi.DisplayFormat));
|
||||
this.gridView1.GroupSummary.Add(new DevExpress.XtraGrid.GridGroupSummaryItem(gsi.SummaryType, this.gridView1.Columns[i].FieldName.ToString(), this.gridView1.Columns[i], originalFormat));
|
||||
this.gridView1.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -214,6 +214,14 @@ namespace Lskj.Control
|
||||
}
|
||||
this.mMaxPage = Convert.ToInt32(this.mSourceTable.Rows.Count / mPageSize) + (this.mSourceTable.Rows.Count % mPageSize > 0 ? 1 : 0);
|
||||
}
|
||||
//筛选改成 包含
|
||||
foreach (GridColumn col in gridView.Columns)
|
||||
{
|
||||
if (col.Visible)
|
||||
{
|
||||
col.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
|
||||
}
|
||||
}
|
||||
this.gridView.BestFitColumns();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Generated
+2
-26
@@ -155,6 +155,7 @@
|
||||
this.gcMain.Name = "gcMain";
|
||||
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gcMain.Size = new System.Drawing.Size(751, 471);
|
||||
this.gcMain.SysModel = null;
|
||||
this.gcMain.TabIndex = 0;
|
||||
//
|
||||
// FrmImport
|
||||
@@ -172,29 +173,4 @@
|
||||
this.Text = "导入Excel";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OnImportFormClosing);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_top)).EndInit();
|
||||
this.pl_top.ResumeLayout(false);
|
||||
this.pl_top.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_bottom)).EndInit();
|
||||
this.pl_bottom.ResumeLayout(false);
|
||||
this.pl_bottom.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main)).EndInit();
|
||||
this.pl_main.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevExpress.XtraEditors.PanelControl pl_top;
|
||||
private DevExpress.XtraEditors.PanelControl pl_bottom;
|
||||
private DevExpress.XtraEditors.PanelControl pl_main;
|
||||
private DevExpress.XtraEditors.SimpleButton btnExport;
|
||||
private DevExpress.XtraEditors.SimpleButton btnImport;
|
||||
private DevExpress.XtraEditors.SimpleButton btnRead;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private GridControlEx gcMain;
|
||||
private DevExpress.XtraEditors.SimpleButton btnCover;
|
||||
|
||||
}
|
||||
}
|
||||
this.pl_top.ResumeLayout(false
|
||||
@@ -38,6 +38,7 @@ using NPOI;
|
||||
using System.Diagnostics;
|
||||
using DevExpress.XtraGrid.Views.BandedGrid;
|
||||
using DevExpress.Utils;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -390,8 +391,13 @@ namespace Lskj.Control
|
||||
try
|
||||
{
|
||||
string sql = "select * from " + _tableName + " where 1<>1";
|
||||
SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
//SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
//SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
|
||||
DbDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
DbCommandBuilder scb = SqlHelper.dbFactory.CreateCommandBuilder();
|
||||
scb.DataAdapter = dat;
|
||||
|
||||
DataTable datatb = new DataTable();
|
||||
DataTable failedData = new DataTable();
|
||||
dat.Fill(datatb);
|
||||
@@ -920,7 +926,7 @@ namespace Lskj.Control
|
||||
//bool isMultipleHeader = false;
|
||||
//if (this._gridEx is BandedGridControlEx) isMultipleHeader = true;
|
||||
//this.gcMain.GridView.Tag = isMultipleHeader;
|
||||
gcData = this.gcMain.GridView.ToExcelDataTable(fileName, colFields, true);
|
||||
gcData = this.gcMain.GridView.ToExcelDataTable(fileName, colFields, true,false,this.SysModel.AutoImportCalMode);
|
||||
|
||||
|
||||
//设置默认值
|
||||
@@ -1048,7 +1054,8 @@ namespace Lskj.Control
|
||||
List<string> ColumnNameList = GridExtend.ColumnNameList;
|
||||
|
||||
string sql = "select * from " + _tableName + " where 1<>1";
|
||||
SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
//SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
DbDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
DataTable datatb = new DataTable();
|
||||
dat.Fill(datatb);
|
||||
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
partial class FrmTreePicture
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureEdit = new DevExpress.XtraEditors.PictureEdit();
|
||||
this.lbRight = new System.Windows.Forms.Label();
|
||||
this.lbLeft = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureEdit.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureEdit
|
||||
//
|
||||
this.pictureEdit.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.pictureEdit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureEdit.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureEdit.Name = "pictureEdit";
|
||||
this.pictureEdit.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom;
|
||||
this.pictureEdit.Size = new System.Drawing.Size(787, 571);
|
||||
this.pictureEdit.TabIndex = 44;
|
||||
//
|
||||
// lbRight
|
||||
//
|
||||
this.lbRight.BackColor = System.Drawing.Color.White;
|
||||
this.lbRight.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.lbRight.Image = global::Lskj.Control.Properties.Resources.right;
|
||||
this.lbRight.Location = new System.Drawing.Point(757, 0);
|
||||
this.lbRight.Name = "lbRight";
|
||||
this.lbRight.Size = new System.Drawing.Size(30, 571);
|
||||
this.lbRight.TabIndex = 48;
|
||||
//
|
||||
// lbLeft
|
||||
//
|
||||
this.lbLeft.BackColor = System.Drawing.Color.White;
|
||||
this.lbLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.lbLeft.Image = global::Lskj.Control.Properties.Resources.left;
|
||||
this.lbLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbLeft.Name = "lbLeft";
|
||||
this.lbLeft.Size = new System.Drawing.Size(30, 571);
|
||||
this.lbLeft.TabIndex = 47;
|
||||
//
|
||||
// FrmTreePicture
|
||||
//
|
||||
this.Appearance.BackColor =
|
||||
@@ -0,0 +1,87 @@
|
||||
using DevExpress.XtraTreeList.Columns;
|
||||
using Lskj.Business;
|
||||
using Lskj.Control.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
public partial class FrmTreePicture : BaseForm
|
||||
{
|
||||
// 1. 将 GridColumn 替换为 TreeListColumn
|
||||
public List<TreeListColumn> PicUrlColumns;
|
||||
public DataRow FocusedRow; // 保持不变(仍用于存储节点绑定的数据行)
|
||||
public TreeListColumn FocusedColumn; // 聚焦列改为 TreeListColumn
|
||||
public Image Picture
|
||||
{
|
||||
get
|
||||
{
|
||||
return pictureEdit.Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
pictureEdit.Image = value;
|
||||
}
|
||||
}
|
||||
|
||||
public FrmTreePicture()
|
||||
{
|
||||
InitializeComponent();
|
||||
pictureEdit.Properties.ShowMenu = false;
|
||||
this.lbLeft.Click += OnBtnLeftClick;
|
||||
this.lbRight.Click += OnBtnRightClick;
|
||||
}
|
||||
|
||||
// 2. 右侧按钮点击事件(适配 TreeListColumn)
|
||||
private void OnBtnRightClick(object sender, EventArgs e)
|
||||
{
|
||||
int index = PicUrlColumns.IndexOf(FocusedColumn);
|
||||
if (index >= 0 && index + 1 <= PicUrlColumns.Count - 1)
|
||||
{
|
||||
FocusedColumn = PicUrlColumns[index + 1];
|
||||
if (FocusedColumn.Tag != null && FocusedColumn.Tag is GridColumnModel columnModel)
|
||||
{
|
||||
// 3. 读取图片URL(兼容 TreeList 节点绑定的 DataRow)
|
||||
string imageUrl = FocusedRow.Table.Columns.Contains(columnModel.FieldName)
|
||||
? FocusedRow[columnModel.FieldName] + ""
|
||||
: "";
|
||||
|
||||
if (string.IsNullOrEmpty(imageUrl))
|
||||
return;
|
||||
|
||||
// 补全URL(保持原有逻辑)
|
||||
if (!imageUrl.StartsWith("http"))
|
||||
{
|
||||
string oaUrl = SystemInfo.Instance.OAUrl.EndsWith("/")
|
||||
? SystemInfo.Instance.OAUrl
|
||||
: $"{SystemInfo.Instance.OAUrl}/";
|
||||
imageUrl = $"{oaUrl}{imageUrl}";
|
||||
}
|
||||
|
||||
// 从列模型缓存中获取图片(保持原有逻辑)
|
||||
if (columnModel.LabPicUrlImages.ContainsKey(imageUrl))
|
||||
{
|
||||
Image image = ((KeyValuePair<Image, Image>)columnModel.LabPicUrlImages[imageUrl]).Key;
|
||||
Picture = image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 左侧按钮点击事件(适配 TreeListColumn)
|
||||
private void OnBtnLeftClick(object sender, EventArgs e)
|
||||
{
|
||||
int index = PicUrlColumns.IndexOf(FocusedColumn);
|
||||
if (index >= 0 && index - 1 >= 0)
|
||||
{
|
||||
FocusedColumn = PicUrlColumns[index - 1];
|
||||
if (FocusedColumn.Tag != null && FocusedColumn.Tag is GridColumnModel columnModel)
|
||||
{
|
||||
// 读取图片URL(同右侧逻辑,兼容 TreeList 数据行)
|
||||
string imageUrl = FocusedRow.Table.Columns.Contains(columnModel.FieldName)
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -89,6 +89,14 @@ namespace Lskj.Control
|
||||
}
|
||||
cefBrowserSettings.GetMainFrame().LoadUrl(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enUrl)
|
||||
{
|
||||
url = ToEnUrl(url);
|
||||
}
|
||||
FrmLoad(url);
|
||||
}
|
||||
}
|
||||
public void LoadRequest(string url, string dataStr)
|
||||
{
|
||||
@@ -128,23 +136,4 @@ namespace Lskj.Control
|
||||
}
|
||||
else
|
||||
{
|
||||
qpLS.Add(string.Format("{0}={1}", eqParams[0], HttpUtility.UrlEncode(HttpUtility.UrlDecode(string.Join("=", eqParams.Skip(1)))).Replace("%5c", "/").Replace("%2f", "/").Replace("//", "/")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
if (pms.Count > 0)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now.AddDays(1);
|
||||
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
long timestamp = (dateTime.Ticks - epoch.Ticks) / TimeSpan.TicksPerSecond;
|
||||
pms.Add("exp", timestamp);
|
||||
}
|
||||
return $"{urlParams[0]}?pms={HttpUtility.UrlEncode(hasEn ? Lskj.Web.Core.Util.safety.AESUtil.Encrypt(JSON.Encode(pms), enVal) : Lskj.Web.Core.Util.safety.AESUtil.MobileEncrypt(JSON.Encode(pms)))}&{qpLS.SJoin("&")}";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,14 @@ namespace Lskj.Control
|
||||
}
|
||||
cefBrowserSettings.GetMainFrame().LoadUrl(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enUrl)
|
||||
{
|
||||
url = ToEnUrl(url);
|
||||
}
|
||||
FrmLoad(url);
|
||||
}
|
||||
}
|
||||
public void LoadRequest(string url, string dataStr)
|
||||
{
|
||||
@@ -114,7 +122,7 @@ namespace Lskj.Control
|
||||
bool hasEn = false;
|
||||
if (urlParams.Length > 1)
|
||||
{
|
||||
string[] queryParams = urlParams[1].Split('&');
|
||||
string[] queryParams = string.Join("?", urlParams.Skip(1)).Split('&');
|
||||
List<string> qpLS = new List<string>();
|
||||
Hashtable pms = new Hashtable();
|
||||
hasEn = queryParams.Any(str => str.Trim().StartsWith(enKey, StringComparison.OrdinalIgnoreCase));
|
||||
@@ -125,9 +133,19 @@ namespace Lskj.Control
|
||||
{
|
||||
if (hasEn && eqParams[0].ToLower() == enKey)
|
||||
{
|
||||
enVal = eqParams[1];
|
||||
enVal = string.Join("=", eqParams.Skip(1));
|
||||
continue;
|
||||
}
|
||||
if (hasEn || eqParams[0].ToLower() == "username" || eqParams[0].ToLower() == "password")
|
||||
{
|
||||
pms.Add(eqParams[0],
|
||||
pms.Add(eqParams[0], string.Join("=", eqParams.Skip(1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
string rawValue = HttpUtility.UrlDecode(string.Join("=", eqParams.Skip(1))).TrimEnd();
|
||||
|
||||
qpLS.Add(string.Format("{0}={1}", eqParams[0], HttpUtility.UrlEncode(rawValue).Replace("%5c", "/").Replace("%2f", "/").Replace("//", "/").Replace("%3d", "=")));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -53,6 +53,7 @@ using System.Threading.Tasks;
|
||||
using System.Collections;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -239,7 +240,7 @@ namespace Lskj.Control
|
||||
/// Gets or sets the adapter object.
|
||||
/// </summary>
|
||||
/// <value>The adapter object.</value>
|
||||
public SqlDataAdapter AdapterObj { get; set; }
|
||||
public DbDataAdapter AdapterObj { get; set; }
|
||||
/// <summary>
|
||||
/// Gets the grid view.
|
||||
/// </summary>
|
||||
@@ -452,7 +453,14 @@ namespace Lskj.Control
|
||||
/// 搜索框 手动添加行
|
||||
/// </summary>
|
||||
public Dictionary<string, List<DataRow>> ManuallyAddData = new Dictionary<string, List<DataRow>>();
|
||||
|
||||
/// <summary>
|
||||
/// 修改字段
|
||||
/// </summary>
|
||||
public string ModifyFields = string.Empty;
|
||||
/// <summary>
|
||||
/// 必填字段
|
||||
/// </summary>
|
||||
public string RequiredFields = string.Empty;
|
||||
|
||||
public GridControlEx()
|
||||
{
|
||||
@@ -509,14 +517,11 @@ namespace Lskj.Control
|
||||
|
||||
this.gridView.ShowingEditor += GridView_ShowingEditor;
|
||||
this.gridView.MouseDown += GridView_MouseDown;
|
||||
//绑定滚轮横向滚动
|
||||
this.gridView.MouseWheel += GridView_MouseWheel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存前反写多表头数据源
|
||||
/// </summary>
|
||||
@@ -1783,10 +1788,10 @@ namespace Lskj.Control
|
||||
public void GetDataCaches(Dictionary<object, Hashtable> cachesDic, string customColumKey = "")
|
||||
{
|
||||
Task<DynamicModel> dynamicModelTask = cachesDic.GetTask<DynamicModel>(this, "DynamicModel");
|
||||
Task<bool> existsSettingTableTask = cachesDic.AddTask(this, "HasExistsSettingTable", new Task<bool>(() =>
|
||||
{
|
||||
return BaseImpl.HasExistsTable(ResourceKeys.SettingTableName);
|
||||
}));
|
||||
//Task<bool> existsSettingTableTask = cachesDic.AddTask(this, "HasExistsSettingTable", new Task<bool>(() =>
|
||||
//{
|
||||
// return BaseImpl.HasExistsTable(ResourceKeys.SettingTableName);
|
||||
//}));
|
||||
Task<DataTable> setBaseGridRightMenusTask = cachesDic.AddTask(this, "RightMenuBtn", new Task<DataTable>(() =>
|
||||
{
|
||||
DataTable dataTable = null;
|
||||
@@ -1929,7 +1934,7 @@ namespace Lskj.Control
|
||||
/// <param name="adapter">The adapter.</param>
|
||||
/// <param name="selectRowHandler">if set to <c>true</c> [select row handler].</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public virtual int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
||||
public virtual int SetGridViewDataSource(DbDataAdapter adapter, bool selectRowHandler = true)
|
||||
{
|
||||
if (adapter == null) return 0;
|
||||
|
||||
@@ -1992,7 +1997,8 @@ namespace Lskj.Control
|
||||
this.gridView.Columns.Clear();
|
||||
}
|
||||
}
|
||||
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||
DbCommandBuilder cb = SqlHelper.dbFactory.CreateCommandBuilder();
|
||||
cb.DataAdapter = this.AdapterObj;
|
||||
//this.GridControl.DataSource = dataSet.Tables[0];
|
||||
|
||||
//解决大小写问题后在赋值
|
||||
@@ -2447,11 +2453,12 @@ namespace Lskj.Control
|
||||
protected virtual void SetCustomColumns(DataTable customTable, bool isInit = true)
|
||||
{
|
||||
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
|
||||
if (!dataCaches.GetValue(this, "HasExistsSettingTable", out bool hasExistsSettingTable))
|
||||
{
|
||||
hasExistsSettingTable = BaseImpl.HasExistsTable(ResourceKeys.SettingTableName);
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.CustomColumKey) || !hasExistsSettingTable)
|
||||
//if (!dataCaches.GetValue(this, "HasExistsSettingTable", out bool hasExistsSettingTable))
|
||||
//{
|
||||
// hasExistsSettingTable = BaseImpl.HasExistsTable(ResourceKeys.SettingTableName);
|
||||
//}
|
||||
|
||||
if (string.IsNullOrEmpty(this.CustomColumKey) || customTable.Columns.Count == 0)//!hasExistsSettingTable
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2607,6 +2614,7 @@ namespace Lskj.Control
|
||||
{
|
||||
gridView.GroupSummary.AddRange(new GridSummaryItem[] { new GridGroupSummaryItem(SummaryItemType.Sum, col.FieldName, null, "{0:" + dataFormat + "}") });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (colSplit.Length > 3)
|
||||
@@ -3919,6 +3927,7 @@ namespace Lskj.Control
|
||||
RepositoryItemLookUpEdit comboxEdit = new RepositoryItemLookUpEdit();
|
||||
if (model.FontSize > 0) comboxEdit.Appearance.Font = new Font("微软雅黑", model.FontSize);
|
||||
comboxEdit.SearchMode = SearchMode.AutoFilter;
|
||||
//comboxEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//允许编辑
|
||||
comboxEdit.ShowHeader = false;
|
||||
comboxEdit.ImmediatePopup = false;
|
||||
comboxEdit.NullText = "";
|
||||
@@ -4145,14 +4154,16 @@ namespace Lskj.Control
|
||||
gridColumn.ColumnEdit = searchEdit;
|
||||
searchEdit.View.Tag = searchEdit;
|
||||
if (model.SearchBoxAddition) searchEdit.ProcessNewValue += SearchEdit_ProcessNewValue;
|
||||
if ((ControlType.LabAutoCompleteText == model.FieldType || ControlType.LabAutoGridText == model.FieldType || ControlType.LabAutoGridTextParam == model.FieldType))
|
||||
{
|
||||
searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChangingAdd;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChanging;
|
||||
}
|
||||
//if ((ControlType.LabAutoCompleteText == model.FieldType || ControlType.LabAutoGridText == model.FieldType || ControlType.LabAutoGridTextParam == model.FieldType))
|
||||
//{
|
||||
// searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChangingAdd;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChanging;
|
||||
//}
|
||||
searchEdit.View.CustomDrawFilterPanel += OnCustomDrawFilterPanel;
|
||||
searchEdit.View.Click += new EventHandler(View_Click);
|
||||
this.mControlList.Add(model);
|
||||
@@ -4331,14 +4342,14 @@ namespace Lskj.Control
|
||||
{
|
||||
FilterLookup(sender, e.NewValue + "");
|
||||
}));
|
||||
//if (string.IsNullOrWhiteSpace(edit.AutoSearchText) && e.NewValue == "")
|
||||
//{
|
||||
// DataRow newRow = dt.NewRow();
|
||||
// if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => x == newRow) == null)
|
||||
// {
|
||||
// dt.Rows.Add(newRow.ItemArray);
|
||||
// }
|
||||
//}
|
||||
if (string.IsNullOrWhiteSpace(edit.AutoSearchText) && e.NewValue == "")
|
||||
{
|
||||
DataRow newRow = dt.NewRow();
|
||||
if (dt.Rows.Cast<DataRow>().FirstOrDefault(x => x == newRow) == null)
|
||||
{
|
||||
dt.Rows.Add(newRow.ItemArray);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4946,6 +4957,7 @@ namespace Lskj.Control
|
||||
gridColumn.OptionsColumn.ReadOnly = true;
|
||||
gridColumn.ColumnEdit = btnEdit;
|
||||
|
||||
gridColumn.FilterMode = ColumnFilterMode.DisplayText;//筛选行匹配文本值(模块返回ID不像下拉框,不进入弹出框,只能看到文本值。所以把筛选改成按文本筛选)
|
||||
|
||||
this.mControlList.Add(model);
|
||||
}
|
||||
@@ -6531,7 +6543,7 @@ namespace Lskj.Control
|
||||
string[] dataReleColNames = selectColumnModel.AutoPadDataReleColName.TrimEnd(',').Split(',');
|
||||
if (dataReleColNames.Contains(e.Column.FieldName))
|
||||
{
|
||||
DataRow[] selectRows = dataTable.Select().Where(n => n[selectColumnModel.FieldName].Equals(value)).ToArray();
|
||||
DataRow[] selectRows = dataTable.Select().Where(n => (n[selectColumnModel.FieldName]+"").Equals(value)).ToArray();
|
||||
foreach (DataRow selectRow in selectRows)
|
||||
{
|
||||
int dataSourceIndex = dataTable.Rows.IndexOf(selectRow);
|
||||
@@ -8886,32 +8898,36 @@ namespace Lskj.Control
|
||||
/// <summary>
|
||||
/// 重新设置表格的字段属性
|
||||
/// </summary>
|
||||
/// <param name="ModifyFields">修改字段</param>
|
||||
/// <param name="RequiredFields">必填字段</param>
|
||||
public virtual void SetFieldStatus(string ModifyFields, string RequiredFields, DataTable AuthorityTable = null)
|
||||
/// <param name="modifyFields">修改字段</param>
|
||||
/// <param name="requiredFields">必填字段</param>
|
||||
public virtual void SetFieldStatus(string modifyFields, string requiredFields, DataTable AuthorityTable = null)
|
||||
{
|
||||
|
||||
this.ModifyFields = modifyFields;
|
||||
this.RequiredFields = requiredFields;
|
||||
GridColumnCollection gc = this.GridView.Columns;
|
||||
bool Modify = false;
|
||||
bool Required = false;
|
||||
Color RequiredForceColor = string.IsNullOrEmpty(SystemInfo.Instance.ControlRequiredColor) ? Color.Blue : ColorTranslator.FromHtml(SystemInfo.Instance.ControlRequiredColor);
|
||||
//修改字段
|
||||
if (!string.IsNullOrEmpty(ModifyFields) && ModifyFields != "-1")
|
||||
if (!string.IsNullOrEmpty(modifyFields) && modifyFields != "-1")
|
||||
{
|
||||
ModifyFields = ModifyFields + ",";
|
||||
modifyFields = modifyFields + ",";
|
||||
Modify = true;
|
||||
modifyFields = modifyFields.ToLower();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(RequiredFields) && RequiredFields != "-1")
|
||||
if (!string.IsNullOrEmpty(requiredFields) && requiredFields != "-1")
|
||||
{
|
||||
Required = true;
|
||||
RequiredFields = RequiredFields + ",";
|
||||
requiredFields = requiredFields + ",";
|
||||
requiredFields = requiredFields.ToLower();
|
||||
}
|
||||
this.gridView.BeginUpdate();
|
||||
foreach (GridColumn item in gc)
|
||||
{
|
||||
GridColumnModel model = item.Tag as GridColumnModel;
|
||||
|
||||
//修改
|
||||
if (Modify && ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
if (Modify && modifyFields.Split(',').Contains(item.FieldName.ToLower()))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(model.PrivilegeOper) && AuthorityTable != null)
|
||||
{
|
||||
@@ -8931,7 +8947,7 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
|
||||
item.OptionsColumn.AllowEdit = ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
|
||||
item.OptionsColumn.AllowEdit = modifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
|
||||
item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit;
|
||||
|
||||
if (!item.OptionsColumn.AllowEdit)
|
||||
@@ -8944,16 +8960,12 @@ namespace Lskj.Control
|
||||
item.AppearanceHeader.Options.UseForeColor = true;
|
||||
item.AppearanceHeader.ForeColor = ColorTranslator.FromHtml("#00000");
|
||||
}
|
||||
//if (model.CanNull)
|
||||
//{
|
||||
// item.AppearanceHeader.Options.UseForeColor = true;
|
||||
// item.AppearanceHeader.ForeColor = RequiredForceColor;
|
||||
//}
|
||||
|
||||
if (model.FieldType == ControlType.LabMemoEdit) item.OptionsColumn.AllowEdit = true;
|
||||
}
|
||||
|
||||
//必填
|
||||
if (Required && RequiredFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
if (Required && requiredFields.Split(',').Contains(item.FieldName.ToLower()))
|
||||
{
|
||||
item.AppearanceHeader.Options.UseForeColor = true;
|
||||
item.AppearanceHeader.ForeColor = RequiredForceColor;
|
||||
@@ -9932,4 +9944,43 @@ namespace Lskj.Control
|
||||
return Rectangle.Empty;
|
||||
|
||||
// 转换为网格控件内的坐标(关键修正)
|
||||
Point cellLocation = view.GridControl.PointToClient(
|
||||
viewInfo.GridControl.PointToScreen(cellInfo.Bounds.Location)
|
||||
);
|
||||
|
||||
return new Rectangle(
|
||||
cellLocation.X,
|
||||
cellLocation.Y,
|
||||
cellInfo.Bounds.Width,
|
||||
cellInfo.Bounds.Height
|
||||
);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Rectangle.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算按钮起始X坐标(支持左右对齐)
|
||||
private int GetButtonStartX(int cellWidth, int totalButtonsWidth, bool isLeftAligned)
|
||||
{
|
||||
if (isLeftAligned)
|
||||
{
|
||||
// 靠左对齐:从单元格左侧开始
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 靠右对齐:从右侧减去总宽度
|
||||
return cellWidth - totalButtonsWidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 滚轮滚动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void GridView_MouseWhee
|
||||
@@ -241,7 +241,7 @@ namespace Lskj.Control
|
||||
{
|
||||
// 存在名称并且没有value值则
|
||||
//PopupBoxSelection为ture时代表在弹出框中选中行,就不根据当前输入值判断了(可能输入一半查询到后就直接选中,或者输入123,选中1234,但是control.EditText值还是123导致出错)
|
||||
if (control != null && !string.IsNullOrEmpty(control.EditText) && (string.IsNullOrEmpty(_value) || !control.EditText.Equals(this._textVlaue))&& !PopupBoxSelection)
|
||||
if (control != null && !string.IsNullOrEmpty(control.EditText) && (string.IsNullOrEmpty(_value) || !control.EditText.Equals(this._textVlaue)) && !PopupBoxSelection)
|
||||
{
|
||||
if (this.DataSource != null && this.DataSource is DataTable)
|
||||
{
|
||||
@@ -501,7 +501,7 @@ namespace Lskj.Control
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void HandPopupSqlValue(object searchText)
|
||||
public void HandPopupSqlValue(object searchText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SourceSQL))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
partial class LabelBillSourceComboxEdit
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.plLeft = new System.Windows.Forms.Panel();
|
||||
this.lblText = new System.Windows.Forms.Label();
|
||||
this.plRight = new System.Windows.Forms.Panel();
|
||||
this.txtEdit = new Lskj.Control.AutoGridLookUp();
|
||||
this.btnSource = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.plLeft.SuspendLayout();
|
||||
this.plRight.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtEdit.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// plLeft
|
||||
//
|
||||
this.plLeft.BackColor = System.Drawing.Color.Transparent;
|
||||
this.plLeft.Controls.Add(this.lblText);
|
||||
this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.plLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.plLeft.Name = "plLeft";
|
||||
this.plLeft.Size = new System.Drawing.Size(39, 20);
|
||||
this.plLeft.TabIndex = 3;
|
||||
//
|
||||
// lblText
|
||||
//
|
||||
this.lblText.AutoSize = true;
|
||||
this.lblText.Location = new System.Drawing.Point(5, 4);
|
||||
this.lblText.Name = "lblText";
|
||||
this.lblText.Size = new System.Drawing.Size(29, 12);
|
||||
this.lblText.TabIndex = 0;
|
||||
this.lblText.Text = "名称";
|
||||
//
|
||||
// plRight
|
||||
//
|
||||
this.plRight.Controls.Add(this.txtEdit);
|
||||
this.plRight.Controls.Add(this.btnSource);
|
||||
this.plRight.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plRight.Location = new System.Drawing.Point(39, 0);
|
||||
this.plRight.Name = "plRight";
|
||||
this.plRight.Size = new System.Drawing.Size(119, 20);
|
||||
this.plRight.TabIndex = 4;
|
||||
//
|
||||
// txtEdit
|
||||
//
|
||||
this.txtEdit.DataSource = null;
|
||||
this.txtEdit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtEdit.EditValue = "";
|
||||
this.txtEdit.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtEdit.Name = "txtEdit";
|
||||
this.txtEdit.Size = new System.Drawing.Size(91, 20);
|
||||
this.txtEdit.TabIndex = 38;
|
||||
//
|
||||
// btnSource
|
||||
//
|
||||
this.btnSource.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnSource.Appearance.Options.UseFont = true;
|
||||
this.btnSource.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnSource.Location = new System.Drawing.Point(91, 0);
|
||||
this.btnSource.Name = "btnSource";
|
||||
this.btnSource.Size = new System.Drawing.Size(28, 20);
|
||||
this.btnSource.TabIndex = 3
|
||||
@@ -0,0 +1,353 @@
|
||||
using DevExpress.XtraEditors;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Data;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
public partial class LabelBillSourceComboxEdit : BaseUserControl
|
||||
{
|
||||
public LabelBillSourceComboxEdit()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.TextEdit.Click += new EventHandler(TextEditClick);
|
||||
this.btnSource.Click += BtnRefresh_Click;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定ValueMember
|
||||
/// </summary>
|
||||
public string ValueMember
|
||||
{
|
||||
get { return txtEdit.ValueMember; }
|
||||
set { txtEdit.ValueMember = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 隐藏值字段
|
||||
/// </summary>
|
||||
public string ValueField
|
||||
{
|
||||
get { return txtEdit.ValueField; }
|
||||
set { txtEdit.ValueField = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示值字段
|
||||
/// </summary>
|
||||
public string TextField
|
||||
{
|
||||
get { return txtEdit.TextMember; }
|
||||
set { txtEdit.TextMember = value; }
|
||||
}
|
||||
public string FormKey
|
||||
{
|
||||
get { return txtEdit.FormKey; }
|
||||
set { txtEdit.FormKey = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 自动搜索框控件
|
||||
/// </summary>
|
||||
public AutoGridLookUp TextEdit { get { return txtEdit; } }
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
/// <value>The label.</value>
|
||||
public Label Label { get { return lblText; } }
|
||||
/// <summary>
|
||||
/// 点击后清空数据
|
||||
/// </summary>
|
||||
public bool clickAfterEmpty;
|
||||
|
||||
/// <summary>
|
||||
/// 按钮
|
||||
/// </summary>
|
||||
/// <value>The label.</value>
|
||||
public SimpleButton Button { get { return btnSource; } }
|
||||
|
||||
/// <summary>
|
||||
/// 打开来源模块
|
||||
/// </summary>
|
||||
public event EventHandler OpenDocumentSource;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按钮点击,打开 单据来源 弹出框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BtnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (OpenDocumentSource != null) OpenDocumentSource(this.EditValue, e);
|
||||
}
|
||||
|
||||
|
||||
private void TextEditClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (TextEdit.Enabled && clickAfterEmpty)
|
||||
{
|
||||
this.EditText = "";
|
||||
|
||||
this.TextEdit._popup.LookUp.EditValue = "";
|
||||
this.TextEdit.ShowPopup();
|
||||
SendKeys.Send("{Esc}");
|
||||
//this.TextEdit._popup.EditValue = "";
|
||||
//TextEdit.Text = "";
|
||||
}
|
||||
if (SystemInfo.Instance.ControlClickSelectAll)
|
||||
{
|
||||
//SendKeys.Send("^A");
|
||||
TextEdit.SelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件显示文本</pa>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="text">显示Lebel文本</param>
|
||||
public override string LabelText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblText.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblText.Text = value;
|
||||
if (FontSize > 0)
|
||||
{
|
||||
this.plLeft.Dock = DockStyle.Left;
|
||||
this.plLeft.AutoSize = false;
|
||||
this.lblText.AutoSize = false;
|
||||
this.lblText.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblText.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.txtEdit.Properties.AutoHeight = false;
|
||||
this.plLeft.Width = value.Length * GetCharWidth();
|
||||
|
||||
GetCharWidthMultilingual(this.lblText, this.lblText.Text, this.plLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.plLeft.Width = this.lblText.Width + PaddingLeft;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 字体大小
|
||||
/// </summary>
|
||||
/// <value>The size of the control.</value>
|
||||
public override float FontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.FontSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.FontSize = value;
|
||||
if (value > 0)
|
||||
{
|
||||
this.lblText.Font = new Font(this.lblText.Font.FontFamily, value);
|
||||
this.TextEdit.Font = new Font(this.TextEdit.Font.FontFamily, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件值</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
public override string EditText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.txtEdit.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.txtEdit.EditValue = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取隐藏值
|
||||
/// </summary>
|
||||
/// <value>The edit value.</value>
|
||||
public string EditValue
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtEdit.EditValue + "") && this.txtEdit.DataSourceTable != null && this.txtEdit.DataSourceTable.Rows.Count > 0 && Model != null && !string.IsNullOrEmpty(this.txtEdit.Text))
|
||||
{
|
||||
DataRow[] dataRows = this.txtEdit.DataSourceTable.Select().Where(n => n[Model.TextMember].Equals(this.txtEdit.Text)).ToArray();
|
||||
if (dataRows.Count() == 1)
|
||||
{
|
||||
return dataRows[0][Model.ValueMember] + "";
|
||||
}
|
||||
}
|
||||
return this.txtEdit.EditValue + "";
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return this.txtEdit.EditValue + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件提示文本</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>返回控件值</returns>
|
||||
public override string NullText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.txtEdit.Properties.NullValuePrompt;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
this.TextEdit.Properties.NullValuePromptShowForEmptyValue = true;
|
||||
this.TextEdit.Properties.NullValuePrompt = value;
|
||||
}
|
||||
base.NullText = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 只读文本颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the read only label.</value>
|
||||
public override bool ReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ReadOnly;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ReadOnly = value;
|
||||
|
||||
this.TextEdit.Properties.ReadOnly = value;
|
||||
this.lblText.ForeColor = value ? base.ReadOnlyLabelForceColor : Required ? base.RequiredLabelForceColor : base.DefaultLabelForceColor;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 必填文本颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the required label.</value>
|
||||
public override bool Required
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Required;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Required = value;
|
||||
if (value)
|
||||
{
|
||||
this.lblText.ForeColor = base.RequiredLabelForceColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:搜索返回ID需要单独验证是否修改</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if this instance is update; otherwise, <c>false</c>.</returns>
|
||||
public override bool IsUpdate()
|
||||
{
|
||||
return !this.Model.Text.Equals(this.EditValue, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件Model
|
||||
/// </summary>
|
||||
/// <value>The model.</value>
|
||||
public override ControlModel Model
|
||||
{
|
||||
get { return base.Model; }
|
||||
set
|
||||
{
|
||||
this.TextEdit.Model = base.Model = value;
|
||||
if (value != null && !string.IsNullOrEmpty(value.AddModuleId))
|
||||
{
|
||||
this.TextEdit.Popup.AddVisible = true;
|
||||
this.TextEdit.Popup.OnAddMouseClick += new EventHandler(Popup_OnAddMouseClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置数据源</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-26 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="dataSource">The data source.</param>
|
||||
public void SetDataSource(DataTable dataSource)
|
||||
{
|
||||
this.txtEdit.DataSource = dataSource;
|
||||
this.txtEdit.DataSourceTable = dataSource.Copy();
|
||||
// this.txtEdit.DataSourceTable = dataSource;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:添加操作后</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-04-03 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
protected void Popup_OnAddMouseClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Model == null) return;
|
||||
|
||||
string dllName = string.IsNullOrEmpty(this.Model.AddModuleSpec) ? "lskj.pubadd3.dll" : "lskj.pubadd.dll";
|
||||
|
||||
string AddModuleSpec = "SpeciesNo";
|
||||
if (!string.IsNullOrEmpty(this.Model.AddModuleSpec)) AddModuleSpec = this.Model.AddModuleSpec;
|
||||
|
||||
// 固定传入参数(窗口标题、操作员ID��
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -209,13 +209,15 @@ namespace Lskj.Control
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(fileId)) this.DownloadUrl = "";
|
||||
|
||||
// fieldValue:对应附件表fileId
|
||||
if (!string.IsNullOrEmpty(fileId))
|
||||
{
|
||||
this._isInit = isInit;
|
||||
|
||||
string relativePath = BaseModuleImpl.GetFileServerPath(fileId);
|
||||
string tempPath = Path.Combine(new string[] { PubUtil.FileDownLoadTempPath, relativePath });
|
||||
string tempPath = Path.Combine(new string[] { PubUtil.ImageDownloadPath, relativePath });
|
||||
string localPath = tempPath.Replace(Path.GetFileName(tempPath), "");
|
||||
|
||||
// 检查目录是否存在
|
||||
@@ -248,7 +250,7 @@ namespace Lskj.Control
|
||||
{
|
||||
string OAUrl = !string.IsNullOrEmpty(SystemInfo.Instance.OAUrl) && SystemInfo.Instance.OAUrl.EndsWith("/") ? SystemInfo.Instance.OAUrl : SystemInfo.Instance.OAUrl + "/";
|
||||
downUrl = OAUrl + downUrl;
|
||||
string tempPath = Path.Combine(new string[] { PubUtil.FileDownLoadTempPath, "LabelImageEditFileLoad.jpg" });
|
||||
string tempPath = Path.Combine(new string[] { PubUtil.ImageDownloadPath, "LabelImageEditFileLoad"+ Guid.NewGuid().ToString().Replace("-", "") + ".jpg" });
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(downUrl);
|
||||
request.Method = "GET";
|
||||
WebResponse response = request.GetResponse();
|
||||
@@ -313,13 +315,13 @@ namespace Lskj.Control
|
||||
if (img != null)
|
||||
{
|
||||
string fileName = prefix + "_" + Guid.NewGuid().ToString().Replace("-", "") + ".jpg";
|
||||
string tempPath = Path.Combine(new string[] { PubUtil.FileDownLoadTempPath, fileName });
|
||||
string tempPath = Path.Combine(new string[] { PubUtil.ImageDownloadPath, fileName });
|
||||
|
||||
this.CurrentImagePath = tempPath;
|
||||
// 不存在创建目录
|
||||
if (!Directory.Exists(Path.Combine(new string[] { PubUtil.FileDownLoadTempPath })))
|
||||
if (!Directory.Exists(Path.Combine(new string[] { PubUtil.ImageDownloadPath })))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(PubUtil.FileDownLoadTempPath));
|
||||
Directory.CreateDirectory(Path.Combine(PubUtil.ImageDownloadPath));
|
||||
}
|
||||
if (!File.Exists(tempPath))
|
||||
{
|
||||
@@ -348,6 +350,7 @@ namespace Lskj.Control
|
||||
try
|
||||
{
|
||||
string url = string.Format(this.DownloadUrl, ERPInfo.Instance.UserName, ERPInfo.Instance.Password, "", "0");
|
||||
if (string.IsNullOrWhiteSpace(url)) return;
|
||||
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
||||
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, "预览", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "2", "").Split('~');
|
||||
string[] menuArgs = new string[] { "", "", url };
|
||||
|
||||
Generated
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
partial class LabelPrompt
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.plLeft = new System.Windows.Forms.Panel();
|
||||
this.lblText = new System.Windows.Forms.Label();
|
||||
this.plLeft.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// plLeft
|
||||
//
|
||||
this.plLeft.BackColor = System.Drawing.Color.Transparent;
|
||||
this.plLeft.Controls.Add(this.lblText);
|
||||
this.plLeft.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.plLeft.Name = "plLeft";
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
public partial class LabelPrompt : BaseUserControl
|
||||
{
|
||||
public LabelPrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件显示文本</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="text">显示Lebel文本</param>
|
||||
public override string LabelText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblText.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblText.Text = value;
|
||||
if (FontSize > 0)
|
||||
{
|
||||
this.plLeft.Dock = DockStyle.Left;
|
||||
this.plLeft.AutoSize = false;
|
||||
this.lblText.AutoSize = false;
|
||||
this.lblText.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblText.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.plLeft.Width = value.Length * GetCharWidth();
|
||||
GetCharWidthMultilingual(this.lblText, this.lblText.Text, this.plLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
this.plLeft.AutoSize = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 字体大小
|
||||
/// </summary>
|
||||
/// <value>The size of the control.</value>
|
||||
public override float FontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.FontSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.FontSize = value;
|
||||
if (value > 0)
|
||||
{
|
||||
this.lblText.Font = new Font(this.lblText.Font.FontFamily, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 只读文本颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the read only label.</value>
|
||||
public override bool ReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ReadOnly;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.ReadOnly = value;
|
||||
this.lblText.ForeColor = value ? base.ReadOnlyLabelForceColor : Required ? base.RequiredLabelForceColor : base.DefaultLabelForceColor;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -282,7 +282,18 @@ namespace Lskj.Control.Model
|
||||
/// 刷新明细的序号(排产模块)
|
||||
/// </summary>
|
||||
public string PlanLetfControl;
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏下方操作按钮
|
||||
/// </summary>
|
||||
public bool HideBottomPanel;
|
||||
/// <summary>
|
||||
/// 隐藏下方操作按钮
|
||||
/// </summary>
|
||||
public string ChartText;
|
||||
/// <summary>
|
||||
/// 隐藏下方操作按钮
|
||||
/// </summary>
|
||||
public string ChartTextColor;
|
||||
|
||||
/// <summary>
|
||||
/// 主模块编号
|
||||
@@ -342,4 +353,7 @@ namespace Lskj.Control.Model
|
||||
this.DBClickEvent = item.Table.Columns.Contains("DBClickEvent") ? "1".Equals(item["DBClickEvent"] + "") : false;
|
||||
this.ProhibitRefresh = item.Table.Columns.Contains("ProhibitRefresh") ? "1".Equals(item["ProhibitRefresh"] + "") : false;
|
||||
this.DragExecuteSql = item.Table.Columns.Contains("DragExecuteSql") ? item["DragExecuteSql"] + "" : "";
|
||||
this.QueryAgain = item.Table.Col
|
||||
this.QueryAgain = item.Table.Columns.Contains("QueryAgain") ? "1".Equals(item["QueryAgain"] + "") : false;
|
||||
this.BottomRefreshMain = item.Table.Columns.Contains("BottomRefreshMain") ? "1".Equals(item["BottomRefreshMain"] + "") : false;
|
||||
this.LoadFilter = item.Table.Columns.Contains("LoadFilter") ? "1".Equals(item["LoadFilter"] + "") : false;
|
||||
this.
|
||||
@@ -42,6 +42,7 @@ public static class LabPicUrlPreview
|
||||
|
||||
// 唯一列名(保持你原逻辑)
|
||||
gridColumn.FieldName = string.Format("{0}{1}", model.FieldName, Guid.NewGuid());
|
||||
//gridColumn.FieldName = model.FieldName;
|
||||
gridColumn.Tag = model; // 事件里取模型
|
||||
|
||||
RepositoryItemPictureEdit pictureEdit = new RepositoryItemPictureEdit();
|
||||
@@ -167,7 +168,7 @@ public static class LabPicUrlPreview
|
||||
int listIndex = view.GetDataSourceRowIndex(rowHandle);
|
||||
try
|
||||
{
|
||||
object val2 = view.GetListSourceRowCellValue(listIndex, m.FieldName);
|
||||
object val2 = view.GetListSourceRowCellValue(listIndex, m.FieldName);// "GM_leb_TuShi_ZS"
|
||||
raw = val2 == null ? null : Convert.ToString(val2);
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
// ============================================================================
|
||||
// LabPicUrlPreview_TreeList.cs (C# 7.3 / DevExpress 15.2 兼容)
|
||||
// - 适配 TreeList:InitPicColumn / Attach / AttachPreview
|
||||
// - 复用原线程安全缓存:缩略图 & 原图分离缓存、并发限流 + LRU 清理
|
||||
// - 同步阶段写 e.Value,异步完成后刷新 TreeList 单元格或预览窗体
|
||||
// ============================================================================
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using DevExpress.Data;
|
||||
using DevExpress.XtraEditors.Controls;
|
||||
using DevExpress.XtraEditors.Repository;
|
||||
using DevExpress.XtraTreeList;
|
||||
using DevExpress.XtraTreeList.Columns;
|
||||
using DevExpress.XtraTreeList.Nodes;
|
||||
using DevExpress.XtraTreeList.ViewInfo;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Control;
|
||||
using Lskj.Business;
|
||||
|
||||
public static class LabPicUrlPreview_TreeList
|
||||
{
|
||||
// ====== 对外:初始化图片列(创建 RepositoryItemPictureEdit、设为 Unbound) ======
|
||||
public static void InitPicColumn(TreeList treeList, TreeListColumn treeListColumn, GridColumnModel model)
|
||||
{
|
||||
if (treeList == null || treeListColumn == null || model == null) return;
|
||||
|
||||
treeListColumn.AppearanceCell.Options.UseTextOptions = true;
|
||||
treeListColumn.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
|
||||
treeListColumn.OptionsColumn.AllowEdit = false;
|
||||
|
||||
// 唯一列名(保持原逻辑,避免列名重复)
|
||||
treeListColumn.FieldName = string.Format("{0}{1}", model.FieldName, Guid.NewGuid());
|
||||
treeListColumn.Tag = model; // 事件中获取列模型
|
||||
|
||||
RepositoryItemPictureEdit pictureEdit = new RepositoryItemPictureEdit();
|
||||
pictureEdit.ShowMenu = false;
|
||||
pictureEdit.NullText = " ";
|
||||
pictureEdit.SizeMode = PictureSizeMode.Zoom;
|
||||
|
||||
treeList.RepositoryItems.Add(pictureEdit);
|
||||
treeListColumn.UnboundType = DevExpress.XtraTreeList.Data.UnboundColumnType.Object;
|
||||
treeListColumn.ColumnEdit = pictureEdit;
|
||||
}
|
||||
|
||||
// ====== 对外:绑定“取缩略图”的事件(只需调用一次) ======
|
||||
public static void Attach(TreeList treeList)
|
||||
{
|
||||
if (treeList == null) return;
|
||||
treeList.CustomUnboundColumnData -= OnCustomUnboundColumnData;
|
||||
treeList.CustomUnboundColumnData += OnCustomUnboundColumnData;
|
||||
}
|
||||
|
||||
// ====== 对外:绑定“双击大图预览”的事件(只需调用一次) ======
|
||||
public static void AttachPreview(TreeList treeList)
|
||||
{
|
||||
if (treeList == null) return;
|
||||
treeList.DoubleClick -= OnTreeListDoubleClick;
|
||||
treeList.DoubleClick += OnTreeListDoubleClick;
|
||||
}
|
||||
|
||||
// ===================== 缩略图事件实现(核心改造) =====================
|
||||
private static void OnCustomUnboundColumnData(object sender, TreeListCustomColumnDataEventArgs e)
|
||||
{
|
||||
TreeList treeList = sender as TreeList;
|
||||
if (treeList == null) return;
|
||||
|
||||
GridColumnModel m = e.Column.Tag as GridColumnModel;
|
||||
if (m == null || m.FieldType != ControlType.LabPicUrl || !e.IsGetData) return;
|
||||
|
||||
// 1) TreeList 用 Node 直接定位(替代 Grid 的 RowHandle/ListSourceRowIndex)
|
||||
TreeListNode node = e.Node;
|
||||
if (node == null) return;
|
||||
|
||||
// 2) 读取原始 URL(优先 Node 数据,兜底数据源)
|
||||
string raw = null;
|
||||
try
|
||||
{
|
||||
// TreeList 直接从 Node 获取字段值(兼容绑定 DataTable/自定义对象)
|
||||
object val = node.GetValue(m.FieldName);
|
||||
raw = val == null ? null : Convert.ToString(val);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 兜底:从数据源(如 DataRow)获取
|
||||
DataRow row = node.Tag as DataRow;
|
||||
if (row != null && row.Table.Columns.Contains(m.FieldName))
|
||||
raw = Convert.ToString(row[m.FieldName]);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(raw)) return;
|
||||
|
||||
// 3) 拼接完整 URL(复用原逻辑)
|
||||
string url = ResolveFullUrl(raw);
|
||||
|
||||
// 4) 目标高度(复用原逻辑)
|
||||
int targetHeight = NormalizeHeight(m);
|
||||
|
||||
// 5) 缓存命中:同步赋值 e.Value
|
||||
Image img;
|
||||
if (ImageCache.TryGetThumb(url, targetHeight, out img))
|
||||
{
|
||||
e.Value = img;
|
||||
return;
|
||||
}
|
||||
|
||||
// 6) 未命中:异步下载,完成后刷新当前单元格(TreeList 刷新 API 改造)
|
||||
System.Windows.Forms.Control invoker = treeList; // UI 回调对象
|
||||
ImageCache.GetThumbAsync(url, targetHeight, invoker, delegate ()
|
||||
{
|
||||
RefreshCellCompat(treeList, node, e.Column);
|
||||
});
|
||||
}
|
||||
|
||||
// ===================== 双击预览(原图)(核心改造) =====================
|
||||
private static void OnTreeListDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
TreeList treeList = sender as TreeList;
|
||||
if (treeList == null) return;
|
||||
|
||||
// 1) TreeList 命中测试(替代 Grid 的 CalcHitInfo)
|
||||
TreeListHitInfo hitInfo = treeList.CalcHitInfo(treeList.PointToClient(Control.MousePosition));
|
||||
//if (hitInfo == null || !hitInfo.InNodeCell || hitInfo.Column == null) return;
|
||||
if (hitInfo == null || hitInfo.HitInfoType != HitInfoType.Cell || hitInfo.Node == null || hitInfo.Column == null) return;
|
||||
TreeListNode hitNode = hitInfo.Node;
|
||||
TreeListColumn hitColumn = hitInfo.Column;
|
||||
|
||||
// 2) 只处理 LabPicUrl 类型列
|
||||
GridColumnModel m = hitColumn.Tag as GridColumnModel;
|
||||
if (m == null || m.FieldType != ControlType.LabPicUrl) return;
|
||||
|
||||
// 3) 读取当前 Node 的 URL(TreeList 专属取值逻辑)
|
||||
string raw = null;
|
||||
try
|
||||
{
|
||||
object val = hitNode.GetValue(m.FieldName);
|
||||
raw = val == null ? null : Convert.ToString(val);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 兜底:从 Node.Tag(如 DataRow)获取
|
||||
DataRow row = hitNode.Tag as DataRow;
|
||||
if (row != null && row.Table.Columns.Contains(m.FieldName))
|
||||
raw = Convert.ToString(row[m.FieldName]);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(raw)) return;
|
||||
|
||||
string url = ResolveFullUrl(raw);
|
||||
|
||||
// 4) 打开预览窗体(复用原逻辑,适配 TreeList 数据)
|
||||
Image thumb = null;
|
||||
ImageCache.TryGetThumb(url, NormalizeHeight(m), out thumb);
|
||||
|
||||
FrmTreePicture frm = new FrmTreePicture();
|
||||
try
|
||||
{
|
||||
// 适配 TreeList 列与节点数据(替换原 Grid 的 Column/Row)
|
||||
frm.PicUrlColumns = treeList.Columns.Where(c => c.Tag is GridColumnModel cm && cm.FieldType == ControlType.LabPicUrl).ToList(); // 兼容原窗体列集合类型
|
||||
frm.FocusedRow = hitNode.Tag as DataRow; // 传递 Node 绑定的 DataRow
|
||||
frm.FocusedColumn = hitColumn;
|
||||
frm.Text = "预览";
|
||||
frm.Picture = thumb;
|
||||
frm.WindowState = FormWindowState.Maximized;
|
||||
frm.StartPosition = FormStartPosition.CenterScreen;
|
||||
|
||||
// 异步拉取原图并更新(复用原缓存逻辑)
|
||||
ImageCache.GetFullAsync(url, frm, delegate (Image full)
|
||||
{
|
||||
if (full == null) return;
|
||||
try
|
||||
{
|
||||
if (!frm.IsDisposed) frm.Picture = full;
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
|
||||
frm.ShowDialog();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (frm != null && !frm.IsDisposed) frm.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// ====== TreeList 单元格安全刷新(替代 Grid 的 RefreshRowCell) ======
|
||||
private static void RefreshCellCompat(TreeList treeList, TreeListNode node, TreeListColumn column)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (treeList.IsDisposed || node == null || column == null) return;
|
||||
// 整体刷新节点(避免单个单元格刷新失败)
|
||||
if (!treeList.IsDisposed && node != null)
|
||||
treeList.RefreshNode(node);
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
// 刷新整个 TreeList(极端情况)
|
||||
if (!treeList.IsDisposed)
|
||||
treeList.RefreshDataSource();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====== 以下方法完全复用原逻辑(无改造) ======
|
||||
private static int NormalizeHeight(object model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var t = model.GetType();
|
||||
|
||||
// 读取属性
|
||||
var pi = t.GetProperty("LabPicUrlHeight");
|
||||
if (pi != null)
|
||||
{
|
||||
int v = Convert.ToInt32(pi.GetValue(model, null));
|
||||
return v <= 18 ? 30 : v;
|
||||
}
|
||||
|
||||
// 读取无参方法
|
||||
var mi = t.GetMethod("LabPicUrlHeight", Type.EmptyTypes);
|
||||
if (mi != null)
|
||||
{
|
||||
int v = Convert.ToInt32(mi.Invoke(model, null));
|
||||
return v <= 18 ? 30 : v;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return 30;
|
||||
}
|
||||
|
||||
private static string ResolveFullUrl(string raw)
|
||||
{
|
||||
if (string.IsNullOrEmpty(raw)) return raw;
|
||||
if (raw.StartsWith("http", StringComparison.OrdinalIgnoreCase)) return raw;
|
||||
|
||||
try
|
||||
{
|
||||
string oa = SystemInfo.Instance.OAUrl;
|
||||
if (string.IsNullOrEmpty(oa)) return raw.TrimStart('/');
|
||||
if (!oa.EndsWith("/")) oa += "/";
|
||||
return oa + raw.TrimStart('/');
|
||||
}
|
||||
catch
|
||||
{
|
||||
return raw.TrimStart('/');
|
||||
}
|
||||
}
|
||||
|
||||
// ====== 图片缓存(完全复用原逻辑,无任何改造) ======
|
||||
private static class ImageCache
|
||||
{
|
||||
// —— 公共接口(缩略图) ——
|
||||
public static bool TryGetThumb(string url, int targetHeight, out Image img)
|
||||
{
|
||||
return ThumbCache.TryGet(url, targetHeight, out img);
|
||||
}
|
||||
public static void GetThumbAsync(string url, int targetHeight, System.Windows.Forms.Control invoker, Action onReady)
|
||||
{
|
||||
ThumbCache.GetOrCreateAsync(url, targetHeight, invoker, onReady);
|
||||
}
|
||||
|
||||
// —— 公共接口(原图) ——
|
||||
public static bool TryGetFull(string url, out Image img)
|
||||
{
|
||||
return FullCache.TryGet(url, out img);
|
||||
}
|
||||
public static void GetFullAsync(string url, System.Windows.Forms.Control invoker, Action<Image> onReady)
|
||||
{
|
||||
FullCache.GetOrCreateAsync(url, invoker, onReady);
|
||||
}
|
||||
|
||||
// ===== 缩略图缓存实现 =====
|
||||
private static class ThumbCache
|
||||
{
|
||||
private class CacheEntry
|
||||
{
|
||||
public Image Image;
|
||||
public DateTime LastHitUtc;
|
||||
}
|
||||
|
||||
private static readonly object _lock = new object();
|
||||
private static readonly Dictionary<string, CacheEntry> _cache =
|
||||
new Dictionary<string, CacheEntry>(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly Dictionary<string, Task<Image>> _tasks =
|
||||
new Dictionary<string, Task<Image>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static readonly Semaphore _throttle = new Semaphore(4, 4); // 并发 4
|
||||
private const int Capacity = 300;
|
||||
|
||||
static ThumbCache()
|
||||
{
|
||||
EnableTls12();
|
||||
}
|
||||
|
||||
private static string MakeKey(string url, int h)
|
||||
{
|
||||
return url + "#h=" + h.ToString();
|
||||
}
|
||||
|
||||
public static bool TryGet(string url, int targetHeight, out Image image)
|
||||
{
|
||||
string key = MakeKey(url, targetHeight);
|
||||
lock (_lock)
|
||||
{
|
||||
CacheEntry e;
|
||||
if (_cache.TryGetValue(key, out e) && e != null && e.Image != null)
|
||||
{
|
||||
e.LastHitUtc = DateTime.UtcNow;
|
||||
_cache[key] = e;
|
||||
image = e.Image;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
image = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void GetOrCreateAsync(string url, int targetHeight, System.Windows.Forms.Control uiInvoker, Action onReady)
|
||||
{
|
||||
string key = MakeKey(url, targetHeight);
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
if (_cache.ContainsKey(key))
|
||||
{
|
||||
BeginInvokeSafe(uiInvoker, onReady);
|
||||
return;
|
||||
}
|
||||
|
||||
Task<Image> exist;
|
||||
if (_tasks.TryGetValue(key, out exist))
|
||||
{
|
||||
exist.ContinueWith(delegate { BeginInvokeSafe(uiInvoker, onReady); }, TaskScheduler.Default);
|
||||
return;
|
||||
}
|
||||
|
||||
Task<Image> task = Task.Factory.StartNew<Image>(delegate
|
||||
{
|
||||
_throttle.WaitOne();
|
||||
try
|
||||
{
|
||||
byte[] bytes = DownloadBytes(url);
|
||||
if (bytes == null) return null;
|
||||
using (Bitmap src = BytesToBitmap(bytes))
|
||||
{
|
||||
return ScaleBitmap(src, targetHeight);
|
||||
}
|
||||
}
|
||||
catch { return null; }
|
||||
finally { try { _throttle.Release(); } catch { } }
|
||||
}, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).ContinueWith<Image>(delegate (Task<Image> t)
|
||||
{
|
||||
Image result = t.Result;
|
||||
lock (_lock)
|
||||
{
|
||||
_tasks.Remove(key);
|
||||
if (result != null)
|
||||
{
|
||||
_cache[key] = new CacheEntry { Image = result, LastHitUtc = DateTime.UtcNow };
|
||||
TrimIfNeededUnsafe();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, TaskScheduler.Default);
|
||||
|
||||
_tasks[key] = task;
|
||||
task.ContinueWith(delegate { BeginInvokeSafe(uiInvoker, onReady); }, TaskScheduler.Default);
|
||||
}
|
||||
}
|
||||
|
||||
private static void TrimIfNeededUnsafe()
|
||||
{
|
||||
if (_cache.Count <= Capacity) return;
|
||||
List<KeyValuePair<string, CacheEntry>> list = _cache.ToList();
|
||||
list.Sort(delegate (KeyValuePair<string, CacheEntry> a, KeyValuePair<string, CacheEntry> b)
|
||||
{
|
||||
return a.Value.LastHitUtc.CompareTo(b.Value.LastHitUtc);
|
||||
});
|
||||
int removeCount = Math.Max(1, Capacity / 10);
|
||||
for (int i = 0; i < removeCount && i < list.Count; i++)
|
||||
{
|
||||
string k = list[i].Key;
|
||||
CacheEntry e;
|
||||
if (_cache.TryGetValue(k, out e))
|
||||
{
|
||||
_cache.Remove(k);
|
||||
try { if (e.Image != null) e.Image.Dispose(); } catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 原图缓存实现(容量更小) =====
|
||||
private static class FullCache
|
||||
{
|
||||
private class CacheEntry
|
||||
{
|
||||
public Image Image;
|
||||
public DateTime LastHitUtc;
|
||||
}
|
||||
|
||||
private static readonly object _lock = new object();
|
||||
private static readonly Dictionary<string, CacheEntry> _cache =
|
||||
new Dictionary<string, CacheEntry>(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly Dictionary<string, Task<Image>> _tasks =
|
||||
new Dictionary<string, Task<Image>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static readonly Semaphore _throttle = new Semaphore(2, 2); // 原图并发更小
|
||||
private const int Capacity = 50;
|
||||
|
||||
static FullCache()
|
||||
{
|
||||
EnableTls12();
|
||||
}
|
||||
|
||||
public static bool TryGet(string url, out Image image)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
CacheEntry e;
|
||||
if (_cache.TryGetValue(url, out e) && e != null && e.Image != null)
|
||||
{
|
||||
e.LastHitUtc = DateTime.UtcNow;
|
||||
_cache[url] = e;
|
||||
image = e.Image;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
image = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void GetOrCreateAsync(string url, System.Windows.Forms.Control uiInvoker, Action<Image> onReady)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
Image cached;
|
||||
if (TryGet(url, out cached))
|
||||
{
|
||||
BeginInvokeSafe(uiInvoker, delegate { onReady(cached); });
|
||||
return;
|
||||
}
|
||||
|
||||
Task<Image> exist;
|
||||
if (_tasks.TryGetValue(url, out exist))
|
||||
{
|
||||
exist.ContinueWith(t => BeginInvokeSafe(uiInvoker, delegate { onReady(t.Result); }), TaskScheduler.Default);
|
||||
return;
|
||||
}
|
||||
|
||||
Task<Image> task = Task.Factory.StartNew<Image>(delegate
|
||||
{
|
||||
_throttle.WaitOne();
|
||||
try
|
||||
{
|
||||
byte[] bytes = DownloadBytes(url);
|
||||
if (bytes == null) return null;
|
||||
using (Bitmap bmp = BytesToBitmap(bytes))
|
||||
{
|
||||
return CopyBitmap(bmp);
|
||||
}
|
||||
}
|
||||
catch { return null; }
|
||||
finally { try { _throttle.Release(); } catch { } }
|
||||
}, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).ContinueWith<Image>(delegate (Task<Image> t)
|
||||
{
|
||||
Image result = t.Result;
|
||||
lock (_lock)
|
||||
{
|
||||
_tasks.Remove(url);
|
||||
if (result != null)
|
||||
{
|
||||
_cache[url] = new CacheEntry { Image = result, LastHitUtc = DateTime.UtcNow };
|
||||
TrimIfNeededUnsafe();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, TaskScheduler.Default);
|
||||
|
||||
_tasks[url] = task;
|
||||
task.ContinueWith(t => BeginInvokeSafe(uiInvoker, delegate { onReady(t.Result); }), TaskScheduler.Default);
|
||||
}
|
||||
}
|
||||
|
||||
private static void TrimIfNeededUnsafe()
|
||||
{
|
||||
if (_cache.Count <= Capacity) return;
|
||||
List<KeyValuePair<string, CacheEntry>> list = _cache.ToList();
|
||||
list.Sort(delegate (KeyValuePair<string, CacheEntry> a, KeyValuePair<string, CacheEntry> b)
|
||||
{
|
||||
return a.Value.LastHitUtc.CompareTo(b.Value.LastHitUtc);
|
||||
});
|
||||
int removeCount = Math.Max(1, Capacity / 10);
|
||||
for (int i = 0; i < removeCount && i < list.Count; i++)
|
||||
{
|
||||
string k = list[i].Key;
|
||||
CacheEntry e;
|
||||
if (_cache.TryGetValue(k, out e))
|
||||
{
|
||||
_cache.Remove(k);
|
||||
try { if (e.Image != null) e.Image.Dispose(); } catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 共享底层工具 =====
|
||||
private static void EnableTls12()
|
||||
{
|
||||
try
|
||||
{
|
||||
const System.Security.Authentication.SslProtocols _Tls12 =
|
||||
(System.Security.Authentication.SslProtocols)0x00000C00;
|
||||
ServicePointManager.SecurityProtocol |= (SecurityProtocolType)_Tls12;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static byte[] DownloadBytes(string url)
|
||||
{
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
return wc.DownloadData(url);
|
||||
}
|
||||
}
|
||||
|
||||
private static Bitmap BytesToBitmap(byte[] bytes)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(bytes))
|
||||
{
|
||||
using (Image img = Image.FromStream(ms))
|
||||
{
|
||||
return new
|
||||
@@ -34,6 +34,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -102,7 +104,7 @@ namespace Lskj.Control.Model
|
||||
bool existLabWWW = false;
|
||||
if (view is GridControlEx)
|
||||
{
|
||||
GridControlEx grid= view as GridControlEx;
|
||||
GridControlEx grid = view as GridControlEx;
|
||||
foreach (GridColumn item in grid.GridView.Columns)
|
||||
{
|
||||
if (item.Tag is GridColumnModel)
|
||||
@@ -115,7 +117,7 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
|
||||
|
||||
if (((table == null || table.Rows.Count == 0) && menu == null)&& !existLabWWW) return;
|
||||
if (((table == null || table.Rows.Count == 0) && menu == null) && !existLabWWW) return;
|
||||
|
||||
ContextMenuStrip cmsMenu = new ContextMenuStrip();
|
||||
cmsMenu.Opening += new CancelEventHandler(MenuStripOpening);
|
||||
@@ -284,7 +286,10 @@ namespace Lskj.Control.Model
|
||||
MessageUtil.Show(string.Format(ResourceKeys.ExecRightMenuOnlyOne, model.MenuName));
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.AllowNullExec && rowArray.Length == 0)
|
||||
{
|
||||
rowArray = new DataRow[] { new DataTable().NewRow() };
|
||||
}
|
||||
if (rowArray.Length == 0 && model.IsMustSelectRow())
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.SelectRowIsNull);
|
||||
@@ -343,7 +348,7 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(!string.IsNullOrEmpty(model.UnionZTid))ToDBatching(AccountItem, AccountItem);
|
||||
if (!string.IsNullOrEmpty(model.UnionZTid)) ToDBatching(AccountItem, AccountItem);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -530,9 +535,58 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
// 特殊处理程序
|
||||
else if (dllName.Contains(".exe") && !model.WipeExes.Contains(dllName.ToString()) && (dllName.ToLower() != "lstest.exe"))
|
||||
{
|
||||
//WinHelper.WinExec(File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName, 1);
|
||||
// WinHelper.WinExec(dllName);
|
||||
string[] dllNameSplit = Regex.Split(dllName, ":args=");
|
||||
string[] pmsSplit = dllNameSplit.Length > 1 ? (dllNameSplit[1] + "").Split(',') : null;
|
||||
if (dllNameSplit.Length > 1 && pmsSplit != null && pmsSplit.Length > 0)//嵌入exe模块
|
||||
{
|
||||
string[] pmsArgs = pmsSplit.Select(pms => ReplaceHelper.ReplaceUserInfo(pms)).ToArray();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
Panel mainPanel = new Panel();
|
||||
ProcessStartInfo processStartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = dllNameSplit[0],
|
||||
Arguments = HandleHelper.CombineArgs(pmsArgs),
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = false,
|
||||
RedirectStandardError = false,
|
||||
CreateNoWindow = false
|
||||
};
|
||||
Process startedProcess = Process.Start(processStartInfo);
|
||||
if (startedProcess == null)
|
||||
{
|
||||
MessageUtil.Show("进程启动失败");
|
||||
return false;
|
||||
}
|
||||
startedProcess.WaitForInputIdle();
|
||||
int retry = 0;
|
||||
while (startedProcess.MainWindowHandle == IntPtr.Zero && retry < 500)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
startedProcess.Refresh();
|
||||
retry++;
|
||||
}
|
||||
IntPtr exeMainHandle = startedProcess.MainWindowHandle;
|
||||
if (exeMainHandle == IntPtr.Zero)
|
||||
{
|
||||
MessageBox.Show("无法获取启动程序的主窗口句柄");
|
||||
return false;
|
||||
}
|
||||
HandleHelper.SetFormNoneStyle(exeMainHandle, mainPanel);
|
||||
mainPanel.Dock = DockStyle.Fill;
|
||||
using (BaseForm baseForm = new BaseForm())
|
||||
{
|
||||
baseForm.WindowState = FormWindowState.Maximized;
|
||||
baseForm.Controls.Add(mainPanel);
|
||||
baseForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//删除选中行的json信息
|
||||
if(!string.IsNullOrWhiteSpace(maintabFocusedRowJson))paramList.Remove(maintabFocusedRowJson);
|
||||
if (!string.IsNullOrWhiteSpace(maintabFocusedRowJson)) paramList.Remove(maintabFocusedRowJson);
|
||||
// 创建进程启动信息对象
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName; // 指定要启动的 EXE 路径
|
||||
@@ -549,7 +603,7 @@ namespace Lskj.Control.Model
|
||||
|
||||
// 执行exe程序
|
||||
//WinHelper.WinExec(File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName, 1);
|
||||
|
||||
}
|
||||
}
|
||||
else if (dllName.StartsWith("www.") ||
|
||||
dllName.StartsWith("http://") ||
|
||||
@@ -580,7 +634,7 @@ namespace Lskj.Control.Model
|
||||
switch (model.ActionType)
|
||||
{
|
||||
case 1: // 执行存储过程
|
||||
if (i == rows.Length - 1 || execOnlyOne )
|
||||
if (i == rows.Length - 1 || execOnlyOne)
|
||||
{
|
||||
//执行最后一条
|
||||
FinallySucceeded = true;
|
||||
@@ -633,7 +687,12 @@ namespace Lskj.Control.Model
|
||||
return resultValue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导入数据或者反写到界面
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="paramList"></param>
|
||||
/// <returns></returns>
|
||||
public bool OpenFrmcCover(GridRightMenuModel model, List<string> paramList)
|
||||
{
|
||||
|
||||
@@ -651,7 +710,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
//模式2,保存到数据库中,在执行保存后sql
|
||||
importIntoDatabase = true;
|
||||
if (string.IsNullOrWhiteSpace(paramList[1]) )
|
||||
if (string.IsNullOrWhiteSpace(paramList[1]))
|
||||
{
|
||||
MessageUtil.Show("模块编号未配置");
|
||||
return false;
|
||||
@@ -660,15 +719,41 @@ namespace Lskj.Control.Model
|
||||
|
||||
|
||||
string primaryKey = paramList[2];
|
||||
FrmCover frmCover = new FrmCover(importIntoDatabase,paramList[1], paramList[2], paramList[3]);
|
||||
if (frmCover.ShowDialog() == DialogResult.OK&& !importIntoDatabase)
|
||||
FrmCover frmCover = new FrmCover(importIntoDatabase, paramList[1], paramList[2], paramList[3]);
|
||||
if (frmCover.ShowDialog() == DialogResult.OK && !importIntoDatabase)
|
||||
{
|
||||
//反写数据源
|
||||
DataTable ReverseData = frmCover.ReverseData;
|
||||
//外部数据
|
||||
DataTable table = GetDataTable();
|
||||
|
||||
// 2. 筛选出 ReverseData 和 table 中名称和数据类型都相同的列(排除主键列,避免重复赋值)
|
||||
|
||||
// 提取 ReverseData 中所有的主键值
|
||||
HashSet<object> reversePrimaryKeys = new HashSet<object>(
|
||||
ReverseData.AsEnumerable()
|
||||
.Select(dr => dr[primaryKey])
|
||||
.Where(val => val != DBNull.Value && val != null)
|
||||
);
|
||||
// 获取table中,没有更新的行(在ReverseData中没有对应主键)
|
||||
IEnumerable<DataRow> noUpdateRows = table.AsEnumerable()
|
||||
.Where(dr => dr[primaryKey] != DBNull.Value && dr[primaryKey] != null
|
||||
&& !reversePrimaryKeys.Contains(dr[primaryKey]));
|
||||
//提示存在没有更新的行
|
||||
if (noUpdateRows.Any())
|
||||
{
|
||||
// 提示没有反写的数据
|
||||
string noUpdateIds = string.Join("、", noUpdateRows.Select(dr => dr[primaryKey].ToString()));
|
||||
string text = string.Format("有 {0} 条数据未更新,主键为:{1} \r\n请确认是否要继续", noUpdateRows.Count(), noUpdateIds);
|
||||
DialogResult result = MessageUtil.Show(text, MessageBoxButtons.YesNo);
|
||||
if (result != DialogResult.Yes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//筛选出 ReverseData 和 table 中名称和数据类型都相同的列(排除主键列,避免重复赋值)
|
||||
var commonColumns = ReverseData.Columns.Cast<DataColumn>()
|
||||
.Where(col1 => col1.ColumnName != primaryKey // 跳过 id 列(无需更新)
|
||||
&& table.Columns.Contains(col1.ColumnName) // 列名存在于 table2
|
||||
@@ -691,7 +776,7 @@ namespace Lskj.Control.Model
|
||||
continue; // 跳过 id 为空的行
|
||||
|
||||
// 在 table2 中查找 id 匹配的行(使用 Select 方法快速定位)
|
||||
DataRow[] matchedRows = table.Select($""+ primaryKey + " = '"+ idValue + "'");
|
||||
DataRow[] matchedRows = table.Select($"" + primaryKey + " = '" + idValue + "'");
|
||||
|
||||
// 只处理找到唯一匹配行的情况
|
||||
if (matchedRows.Length == 1)
|
||||
@@ -855,9 +940,9 @@ namespace Lskj.Control.Model
|
||||
catch (Exception)
|
||||
{
|
||||
result = 0;
|
||||
if (result==0 )
|
||||
if (result == 0)
|
||||
{
|
||||
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag );
|
||||
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -1011,7 +1096,7 @@ namespace Lskj.Control.Model
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
private bool ExecDynamicLinkLibary(GridRightMenuModel model, List<string> paramList, string dllName, bool isAddPage = false,DataRow rowData = null)
|
||||
private bool ExecDynamicLinkLibary(GridRightMenuModel model, List<string> paramList, string dllName, bool isAddPage = false, DataRow rowData = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(dllName))
|
||||
{
|
||||
@@ -1214,7 +1299,8 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
form.SubForm.Show();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
form.SubForm.ShowDialog();
|
||||
StaticControl.DogVerifyNoPageForms.Remove(form);
|
||||
form.SubForm.Dispose();
|
||||
@@ -1289,7 +1375,7 @@ namespace Lskj.Control.Model
|
||||
bool isOpenvisble = rows.Count() > 0;
|
||||
string parmaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode);//获取主键
|
||||
//string detailparmaryKey = parmaryKey;
|
||||
List <GridDetailModel> details = GetDetails(Model.ModuleCode);//捕获所有明细 // 2. 筛选出 “关联下载” 的明细
|
||||
List<GridDetailModel> details = GetDetails(Model.ModuleCode);//捕获所有明细 // 2. 筛选出 “关联下载” 的明细
|
||||
List<GridDetailModel> downloadRelated = details
|
||||
.Where(d => d.IsDownloadRelated) // 只保留 IsDownloadRelated 为 true 的项
|
||||
.ToList();
|
||||
@@ -1423,7 +1509,8 @@ namespace Lskj.Control.Model
|
||||
MessageUtil.Show("未配置关联明细数据");
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
MessageUtil.Show("没有需要下载的数据");
|
||||
}
|
||||
@@ -1446,7 +1533,7 @@ namespace Lskj.Control.Model
|
||||
List<SqlParameter> sqlParamList = new List<SqlParameter>();
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
SqlParameter pComfirmFlag = new SqlParameter("@comfirmFlag", SqlDbType.Int);
|
||||
paramList = model.Mergeexec? paramList:this.HandleRightMenuParams(model.ParamList,dataRow, null, model.ActionType);
|
||||
paramList = model.Mergeexec ? paramList : this.HandleRightMenuParams(model.ParamList, dataRow, null, model.ActionType);
|
||||
for (int i = 0; i < paramStr.Length; i++)
|
||||
{
|
||||
string item = paramStr[i];
|
||||
@@ -1588,7 +1675,7 @@ namespace Lskj.Control.Model
|
||||
/// <param name="model">The model.</param>
|
||||
/// <param name="rowItem">The row item.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
protected string GetSearchSql(GridDetailModel model, DataRow rowItem,string ParmaryKey)
|
||||
protected string GetSearchSql(GridDetailModel model, DataRow rowItem, string ParmaryKey)
|
||||
{
|
||||
string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : ParmaryKey;
|
||||
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
|
||||
@@ -1972,28 +2059,4 @@ namespace Lskj.Control.Model
|
||||
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
||||
if (dataRows.Length == 0)
|
||||
{
|
||||
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
|
||||
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) NOT NULL,{0})";
|
||||
string createCol = string.Empty;
|
||||
foreach (KeyValuePair<string, string> colunmField in colDic)
|
||||
{
|
||||
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
||||
}
|
||||
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
||||
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string a
|
||||
@@ -327,6 +327,12 @@ namespace Lskj.Control.Model
|
||||
/// 页签名称(审核模块以页签形式打开,可以配置单据id)
|
||||
/// </summary>
|
||||
public string PageName;
|
||||
/// <summary>
|
||||
/// 右键菜单是否可用条件2(单据模块中使用。点击时实时判断主键控件是否满足条件,MenuCond之前写成了重置按钮时根据主表判断是否可以交互。)
|
||||
/// </summary>
|
||||
/// <value>The menu cond.</value>
|
||||
public string ClickCond;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 需要单独处理的exe程序
|
||||
@@ -451,4 +457,5 @@ namespace Lskj.Control.Model
|
||||
if (item.Table.Columns.Contains("DuringExecutionMinimize"))
|
||||
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
|
||||
if (item.Table.Columns.Contains("SqlDirectExecution"))
|
||||
this.SqlDirectExecution = string.IsNullOrWhi
|
||||
this.SqlDirectExecution = string.IsNullOrWhiteSpace(item["SqlDirectExecution"] + "") ? false : "1".Equals(item["SqlDirectExecution"] + "");
|
||||
if (item
|
||||
@@ -156,7 +156,10 @@ namespace Lskj.Control.Model
|
||||
///单据特殊模块id(单据来源控件)
|
||||
/// </summary>
|
||||
public string BillSourceControlId = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
///特殊左侧表
|
||||
/// </summary>
|
||||
public GridControlEx SpecialLeftTable;
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询之前验证
|
||||
@@ -859,6 +862,10 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
return BaseImpl.GetDefaultValue(item["defaultValue"] + "", ParentKey, OtherParams);
|
||||
}));
|
||||
Task<string> LookupSqlTask = cachesDic.AddTask(item, "LookupSql", new Task<string>(() =>
|
||||
{
|
||||
return BaseImpl.SpecialReplacement(item["lookupSql"] + "", OtherParams);
|
||||
}));
|
||||
Task<ControlModel> controlModelTask = cachesDic.AddTask(item, "ControlModel", new Task<ControlModel>(() =>
|
||||
{
|
||||
ControlModel controlModel = GetControlModel(item);//获取控件对象
|
||||
@@ -1255,6 +1262,10 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
return BaseImpl.GetDefaultValue(item["defaultValue"] + "", ParentKey, OtherParams);
|
||||
}));
|
||||
Task<string> LookupSqlTask = cachesDic.AddTask(item, "LookupSql", new Task<string>(() =>
|
||||
{
|
||||
return BaseImpl.SpecialReplacement(item["lookupSql"] + "", OtherParams);
|
||||
}));
|
||||
Task<ControlModel> controlModelTask = cachesDic.AddTask(item, "ControlModel", new Task<ControlModel>(() =>
|
||||
{
|
||||
ControlModel controlModel = GetControlModel(item);//获取控件对象
|
||||
@@ -1693,7 +1704,7 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
/// <param name="rowItem">The row item.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public void CopyControlValue(bool refreshSearchSource = false)
|
||||
public void CopyControlValue(bool Association = true,bool refreshSearchSource = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1759,6 +1770,8 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
}
|
||||
|
||||
if (Association)
|
||||
{
|
||||
foreach (ControlModel model in this.ControlModels)
|
||||
{
|
||||
BaseUserControl control = FindControl(model);
|
||||
@@ -1769,6 +1782,8 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//MessageUtil.Show("拷贝控件值出错!" + ex);
|
||||
@@ -4018,7 +4033,14 @@ namespace Lskj.Control.Model
|
||||
model.Sign = item.Table.Columns.Contains("TM_tagID") && !string.IsNullOrEmpty(item["TM_tagID"] + "") ? Convert.ToInt32(item["TM_tagID"] + "") : 0;
|
||||
model.TextMember = item["lookupResult"] + "";
|
||||
model.ValueMember = item["lookupKeyField"] + "";
|
||||
model.SourceSql = item["lookupSql"] + "";
|
||||
|
||||
|
||||
if (!dataCaches.GetValue(item, "LookupSql", out string lookupSql))
|
||||
{
|
||||
lookupSql=BaseImpl.SpecialReplacement(item["lookupSql"] + "",OtherParams);
|
||||
}
|
||||
//model.SourceSql = item["lookupSql"] + "";
|
||||
model.SourceSql = lookupSql;
|
||||
model.NullText = item.Table.Columns.Contains("InputHintText") ? item["InputHintText"] + "" : string.Empty;
|
||||
model.TabOrder = item.Table.Columns.Contains("TabOrder") && !string.IsNullOrEmpty(item["TabOrder"] + "") ? Convert.ToInt32(item["TabOrder"] + "") : 0;
|
||||
model.CalcExpr = item.Table.Columns.Contains("CalcExpr") ? item["CalcExpr"] + "" : string.Empty;
|
||||
@@ -4186,6 +4208,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
dateEdit.TextEdit.Properties.VistaCalendarViewStyle = DevExpress.XtraEditors.VistaCalendarViewStyle.YearView;
|
||||
}
|
||||
|
||||
baseControl = dateEdit;
|
||||
break;
|
||||
case ControlType.LabComboxValue:
|
||||
@@ -5459,6 +5482,24 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
|
||||
}
|
||||
if (SpecialLeftTable != null)
|
||||
{
|
||||
GridView gridview = SpecialLeftTable.GridControl.DefaultView as GridView;
|
||||
DataRow rowItem = gridview.GetFocusedDataRow();
|
||||
if (rowItem != null)
|
||||
{
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
|
||||
}
|
||||
if (SpecialLeftTable is TreeGridControlEx)
|
||||
{
|
||||
rowItem = SpecialLeftTable.GetViewFocusedDataRow();
|
||||
if (rowItem != null)
|
||||
{
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ReplaceHelper.ReplaceWhereCond(sqlValue) + WhereCond;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -49,4 +49,5 @@ namespace Lskj.Control.Model
|
||||
public static KeyValuePair<string, GridControlEx> AddParentGrid = new KeyValuePair<string, GridControlEx>();
|
||||
/// <summary>
|
||||
/// 当前右键点击时的表格
|
||||
/// </summa
|
||||
/// </summary>
|
||||
public static GridView _
|
||||
@@ -340,7 +340,7 @@ namespace Lskj.Control
|
||||
this.ModuleGridDetailObj.Parent = pl_left;
|
||||
}
|
||||
//多表头向左侧表拖动数据
|
||||
if (Model.HasOperPrivilege() && model.IsBaseModule && !this.SysModel.IsTreeTable && this.ModuleGridObj.GridControlObj.GridView is BandedGridView)
|
||||
if (Model.HasOperPrivilege() && model.IsBaseModule && !this.SysModel.IsTreeTable && this.ModuleGridObj.GridControlObj.GridView is BandedGridView&&(this.SysModel.MenuType==2 || this.SysModel.MenuType==5))
|
||||
{
|
||||
// 有权限则允许拖拽
|
||||
BandedGridDragGrid BandedDragGrid = new BandedGridDragGrid(this.ModuleGridObj.GridControlObj.GridView as BandedGridView, this.gridLeft.GridView);
|
||||
|
||||
@@ -192,6 +192,7 @@ namespace Lskj.Control
|
||||
// 初始化底部多标签
|
||||
this.InitializePages();
|
||||
}
|
||||
|
||||
Console.WriteLine(DateTime.Now);
|
||||
//tcButtom.TabControlObj.ShowTabHeader = tcButtom.TabControlObj.TabPages.Count == 1 ? DefaultBoolean.False : DefaultBoolean.Default;
|
||||
}
|
||||
@@ -206,7 +207,6 @@ namespace Lskj.Control
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
//throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -333,6 +333,19 @@ namespace Lskj.Control
|
||||
string htight = IniHelper.Read(string.Format("base_height_{0}", this.Model.ModuleCode));
|
||||
if (!string.IsNullOrEmpty(htight))
|
||||
{
|
||||
//if (this.InvokeRequired)
|
||||
//{
|
||||
// this.BeginInvoke(new Action(() =>
|
||||
// {
|
||||
// this.scc_container.SplitterPosition = Convert.ToInt32(htight);
|
||||
// }));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// this.scc_container.SplitterPosition = Convert.ToInt32(htight);
|
||||
//}
|
||||
|
||||
|
||||
this.scc_container.SplitterPosition = Convert.ToInt32(htight);
|
||||
}
|
||||
}
|
||||
@@ -796,6 +809,14 @@ namespace Lskj.Control
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.IsChart&& !string.IsNullOrWhiteSpace(model.ChartText))
|
||||
{
|
||||
ChartControlEx controlEx = tabPage.Tag as ChartControlEx;
|
||||
controlEx.SetTitle(ReplaceHelper.ReplaceRowParam(rowItem, model.ChartText), model.ChartTextColor);
|
||||
}
|
||||
|
||||
|
||||
string searchSql = this.GetSearchSql(model, rowItem);
|
||||
//if (moduleGridEx != null&& moduleGridEx.SearchObj!=null)
|
||||
//{
|
||||
@@ -912,10 +933,13 @@ namespace Lskj.Control
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(row, sqlValue);
|
||||
}
|
||||
// ① 先拿普通 GridView 的焦点列(始终会有)
|
||||
|
||||
GridColumn fixColumn = this.ModuleGridObj.GridControlObj.GridView.FocusedColumn;
|
||||
string columnCaption = fixColumn?.Caption ?? string.Empty;
|
||||
|
||||
|
||||
|
||||
string columnCaption = fixColumn?.Caption ?? string.Empty;
|
||||
string subColumnCaption = string.Empty;
|
||||
string Columnvalue= string.Empty;
|
||||
/* ② 如果启用了多表头(CustomGroupBandEx),
|
||||
* 尝试用 BandedGridColumn.OwnerBand 获取 Band 标题 */
|
||||
if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null)
|
||||
@@ -936,6 +960,7 @@ namespace Lskj.Control
|
||||
while (band.ParentBand != null) band = band.ParentBand;
|
||||
|
||||
columnCaption = band.Caption; // 用 Band 的标题
|
||||
subColumnCaption= focusedColumn.FieldName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,6 +983,7 @@ namespace Lskj.Control
|
||||
while (band.ParentBand != null) band = band.ParentBand;
|
||||
|
||||
columnCaption = band.Caption; // 用 Band 的标题
|
||||
subColumnCaption = focusedColumn.FieldName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,6 +993,14 @@ namespace Lskj.Control
|
||||
|
||||
// ③ 替换占位符(Replace 会返回新字符串)
|
||||
sqlValue = sqlValue.Replace("{COLUMN_TITLE}", columnCaption);
|
||||
sqlValue = sqlValue.Replace("{COLUMN_SUBTITLE}", subColumnCaption);
|
||||
if (sqlValue.Contains("{COLUMN_VALUE}")&&!string.IsNullOrWhiteSpace(subColumnCaption))
|
||||
{
|
||||
string value = rowItem[subColumnCaption]+"";
|
||||
sqlValue = sqlValue.Replace("{COLUMN_VALUE}", value);
|
||||
}
|
||||
|
||||
|
||||
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
|
||||
{
|
||||
string Conditions = string.Empty;
|
||||
@@ -981,6 +1015,11 @@ namespace Lskj.Control
|
||||
string UnionCond = ReplaceHelper.ReplaceRowParam(rowItem, model.UnionCond);
|
||||
sqlValue += UnionCond;
|
||||
}
|
||||
//替换普通焦点行列列名
|
||||
if (sqlValue.Contains("{FOCUSEDCOLUMN_NAME}") && fixColumn != null)
|
||||
{
|
||||
sqlValue = sqlValue.Replace("{FOCUSEDCOLUMN_NAME}", fixColumn.FieldName);
|
||||
}
|
||||
return sqlValue;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -1157,6 +1196,8 @@ namespace Lskj.Control
|
||||
// 获取点击的行句柄
|
||||
int rowHandle = hitInfo.RowHandle;
|
||||
|
||||
//this.ModuleGridObj.GridControlObj.GridView.FocusedColumn = hitInfo.Column;
|
||||
|
||||
if (LastFocusedRowHandle == rowHandle)
|
||||
{
|
||||
//和上一次点击行一致就刷新数据原
|
||||
@@ -1343,6 +1384,7 @@ namespace Lskj.Control
|
||||
{
|
||||
if (this.Model != null)
|
||||
{
|
||||
|
||||
IniHelper.Write(string.Format("base_height_{0}", this.Model.ModuleCode), this.scc_container.SplitterPosition + "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,10 @@ namespace Lskj.Control
|
||||
/// 按钮形式展示的右键
|
||||
/// </summary>
|
||||
private List<SimpleButton> RightButtons = new List<SimpleButton>();
|
||||
|
||||
/// <summary>
|
||||
/// 附加右键菜单集合
|
||||
/// </summary>
|
||||
public List<SimpleButton> itemCommonList = new List<SimpleButton>();
|
||||
|
||||
/// <summary>
|
||||
/// 排序关联值
|
||||
@@ -382,6 +385,12 @@ namespace Lskj.Control
|
||||
/// 左侧表格
|
||||
/// </summary>
|
||||
public GridControlEx LeftGridEx;
|
||||
/// <summary>
|
||||
///特殊左侧表
|
||||
/// </summary>
|
||||
public GridControlEx SpecialLeftTable;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 主表查询时,左侧树表格是否为精确查询(like改成=)
|
||||
/// </summary>
|
||||
@@ -490,6 +499,7 @@ namespace Lskj.Control
|
||||
if (!Model.DataCaches.GetValue(this, "SearchObj", out MyControl searchObj))
|
||||
{
|
||||
searchObj = new MyControl(ReplaceBmpField(this.SysModel.MenuSql), gcMain, LeftTreeViewEx, LeftGridEx, _leftGridSearchObj);//替换sql语句中的bmp字段
|
||||
searchObj.SpecialLeftTable = this.SpecialLeftTable;
|
||||
searchObj.Model = Model;
|
||||
}
|
||||
this.SearchObj = searchObj;
|
||||
@@ -670,14 +680,58 @@ namespace Lskj.Control
|
||||
itemCommon.Location = new Point(x + 6, 6);
|
||||
x += itemCommon.Width + 6;
|
||||
pl_buttom.Controls.Add(itemCommon);
|
||||
itemCommonList.Add(itemCommon);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(tableCommon.Rows.Count>0) this.pl_buttom.Visible = true;
|
||||
this.dpbTools.Visible = tableCommon != null && pm_common.ItemLinks.Count > 0;
|
||||
this.dpbTools.Click += DpbTools_Click;
|
||||
//this.dpbTools.Location = new Point(x + 6, 6);
|
||||
}
|
||||
|
||||
private void DpbTools_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (BarItemLink itemLink in this.pm_common.ItemLinks)
|
||||
{
|
||||
DataRow rowItem = itemLink.Item.Tag as DataRow;
|
||||
if (rowItem != null && rowItem.Table.Columns.Contains("MenuCond"))
|
||||
{
|
||||
string menuCond = rowItem["MenuCond"] + "";
|
||||
string menuCaption = itemLink.Caption;
|
||||
|
||||
if (!string.IsNullOrEmpty(menuCond))
|
||||
{
|
||||
try
|
||||
{
|
||||
bool result = true;
|
||||
DataRow parentitem = this.gcMain.GridView.GetFocusedDataRow();
|
||||
menuCond = ReplaceHelper.ReplaceRowParam(parentitem, menuCond) + "";
|
||||
|
||||
if (menuCond.StartsWith("@") || menuCond.StartsWith("!"))
|
||||
{
|
||||
result = "1".Equals(BaseImpl.GetDefaultValue(menuCond));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ReplaceHelper.EvalCond(menuCond);
|
||||
}
|
||||
itemLink.Item.Enabled = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show("[" + menuCaption + "] " + ResourceKeys.SetRightMenuCondFault);
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
LogUtil.WriteError("验证可操作条件出错!", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:常用工具点击</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -695,7 +749,7 @@ namespace Lskj.Control
|
||||
{
|
||||
DataRow rowItem = e.Item.Tag as DataRow;
|
||||
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj);
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj, this.GridControlObj);
|
||||
menu.Apply(rowItem);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -722,13 +776,41 @@ namespace Lskj.Control
|
||||
{
|
||||
SimpleButton btn = sender as SimpleButton;
|
||||
DataRow rowItem = btn.Tag as DataRow;
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj);
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.SearchObj,this.GridControlObj);
|
||||
StaticControl.RightMenuGridView = gcMain.GridView;
|
||||
StaticControl.Comprefix = this.SysModel.PrefixKey;
|
||||
menu.Apply(rowItem);
|
||||
|
||||
if (StaticControl.ReturnRowLisy.Count > 0)
|
||||
{
|
||||
DataRow[] dataRows = StaticControl.ReturnRowLisy.ToArray();
|
||||
GridColumnCollection gridColumns = this.gcMain.GridView.Columns;
|
||||
foreach (DataRow item in dataRows)
|
||||
{
|
||||
DataTable table = gcMain.GridControl.DataSourceTable();
|
||||
int rowNumber = table.Rows.Count;
|
||||
//新增一行
|
||||
this.AddGridViewRecord();
|
||||
if (this.gcMain.GridView.FocusedRowHandle == rowNumber)
|
||||
{
|
||||
//成功新增行,把网页返回的行赋值
|
||||
foreach (GridColumn col in gridColumns)
|
||||
{
|
||||
if (item.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
// 来源列中是否包含对应字段,包含则使用值
|
||||
gcMain.GridView.SetRowCellValue(this.gcMain.GridView.FocusedRowHandle, col.FieldName, item[col.FieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridRightMenuModel model = new GridRightMenuModel(rowItem);
|
||||
if (model != null && model.Refresh)
|
||||
{
|
||||
this.ParentGridEx.gridControl.DataSource = SqlHelper.ExecuteDataTable(this.ParentGridEx.LastSearchSql);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1000,21 +1082,21 @@ namespace Lskj.Control
|
||||
dtGridRowColors = BaseModuleImpl.GetBaseGridRowColors(this.Model.ModuleCode);
|
||||
}
|
||||
this.gcMain.SetGridRowColors(dtGridRowColors);
|
||||
|
||||
if (!dataCaches.GetValue(this, "BaseGridRightMenus", out DataTable dt))
|
||||
{
|
||||
dt = BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode);
|
||||
}
|
||||
if (this.gcMain is TreeGridControlEx)
|
||||
{
|
||||
(this.gcMain as TreeGridControlEx).SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, (this.gcMain as TreeGridControlEx).MenuStrip);
|
||||
}
|
||||
|
||||
//获取要以上方按钮形式加载的按钮
|
||||
if (dt.Columns.Contains("ButtonMode"))
|
||||
{
|
||||
ButtonModeRightMenus = dt.Rows.Cast<DataRow>().Where(x => "1".Equals(x["ButtonMode"] + "")).ToList();
|
||||
}
|
||||
|
||||
if (this.gcMain is TreeGridControlEx)
|
||||
{
|
||||
(this.gcMain as TreeGridControlEx).SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, (this.gcMain as TreeGridControlEx).MenuStrip);
|
||||
}
|
||||
if (this.gcMain is BandedGridControlEx)
|
||||
{
|
||||
BandedGridControlEx banGridControlEx = (this.gcMain as BandedGridControlEx);
|
||||
@@ -1026,6 +1108,22 @@ namespace Lskj.Control
|
||||
{
|
||||
this.gcMain.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
|
||||
}
|
||||
|
||||
|
||||
if (gcMain.CustomGroupBandEx != null)
|
||||
{
|
||||
gcMain.CustomGroupBandEx.SetGridRowColors(dtGridRowColors);
|
||||
gcMain.CustomGroupBandEx.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, null);
|
||||
gcMain.CustomGroupBandEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
|
||||
gcMain.CustomGroupBandEx.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
|
||||
}
|
||||
if (gcMain.CustomGroupTreeBandEx != null)
|
||||
{
|
||||
gcMain.CustomGroupTreeBandEx.SetGridRowColors(dtGridRowColors);
|
||||
gcMain.CustomGroupTreeBandEx.SetGridRightMenus(dt, this.Model, OnGridViewRightCallBack, this.SearchObj, (this.gcMain as TreeGridControlEx).MenuStrip);
|
||||
}
|
||||
|
||||
|
||||
//如果配置了聚合模式则构建多表头覆盖当前表格
|
||||
//if (SysModel.IsCustomGroup == 1)
|
||||
//{
|
||||
@@ -1451,6 +1549,7 @@ namespace Lskj.Control
|
||||
this.bbi_export.Enabled = this.SysModel.ExportEnable;
|
||||
this.pl_top_fix_search.Enabled = this.pl_top_search.Enabled = this.SysModel.SearchEnable;
|
||||
this.pl_buttom.Visible = this.VisibleOperPanel && (this.SysModel.AddEnable || this.SysModel.DeleteEnable || (this.SysModel.ModifyEnable && this.SysModel.CanEdit));
|
||||
|
||||
this.gcMain.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
|
||||
if (this.LeftGridEx != null) this.LeftGridEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged);
|
||||
this.gcMain.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
|
||||
@@ -1979,9 +2078,10 @@ namespace Lskj.Control
|
||||
private void OnAfterLinkCilkCall(object sender, EventArgs e)
|
||||
{
|
||||
string unioright = sender + "";
|
||||
DataRow rowItem = this.GridControlObj.GetViewFocusedDataRow();
|
||||
|
||||
DataRow rightrowitem = this.GridControlObj.gridViewRightMenu.MenuTable.Rows.Cast<DataRow>().FirstOrDefault(x => (x["orderid"] + "").Equals(unioright));
|
||||
GridRightMenuModel model = new GridRightMenuModel(rightrowitem);
|
||||
DataRow rowItem = this.GridControlObj.GetViewFocusedDataRow();
|
||||
if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
{
|
||||
//判断条件
|
||||
@@ -3254,11 +3354,6 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
}
|
||||
else if (this.ParentGridEx != null && this.ParentGridEx.DataRowCount() > 0)
|
||||
{
|
||||
leftValue = this.ParentGridEx.GridView.GetDataRow(ParentGridEx.GridView.FocusedRowHandle)[ParentKeyField] + "";
|
||||
leftField = this.DetailKeyField;
|
||||
}
|
||||
else if (this.ParentGridEx != null && this.ParentGridEx is TreeGridControlEx)
|
||||
{
|
||||
TreeGridControlEx treeGridControlEx = this.ParentGridEx as TreeGridControlEx;
|
||||
@@ -3268,6 +3363,11 @@ namespace Lskj.Control
|
||||
leftField = this.DetailKeyField;
|
||||
}
|
||||
}
|
||||
else if (this.ParentGridEx != null && this.ParentGridEx.DataRowCount() > 0)
|
||||
{
|
||||
leftValue = this.ParentGridEx.GridView.GetDataRow(ParentGridEx.GridView.FocusedRowHandle)[ParentKeyField] + "";
|
||||
leftField = this.DetailKeyField;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.ParentKeyValue))
|
||||
{
|
||||
leftField = this.ParentKeyField;
|
||||
@@ -3782,6 +3882,7 @@ namespace Lskj.Control
|
||||
bool fixedQuery = queryTable == null || queryTable.Rows.Count == 0;
|
||||
MyControl myControl = new MyControl(sysModel.MenuSql, gcMain, LeftTreeViewEx, LeftGridEx, _leftGridSearchObj)
|
||||
{
|
||||
SpecialLeftTable = this.SpecialLeftTable,
|
||||
Model = dynamicModel
|
||||
};
|
||||
if (!fixedQuery)
|
||||
@@ -4350,11 +4451,12 @@ namespace Lskj.Control
|
||||
try
|
||||
{
|
||||
GridColumn gridColumn = this.gcMain.GridView.FocusedColumn;
|
||||
if (gridColumn != null)
|
||||
if (gridColumn != null&&!gridColumn.FieldName.Equals("DX$CheckboxSelectorColumn"))
|
||||
{
|
||||
//双击的是url图片框就不打开修改界面(会打开图片框)
|
||||
GridColumnModel columnModel = gridColumn.Tag as GridColumnModel;
|
||||
if (columnModel.FieldType == ControlType.LabPicUrl) return;
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.PreSQL))//如果配置预新增界面则弹出
|
||||
@@ -5057,7 +5159,15 @@ namespace Lskj.Control
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
//刷新当前表格
|
||||
if (this.gcMain is TreeGridControlEx)
|
||||
{
|
||||
(this.gcMain as TreeGridControlEx).RefreshDataSource();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gcMain.RefreshDataSource();
|
||||
}
|
||||
|
||||
//刷新子模块表格
|
||||
if (AfterRefreshingCallBack != null) AfterRefreshingCallBack(sender, e);
|
||||
}
|
||||
@@ -5517,6 +5627,18 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
//辅助功能按钮
|
||||
foreach (SimpleButton item in itemCommonList)
|
||||
{
|
||||
if (item.Visible == true && item.Tag is DataRow rightRow)
|
||||
{
|
||||
GridRightMenuModel model = new GridRightMenuModel(rightRow);
|
||||
if (!string.IsNullOrEmpty(model.MenuCond))
|
||||
{
|
||||
item.Enabled = ValidateCond(model.MenuCond, rowItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -464,7 +464,51 @@ namespace Lskj.Control
|
||||
|
||||
}
|
||||
this.ddb_common.Visible = tableCommon != null && tableCommon.Rows.Count > 0;
|
||||
this.ddb_common.Click += Ddb_common_Click;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断常用工具中的条件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Ddb_common_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (BarItemLink itemLink in this.pm_common.ItemLinks)
|
||||
{
|
||||
DataRow rowItem = itemLink.Item.Tag as DataRow;
|
||||
if (rowItem != null&& rowItem.Table.Columns.Contains("MenuCond"))
|
||||
{
|
||||
string menuCond = rowItem["MenuCond"] + "";
|
||||
string menuCaption = itemLink.Caption;
|
||||
|
||||
if (!string.IsNullOrEmpty(menuCond))
|
||||
{
|
||||
try
|
||||
{
|
||||
bool result = true;
|
||||
menuCond = this.ControlObj.ReplaceControlValue(menuCond);
|
||||
if (menuCond.StartsWith("@") || menuCond.StartsWith("!"))
|
||||
{
|
||||
result = "1".Equals(BaseImpl.GetDefaultValue(menuCond));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ReplaceHelper.EvalCond(menuCond);
|
||||
}
|
||||
itemLink.Item.Enabled = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show("[" + menuCaption + "] " + ResourceKeys.SetRightMenuCondFault);
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
LogUtil.WriteError("验证可操作条件出错!", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:常用工具点击</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -2060,6 +2104,20 @@ namespace Lskj.Control
|
||||
try
|
||||
{
|
||||
DataRow rowItem = e.Item.Tag as DataRow;
|
||||
GridRightMenuModel model = new GridRightMenuModel(rowItem);
|
||||
//if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string cond = this.ControlObj.ReplaceControlValue(model.MenuCond);
|
||||
// bool result = ReplaceHelper.EvalCond(cond);
|
||||
// if (!result) return;
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// MessageUtil.Show(ResourceKeys.SetRightMenuCondFault);
|
||||
// }
|
||||
//}
|
||||
|
||||
CommonMenu menu = new CommonMenu(this.Model, this.ControlObj);
|
||||
menu.Apply(rowItem);
|
||||
|
||||
@@ -132,6 +132,11 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
backdragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridBackCompleted);
|
||||
//GridDragGrid.GridAddCheckBox(this.gcMain);
|
||||
//GridDragGrid.GridAddCheckBox(this.gcDetail);
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
this.Text = Business.Impl.LanguageTranslation.GetTranslatedText(this.Text);
|
||||
}
|
||||
Lskj.Control.Model.ReplaceTranslation.TranslationFixedButton(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -284,7 +289,7 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
{
|
||||
GridColumn checkColumn = new GridColumn();
|
||||
checkColumn.Name = checkColumn.FieldName = this._checkFieldName;
|
||||
checkColumn.Caption = "选";
|
||||
checkColumn.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("选") : "选";
|
||||
checkColumn.Width = 30;
|
||||
checkColumn.Visible = true;
|
||||
checkColumn.OptionsColumn.AllowEdit = false;
|
||||
@@ -292,7 +297,7 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
|
||||
GridColumn valueColumn = new GridColumn();
|
||||
valueColumn.FieldName = valueColumn.Name = ValueField;
|
||||
valueColumn.Caption = "编码";
|
||||
valueColumn.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("编码") : "编码";
|
||||
valueColumn.Width = 200;
|
||||
//valueColumn.Visible = true;
|
||||
valueColumn.Visible = ValueMember.Substring(0, 1) != "_";
|
||||
@@ -301,7 +306,7 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
|
||||
GridColumn textColumn = new GridColumn();
|
||||
textColumn.FieldName = textColumn.Name = TextField;
|
||||
textColumn.Caption = "名称";
|
||||
textColumn.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("名称") : "名称";
|
||||
textColumn.Width = 350;
|
||||
//textColumn.Visible = true;
|
||||
textColumn.Visible = TextField.Substring(0, 1) != "_";
|
||||
@@ -327,7 +332,7 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
|
||||
GridColumn remarkColumn = new GridColumn();
|
||||
remarkColumn.Name = remarkColumn.FieldName = RemarkField;
|
||||
remarkColumn.Caption = "备注";
|
||||
remarkColumn.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("备注") : "备注";
|
||||
remarkColumn.Visible = true;
|
||||
remarkColumn.Width = 120;
|
||||
//字段第一个字符为下划线代表不显示
|
||||
@@ -354,6 +359,7 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
{
|
||||
GridColumn otherColumn = new GridColumn();
|
||||
otherColumn.Name = otherColumn.FieldName = otherColumn.Caption = dcol.ColumnName;
|
||||
otherColumn.Caption=Business.Impl.LanguageTranslation.Translatable? Business.Impl.LanguageTranslation.GetTranslatedText(otherColumn.Caption) : otherColumn.Caption;
|
||||
otherColumn.Visible = true;
|
||||
otherColumn.Width = 150;
|
||||
otherColumn.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
|
||||
|
||||
+16
-13
@@ -33,7 +33,6 @@
|
||||
this.pl_left = new DevExpress.XtraEditors.PanelControl();
|
||||
this.pl_left_main = new System.Windows.Forms.Panel();
|
||||
this.pl_gridandtree_container = new DevExpress.XtraEditors.PanelControl();
|
||||
this.treeLeft = new Lskj.Control.TreeViewEx();
|
||||
this.gridLeft = new Lskj.Control.GridControlEx();
|
||||
this.pl_left_top = new DevExpress.XtraEditors.PanelControl();
|
||||
this.splitMain_Right = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
@@ -50,6 +49,7 @@
|
||||
this.tsmi_reserve = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsmi_cancel = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.treeLeft = new Lskj.Control.TreeViewEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitMain)).BeginInit();
|
||||
this.splitMain.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_left)).BeginInit();
|
||||
@@ -118,16 +118,6 @@
|
||||
this.pl_gridandtree_container.Size = new System.Drawing.Size(260, 454);
|
||||
this.pl_gridandtree_container.TabIndex = 9;
|
||||
//
|
||||
// treeLeft
|
||||
//
|
||||
this.treeLeft.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeLeft.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.treeLeft.Name = "treeLeft";
|
||||
this.treeLeft.Size = new System.Drawing.Size(260, 454);
|
||||
this.treeLeft.TabIndex = 7;
|
||||
this.treeLeft.Visible = false;
|
||||
//
|
||||
// gridLeft
|
||||
//
|
||||
this.gridLeft.AdapterObj = null;
|
||||
@@ -138,6 +128,7 @@
|
||||
this.gridLeft.Name = "gridLeft";
|
||||
this.gridLeft.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gridLeft.Size = new System.Drawing.Size(260, 454);
|
||||
this.gridLeft.SysModel = null;
|
||||
this.gridLeft.TabIndex = 6;
|
||||
//
|
||||
// pl_left_top
|
||||
@@ -181,6 +172,7 @@
|
||||
this.gcMain.Name = "gcMain";
|
||||
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gcMain.Size = new System.Drawing.Size(866, 209);
|
||||
this.gcMain.SysModel = null;
|
||||
this.gcMain.TabIndex = 12;
|
||||
//
|
||||
// pl_top
|
||||
@@ -204,6 +196,7 @@
|
||||
this.gcDetail.Name = "gcDetail";
|
||||
this.gcDetail.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gcDetail.Size = new System.Drawing.Size(866, 204);
|
||||
this.gcDetail.SysModel = null;
|
||||
this.gcDetail.TabIndex = 13;
|
||||
//
|
||||
// panelControl1
|
||||
@@ -304,7 +297,17 @@
|
||||
this.tsmi_cancel.Size = new System.Drawing.Size(100, 22);
|
||||
this.tsmi_cancel.Text = "取消";
|
||||
//
|
||||
// FrmModelLookUp
|
||||
// treeLeft
|
||||
//
|
||||
this.treeLeft.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeLeft.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.treeLeft.Name = "treeLeft";
|
||||
this.treeLeft.Size = new System.Drawing.Size(260, 454);
|
||||
this.treeLeft.TabIndex = 7;
|
||||
this.treeLeft.Visible = false;
|
||||
//
|
||||
// FrmModelLookUp2
|
||||
//
|
||||
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Appearance.Options.UseBackColor = true;
|
||||
@@ -314,7 +317,7 @@
|
||||
this.Controls.Add(this.splitMain);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.Name = "FrmModelLookUp";
|
||||
this.Name = "FrmModelLookUp2";
|
||||
this.Text = "提示:双击选择";
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitMain)).EndInit();
|
||||
this.splitMain.ResumeLayout(false);
|
||||
|
||||
@@ -472,13 +472,13 @@ namespace Lskj.Control
|
||||
// 如果它是网格,就把事件绑上去
|
||||
if (leftCtrl is GridControlEx g1)
|
||||
{
|
||||
g1.GridView.FocusedRowChanged += (s, e) => RefreshRightTab(rightTab, g1);
|
||||
g1.GridView.FocusedRowObjectChanged += (s, e) => RefreshRightTab(rightTab, g1);
|
||||
RefreshRightTab(rightTab, g1);// 首次加载
|
||||
}
|
||||
else if (leftCtrl is ModuleGridEx mg)
|
||||
{
|
||||
var g2 = mg.GridControlObj;
|
||||
g2.GridView.FocusedRowChanged += (s, e) => RefreshRightTab(rightTab, g2);
|
||||
g2.GridView.FocusedRowObjectChanged += (s, e) => RefreshRightTab(rightTab, g2);
|
||||
RefreshRightTab(rightTab, g2); // 首次加载
|
||||
}
|
||||
page.Controls.Add(split);// 跟原来保持一致的 Tag 用法
|
||||
@@ -1085,7 +1085,7 @@ namespace Lskj.Control
|
||||
webView.AllowDownload = !forbidDownload;
|
||||
webView.Tag = model;
|
||||
parentControl.Tag = webView;
|
||||
webView.FrmLoad(url);
|
||||
webView.FrmLoad(ReplaceHelper.ReplaceUserInfo(url));
|
||||
return webView;
|
||||
}
|
||||
else
|
||||
@@ -1096,7 +1096,7 @@ namespace Lskj.Control
|
||||
webView.Dock = DockStyle.Fill;
|
||||
webView.Tag = model;
|
||||
parentControl.Tag = webView;
|
||||
webView.FrmLoad(url);
|
||||
webView.FrmLoad(ReplaceHelper.ReplaceUserInfo(url));
|
||||
return webView;
|
||||
}
|
||||
}
|
||||
@@ -1358,6 +1358,7 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
gridEx.VisibleOperPanel = !model.IsReadOnly;
|
||||
if (model.HideBottomPanel) gridEx.VisibleOperPanel = false;
|
||||
gridEx.InitializeControl(model.SystemModel, dyncModel);
|
||||
|
||||
gridEx.GridControlObj.Tag = model;
|
||||
|
||||
@@ -40,6 +40,8 @@ using Lskj.Control.MultiModelLookUp;
|
||||
using System.Text.RegularExpressions;
|
||||
using DevExpress.XtraGrid.Views.BandedGrid;
|
||||
using System.Collections;
|
||||
using System.Data.Common;
|
||||
using Lskj.Core;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -2053,7 +2055,7 @@ namespace Lskj.Control
|
||||
// this.TreeListObj.FocusedNode = lastNode;
|
||||
//}
|
||||
}
|
||||
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
||||
public override int SetGridViewDataSource(DbDataAdapter adapter, bool selectRowHandler = true)
|
||||
{
|
||||
if (adapter == null) return 0;
|
||||
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
||||
@@ -2103,8 +2105,9 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
|
||||
|
||||
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||
DbCommandBuilder cb = SqlHelper.dbFactory.CreateCommandBuilder();
|
||||
cb.DataAdapter = this.AdapterObj;
|
||||
//SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||
|
||||
GetTreeExpanded();
|
||||
this.gcMain.DataSource = dataSet.Tables[0];
|
||||
|
||||
@@ -41,6 +41,7 @@ using System.Text.RegularExpressions;
|
||||
using Lskj.Core;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -91,6 +92,9 @@ namespace Lskj.Control
|
||||
/// 下拉框数据源绑定完成后执行
|
||||
/// </summary>
|
||||
public new event EventHandler OnDataSourceBindCallBack;
|
||||
// 全局标记:是否正在编辑
|
||||
private bool isEditing = false;
|
||||
|
||||
|
||||
public TreeGridControlEx()
|
||||
{
|
||||
@@ -105,6 +109,11 @@ namespace Lskj.Control
|
||||
|
||||
this.gcMain.CustomDrawFooterCell += GcMain_CustomDrawFooterCell;
|
||||
|
||||
// 双击编辑单元格时禁用“双击节点折叠/展开”
|
||||
this.gcMain.OptionsBehavior.AllowExpandOnDblClick = false;
|
||||
this.gcMain.MouseDown += GcMain_MouseDown;
|
||||
this.gcMain.ShownEditor += GcMain_ShownEditor;
|
||||
this.gcMain.HiddenEditor += GcMain_HiddenEditor;
|
||||
|
||||
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
|
||||
{
|
||||
@@ -125,6 +134,42 @@ namespace Lskj.Control
|
||||
//this.gcMain.OptionsFind.AlwaysVisible = true;
|
||||
}
|
||||
|
||||
private void GcMain_HiddenEditor(object sender, EventArgs e)
|
||||
{
|
||||
isEditing = false;
|
||||
}
|
||||
|
||||
private void GcMain_ShownEditor(object sender, EventArgs e)
|
||||
{
|
||||
isEditing = true;
|
||||
}
|
||||
|
||||
private void GcMain_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (isEditing) return; // 编辑中不处理折叠
|
||||
|
||||
TreeList treeList = sender as TreeList;
|
||||
if (treeList == null || e.Clicks != 2 || e.Button != MouseButtons.Left)
|
||||
return;
|
||||
|
||||
TreeListHitInfo hitInfo = treeList.CalcHitInfo(e.Location);
|
||||
if (hitInfo.Node == null) return;
|
||||
|
||||
// 双击可编辑单元格 → 仅编辑,不折叠
|
||||
if (hitInfo.HitInfoType == HitInfoType.Cell
|
||||
&& hitInfo.Column != null
|
||||
&& hitInfo.Column.OptionsColumn.AllowEdit)
|
||||
{
|
||||
treeList.ShowEditor();
|
||||
}
|
||||
//单击行,或者节点前的按钮,或者不可编辑单元格 就改变折叠状态
|
||||
else if (hitInfo.HitInfoType == HitInfoType.Row || hitInfo.HitInfoType == HitInfoType.Button||(hitInfo.HitInfoType == HitInfoType.Cell&& !hitInfo.Column.OptionsColumn.AllowEdit))
|
||||
{
|
||||
// 15.2切换节点展开状态(原生API)
|
||||
hitInfo.Node.Expanded = !hitInfo.Node.Expanded;
|
||||
}
|
||||
}
|
||||
|
||||
private void GcMain_CustomDrawFooterCell(object sender, CustomDrawFooterCellEventArgs e)
|
||||
{
|
||||
TreeListColumn listColumn = e.Column;
|
||||
@@ -1941,11 +1986,12 @@ namespace Lskj.Control
|
||||
protected override void SetCustomColumns(DataTable customTable, bool isInit = true)
|
||||
{
|
||||
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
|
||||
if (!dataCaches.GetValue(this, "HasExistsSettingTable", out bool hasExistsSettingTable))
|
||||
{
|
||||
hasExistsSettingTable = BaseImpl.HasExistsTable(ResourceKeys.SettingTableName);
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.CustomColumKey) || !hasExistsSettingTable) return;
|
||||
//if (!dataCaches.GetValue(this, "HasExistsSettingTable", out bool hasExistsSettingTable))
|
||||
//{
|
||||
// hasExistsSettingTable = BaseImpl.HasExistsTable(ResourceKeys.SettingTableName);
|
||||
//}
|
||||
// !hasExistsSettingTable
|
||||
if (string.IsNullOrEmpty(this.CustomColumKey) || customTable.Columns.Count == 0) return;
|
||||
if (customTable != null && customTable.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow rowItem in customTable.Rows)
|
||||
@@ -2192,6 +2238,22 @@ namespace Lskj.Control
|
||||
// 复制单元格
|
||||
if (e.Control && e.KeyCode == Keys.C)
|
||||
{
|
||||
//List<TreeListCell> cells=new List<TreeListCell>();
|
||||
////复选框状态
|
||||
//if (gcMain.OptionsSelection.MultiSelect == true && gcMain.OptionsSelection.MultiSelectMode == TreeListMultiSelectMode.RowSelect && gcMain.OptionsSelection.EnableAppearanceFocusedCell == false && this.GetViewFocusedDataRows().Length == 0)
|
||||
//{
|
||||
// //GridViewInfo info = gridView.GetViewInfo() as GridViewInfo;
|
||||
// //GridCellInfo cellInfo = info.GetGridCellInfo(gridView.FocusedRowHandle, gridView.FocusedColumn);
|
||||
// TreeListCell cell = new TreeListCell(gcMain.FocusedNode, gcMain.FocusedColumn);
|
||||
// cells.Add(cell);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// cells = this.gcMain.GetSelectedCells();
|
||||
//}
|
||||
|
||||
|
||||
|
||||
var selectNodes = this.gcMain.Selection;
|
||||
if (selectNodes != null && selectNodes.Count == 1)
|
||||
{
|
||||
@@ -2390,7 +2452,7 @@ namespace Lskj.Control
|
||||
this.AdjustIndicatorWidthSmart();
|
||||
this.SetAutoColumns();
|
||||
}
|
||||
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
||||
public override int SetGridViewDataSource(DbDataAdapter adapter, bool selectRowHandler = true)
|
||||
{
|
||||
if (adapter == null) return 0;
|
||||
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
||||
@@ -2440,8 +2502,9 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||
DbCommandBuilder cb = SqlHelper.dbFactory.CreateCommandBuilder();
|
||||
cb.DataAdapter = this.AdapterObj;
|
||||
//SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||
|
||||
GetTreeExpanded();
|
||||
|
||||
@@ -4572,4 +4635,4 @@ namespace Lskj.Control
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="UpdateColumnRefresh">判断是否只刷新Upd
|
||||
/// <param name="UpdateColumnRefresh">判断是否只刷新UpdateColu
|
||||
Reference in New Issue
Block a user