Commit 563e385a authored by 段廷瑞's avatar 段廷瑞

1、Excel导出配置:增加卡片配置

parent 05b572a2
......@@ -4,6 +4,12 @@
<add key="LoginInfo" value="wwF/xpBzWek=" />
<add key="LoginVerify" value="v86f5Q3Xa7U=" />
<add key="UpdateTime" value="2021-12-09 09:48:49.755" />
<add key="ExceptFiles" value="" />
<add key="ContainFiles" value="" />
<add key="PatchTimeFrame_Dll" value="48" />
<add key="PatchTimeFrame_Sql" value="720" />
<add key="PatchTimeFrame_Xml" value="720" />
<add key="Exclude_PDB" value="1" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
......
......@@ -3,4 +3,14 @@
3、右侧通过右键菜单増行和删行
4、右侧-上表:前缀自动生成,只需填写模板名称
5、右侧-下表:模板通过单击选择,表名必填
6、通过右上角“保存设置”按钮,保存所有配置
\ No newline at end of file
6、通过右上角“保存设置”按钮,保存所有配置
【卡片配置特别说明】
*卡片式某个Sheet页内的一个矩形区域,所以为了定位模板,我们需要以下属性:
所属模板:用于定位所属模板
Sheet序号:用于定位具体是模板内的Sheet位置(从0开始),模板+Sheet应该是唯一的
起始行:用于定位卡片的起始行位置,即卡片的第一行。(从0开始,即实际行号减1)
起始列:用于定位卡片的起始列位置,及卡片的第一列。(从0开始)
行跨度:卡片占用的总行数,至少1行
列跨度:卡片占用的总列数,至少1列
每行卡片数量:即每行并列摆放几个卡片,至少1个
\ No newline at end of file
......@@ -120,4 +120,16 @@
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
<links>
<Link>192.168.1.204</Link>
<DbName>FTT_GeErRui</DbName>
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
<links>
<Link>192.168.1.202</Link>
<DbName>FTT_CJ211123</DbName>
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
</DocumentElement>
\ No newline at end of file
......@@ -23,11 +23,14 @@ namespace Tools.UI.Popups
/// </summary>
public List<string> CheckedItems => this.checkedListBox1.CheckedItems.Cast<string>().ToList();
public wSelectTemplates(IEnumerable<string> items)
public wSelectTemplates(IEnumerable<string> items, bool isMultiSelect = true)
{
InitializeComponent();
//状态初始化
this.DialogResult = DialogResult.None;
//界面初始化
this.btnShotAll.Enabled = isMultiSelect;
this.btnShotAdded.Enabled = isMultiSelect;
//初始化数据源
this.checkedListBox1.Items.AddRange(items.ToArray());
}
......
......@@ -29,7 +29,8 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.myTreeView1 = new Tools.MyCommon.controls.MyTreeView();
this.label1 = new System.Windows.Forms.Label();
......@@ -49,6 +50,13 @@
this.tslTables = new System.Windows.Forms.ToolStripLabel();
this.panel2 = new System.Windows.Forms.Panel();
this.dgvTemplates = new System.Windows.Forms.DataGridView();
this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column14 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column15 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolStrip2 = new System.Windows.Forms.ToolStrip();
this.tslTemplates = new System.Windows.Forms.ToolStripLabel();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
......@@ -58,13 +66,17 @@
this.tslDbLink = new System.Windows.Forms.ToolStripLabel();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsbHelp = new System.Windows.Forms.ToolStripButton();
this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column14 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column15 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolStrip4 = new System.Windows.Forms.ToolStrip();
this.tslCardInfo = new System.Windows.Forms.ToolStripLabel();
this.dgvCardInfo = new System.Windows.Forms.DataGridView();
this.cbTemplateName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewCheckBoxColumn2 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
......@@ -76,6 +88,8 @@
((System.ComponentModel.ISupportInitialize)(this.dgvTemplates)).BeginInit();
this.toolStrip2.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.toolStrip4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvCardInfo)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
......@@ -91,12 +105,14 @@
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.dgvCardInfo);
this.splitContainer1.Panel2.Controls.Add(this.toolStrip4);
this.splitContainer1.Panel2.Controls.Add(this.dgvTables);
this.splitContainer1.Panel2.Controls.Add(this.toolStrip3);
this.splitContainer1.Panel2.Controls.Add(this.panel2);
this.splitContainer1.Panel2.Controls.Add(this.toolStrip2);
this.splitContainer1.Size = new System.Drawing.Size(791, 486);
this.splitContainer1.SplitterDistance = 226;
this.splitContainer1.Size = new System.Drawing.Size(881, 518);
this.splitContainer1.SplitterDistance = 251;
this.splitContainer1.TabIndex = 0;
//
// myTreeView1
......@@ -104,7 +120,7 @@
this.myTreeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.myTreeView1.Location = new System.Drawing.Point(0, 23);
this.myTreeView1.Name = "myTreeView1";
this.myTreeView1.Size = new System.Drawing.Size(226, 463);
this.myTreeView1.Size = new System.Drawing.Size(251, 495);
this.myTreeView1.TabIndex = 2;
//
// label1
......@@ -114,7 +130,7 @@
this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(226, 23);
this.label1.Size = new System.Drawing.Size(251, 23);
this.label1.TabIndex = 1;
this.label1.Text = "*请先选择一个模块";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
......@@ -133,11 +149,11 @@
this.Column5,
this.Column9});
this.dgvTables.ContextMenuStrip = this.contextMenuStrip1;
this.dgvTables.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvTables.Dock = System.Windows.Forms.DockStyle.Top;
this.dgvTables.Location = new System.Drawing.Point(0, 217);
this.dgvTables.Name = "dgvTables";
this.dgvTables.RowTemplate.Height = 23;
this.dgvTables.Size = new System.Drawing.Size(561, 269);
this.dgvTables.Size = new System.Drawing.Size(626, 176);
this.dgvTables.TabIndex = 0;
//
// Column10
......@@ -194,9 +210,9 @@
// Column9
//
this.Column9.DataPropertyName = "SelectSQL";
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Column9.DefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Column9.DefaultCellStyle = dataGridViewCellStyle5;
this.Column9.HeaderText = "SQL脚本";
this.Column9.Name = "Column9";
this.Column9.Width = 200;
......@@ -230,7 +246,7 @@
this.tslTables});
this.toolStrip3.Location = new System.Drawing.Point(0, 192);
this.toolStrip3.Name = "toolStrip3";
this.toolStrip3.Size = new System.Drawing.Size(561, 25);
this.toolStrip3.Size = new System.Drawing.Size(626, 25);
this.toolStrip3.TabIndex = 4;
this.toolStrip3.Text = "toolStrip3";
//
......@@ -246,7 +262,7 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 25);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(561, 167);
this.panel2.Size = new System.Drawing.Size(626, 167);
this.panel2.TabIndex = 3;
//
// dgvTemplates
......@@ -266,16 +282,62 @@
this.dgvTemplates.Location = new System.Drawing.Point(0, 0);
this.dgvTemplates.Name = "dgvTemplates";
this.dgvTemplates.RowTemplate.Height = 23;
this.dgvTemplates.Size = new System.Drawing.Size(561, 167);
this.dgvTemplates.Size = new System.Drawing.Size(626, 167);
this.dgvTemplates.TabIndex = 5;
//
// Column11
//
this.Column11.DataPropertyName = "Prefix";
this.Column11.HeaderText = "前缀";
this.Column11.Name = "Column11";
this.Column11.ReadOnly = true;
this.Column11.Width = 150;
//
// Column7
//
this.Column7.DataPropertyName = "TpName";
this.Column7.HeaderText = "模板名称";
this.Column7.Name = "Column7";
this.Column7.Width = 150;
//
// Column14
//
this.Column14.DataPropertyName = "IsStop";
this.Column14.HeaderText = "停用";
this.Column14.Name = "Column14";
//
// Column15
//
this.Column15.DataPropertyName = "IsDetailAutoRowHeight";
this.Column15.HeaderText = "明细自动行高";
this.Column15.Name = "Column15";
//
// Column8
//
this.Column8.DataPropertyName = "GrpTableName";
this.Column8.HeaderText = "分组表名";
this.Column8.Name = "Column8";
//
// Column12
//
this.Column12.DataPropertyName = "GrpColumnName";
this.Column12.HeaderText = "分组列名";
this.Column12.Name = "Column12";
//
// Column13
//
this.Column13.DataPropertyName = "ExportNameSOL";
this.Column13.HeaderText = "导出名称SQL";
this.Column13.Name = "Column13";
this.Column13.Width = 200;
//
// toolStrip2
//
this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tslTemplates});
this.toolStrip2.Location = new System.Drawing.Point(0, 0);
this.toolStrip2.Name = "toolStrip2";
this.toolStrip2.Size = new System.Drawing.Size(561, 25);
this.toolStrip2.Size = new System.Drawing.Size(626, 25);
this.toolStrip2.TabIndex = 2;
this.toolStrip2.Text = "toolStrip2";
//
......@@ -296,7 +358,7 @@
this.tsbHelp});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(791, 25);
this.toolStrip1.Size = new System.Drawing.Size(881, 25);
this.toolStrip1.TabIndex = 3;
this.toolStrip1.Text = "toolStrip1";
//
......@@ -345,57 +407,110 @@
this.tsbHelp.Text = "使用说明";
this.tsbHelp.Click += new System.EventHandler(this.tsbHelp_Click);
//
// Column11
//
this.Column11.DataPropertyName = "Prefix";
this.Column11.HeaderText = "前缀";
this.Column11.Name = "Column11";
this.Column11.ReadOnly = true;
this.Column11.Width = 150;
//
// Column7
//
this.Column7.DataPropertyName = "TpName";
this.Column7.HeaderText = "模板名称";
this.Column7.Name = "Column7";
this.Column7.Width = 150;
//
// Column14
//
this.Column14.DataPropertyName = "IsStop";
this.Column14.HeaderText = "停用";
this.Column14.Name = "Column14";
//
// Column15
//
this.Column15.DataPropertyName = "IsDetailAutoRowHeight";
this.Column15.HeaderText = "明细自动行高";
this.Column15.Name = "Column15";
//
// Column8
//
this.Column8.DataPropertyName = "GrpTableName";
this.Column8.HeaderText = "分组表名";
this.Column8.Name = "Column8";
//
// Column12
//
this.Column12.DataPropertyName = "GrpColumnName";
this.Column12.HeaderText = "分组列名";
this.Column12.Name = "Column12";
//
// Column13
//
this.Column13.DataPropertyName = "ExportNameSOL";
this.Column13.HeaderText = "导出名称SQL";
this.Column13.Name = "Column13";
this.Column13.Width = 200;
// toolStrip4
//
this.toolStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tslCardInfo});
this.toolStrip4.Location = new System.Drawing.Point(0, 393);
this.toolStrip4.Name = "toolStrip4";
this.toolStrip4.Size = new System.Drawing.Size(626, 25);
this.toolStrip4.TabIndex = 5;
this.toolStrip4.Text = "toolStrip4";
//
// tslCardInfo
//
this.tslCardInfo.Name = "tslCardInfo";
this.tslCardInfo.Size = new System.Drawing.Size(80, 22);
this.tslCardInfo.Text = "卡片模板配置";
//
// dgvCardInfo
//
this.dgvCardInfo.BackgroundColor = System.Drawing.SystemColors.Window;
this.dgvCardInfo.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvCardInfo.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.cbTemplateName,
this.dataGridViewTextBoxColumn2,
this.dataGridViewCheckBoxColumn1,
this.dataGridViewCheckBoxColumn2,
this.dataGridViewTextBoxColumn3,
this.dataGridViewTextBoxColumn4,
this.dataGridViewTextBoxColumn5,
this.dataGridViewTextBoxColumn6});
this.dgvCardInfo.ContextMenuStrip = this.contextMenuStrip1;
this.dgvCardInfo.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvCardInfo.Location = new System.Drawing.Point(0, 418);
this.dgvCardInfo.Name = "dgvCardInfo";
this.dgvCardInfo.RowTemplate.Height = 23;
this.dgvCardInfo.Size = new System.Drawing.Size(626, 100);
this.dgvCardInfo.TabIndex = 7;
//
// cbTemplateName
//
this.cbTemplateName.DataPropertyName = "TemplateName";
this.cbTemplateName.HeaderText = "绑定模板";
this.cbTemplateName.Name = "cbTemplateName";
this.cbTemplateName.ReadOnly = true;
this.cbTemplateName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.cbTemplateName.Width = 150;
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "SheetIndex";
this.dataGridViewTextBoxColumn2.HeaderText = "Sheet序号";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
//
// dataGridViewCheckBoxColumn1
//
this.dataGridViewCheckBoxColumn1.DataPropertyName = "PerLineCount";
this.dataGridViewCheckBoxColumn1.HeaderText = "每行卡片数量";
this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1";
this.dataGridViewCheckBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.True;
//
// dataGridViewCheckBoxColumn2
//
this.dataGridViewCheckBoxColumn2.DataPropertyName = "IsStop";
this.dataGridViewCheckBoxColumn2.HeaderText = "是否停用";
this.dataGridViewCheckBoxColumn2.Name = "dataGridViewCheckBoxColumn2";
this.dataGridViewCheckBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewCheckBoxColumn2.Width = 60;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.DataPropertyName = "RowStart";
this.dataGridViewTextBoxColumn3.HeaderText = "起始行";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewTextBoxColumn3.Width = 80;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "ColumnStart";
this.dataGridViewTextBoxColumn4.HeaderText = "起始列";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.Width = 80;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "RowSpan";
this.dataGridViewTextBoxColumn5.HeaderText = "行跨度";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.Width = 80;
//
// dataGridViewTextBoxColumn6
//
this.dataGridViewTextBoxColumn6.DataPropertyName = "ColumnSpan";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle4;
this.dataGridViewTextBoxColumn6.HeaderText = "列跨度";
this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
this.dataGridViewTextBoxColumn6.Width = 80;
//
// wExcelExportSetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(791, 511);
this.ClientSize = new System.Drawing.Size(881, 543);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.toolStrip1);
this.Name = "wExcelExportSetting";
......@@ -415,6 +530,9 @@
this.toolStrip2.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.toolStrip4.ResumeLayout(false);
this.toolStrip4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvCardInfo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -457,5 +575,16 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
private System.Windows.Forms.ToolStrip toolStrip4;
private System.Windows.Forms.ToolStripLabel tslCardInfo;
private System.Windows.Forms.DataGridView dgvCardInfo;
private System.Windows.Forms.DataGridViewTextBoxColumn cbTemplateName;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewCheckBoxColumn1;
private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
}
}
\ No newline at end of file
......@@ -58,6 +58,24 @@ namespace Tools.UI
SelectSQL VARCHAR(MAX) NULL
)
END
IF NOT EXISTS(SELECT 1 FROM sys.tables WHERE name = 'ModuleTemplateCardInfo')
BEGIN
CREATE TABLE ModuleTemplateCardInfo
(
ID INT IDENTITY(1,1) PRIMARY KEY
, ModuleID INT NULL
, TemplateName VARCHAR(50)
, SheetIndex INT NULL
, PerLineCount INT NULL
, RowStart INT NULL
, ColumnStart INT NULL
, RowSpan INT NULL
, ColumnSpan INT NULL
, Remark VARCHAR(MAX) NULL
, IsStop BIT NULL
)
END";
this._db.ExecNonSql(sql);
......@@ -66,6 +84,7 @@ namespace Tools.UI
this.ModuleTableList = new List<TQuery>() {
new TQuery("ModuleTemplate"),
new TQuery("ModuleTemplateTable"),
new TQuery("ModuleTemplateCardInfo"),
};
this._ds = this._db.GetData(this.ModuleTableList, true);
}
......@@ -78,9 +97,13 @@ namespace Tools.UI
this.dgvTemplates.AutoGenerateColumns = false;
this.dgvTables.AllowUserToAddRows = false;
this.dgvTables.AutoGenerateColumns = false;
this.dgvCardInfo.AllowUserToAddRows = false;
this.dgvCardInfo.AutoGenerateColumns = false;
this.dgvTemplates.DataSource = this._ds.Tables["ModuleTemplate"].DefaultView;
this.dgvTables.DataSource = this._ds.Tables["ModuleTemplateTable"].DefaultView;
this.dgvCardInfo.DataSource = this._ds.Tables["ModuleTemplateCardInfo"].DefaultView;
this.dgvTables.CellClick += DgvTables_CellClick;
this.dgvCardInfo.CellClick += DgvCardInfo_CellClick;
//初始化树结构
var sql = $"SELECT * FROM dbo.SysBusinessModel";
this.myTreeView1.DataSource = this._db.GetDataTable(sql, "SysModels");
......@@ -102,15 +125,19 @@ namespace Tools.UI
var id = Convert.ToInt32(drNow["ID"]);
this._ds.Tables["ModuleTemplate"].DefaultView.RowFilter = $"ModuleID={id}";
this._ds.Tables["ModuleTemplateTable"].DefaultView.RowFilter = $"ModuleID={id}";
this._ds.Tables["ModuleTemplateCardInfo"].DefaultView.RowFilter = $"ModuleID={id}";
//仅当叶子节点(即模块节点)操作时表格有效
bool isEnabled = e.Node.Nodes.Count == 0;
this.dgvTemplates.Enabled = isEnabled;
this.dgvTables.Enabled = isEnabled;
this.dgvCardInfo.Enabled = isEnabled;
this.tslTemplates.ForeColor = isEnabled ? Color.Black : Color.Gray;
this.tslTables.ForeColor = isEnabled ? Color.Black : Color.Gray;
this.tslCardInfo.ForeColor = isEnabled ? Color.Black : Color.Gray;
var tag = isEnabled ? "" : "(已禁用)";
this.tslTemplates.Text = $"模板维护{tag}";
this.tslTables.Text = $"数据源绑定{tag}";
this.tslCardInfo.Text = $"卡片模板配置{tag}";
}
//单元格单击:选择模板
private void DgvTables_CellClick(object sender, DataGridViewCellEventArgs e)
......@@ -145,14 +172,39 @@ namespace Tools.UI
}
}
}
//单元格点击:选择模板
private void DgvCardInfo_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
return;
if (this.dgvTables.Columns[e.ColumnIndex].DataPropertyName.Equals("TpNames"))
{
var items = this._ds.Tables["ModuleTemplate"].DefaultView.Cast<DataRowView>().Select(r => r["TpName"].ToString());
wSelectTemplates frm = new wSelectTemplates(items);
if (frm.ShowDialog() == DialogResult.OK)
{
var drNow = this._ds.Tables["ModuleTemplateCardInfo"].DefaultView[e.RowIndex];
var result = "";
if (frm.CheckedItems.Count > 0)
{
result = frm.CheckedItems[0];
}
drNow["TemplateName"] = result;
drNow.EndEdit();
}
}
}
//上下文菜单
DataTable dtFocused = null;
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{
var name = (sender as ContextMenuStrip).SourceControl.Name;
var tableName = name.Equals(dgvTemplates.Name) ? "ModuleTemplate" : "ModuleTemplateTable";
dtFocused = this._ds.Tables[tableName];
dtFocused = null;
var ctrl = (sender as ContextMenuStrip).SourceControl;
if (ctrl is DataGridView)
{
dtFocused = ((ctrl as DataGridView).DataSource as DataView).Table;
}
}
private void tsmiAddRow_Click(object sender, EventArgs e)
{
......@@ -172,10 +224,17 @@ namespace Tools.UI
//清除所有对该模板的引用
if (isTemplate)
{
string mName = $"[{drDel["TpName"].ToString()}]";
string tpName = drDel["TpName"].ToString();
//清除数据绑定
foreach (DataRowView drv in this._ds.Tables["ModuleTemplateTable"].DefaultView)
{
drv["TpNames"] = drv["TpNames"].ToString().Replace($"[{tpName}]", "");
drv.EndEdit();
}
//清除卡片设置
foreach (DataRowView drv in this._ds.Tables["ModuleTemplateTable"].DefaultView)
{
drv["TpNames"] = drv["TpNames"].ToString().Replace(mName, "");
drv["TemplateName"] = drv["TemplateName"].ToString().Replace(tpName, "");
drv.EndEdit();
}
}
......
......@@ -117,6 +117,36 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="cbTemplateName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewCheckBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewCheckBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>347, 17</value>
</metadata>
<metadata name="toolStrip4.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>622, 17</value>
</metadata>
<metadata name="Column10.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......@@ -141,12 +171,12 @@
<metadata name="Column9.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>347, 17</value>
</metadata>
<metadata name="toolStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>237, 17</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="Column11.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......@@ -168,9 +198,6 @@
<metadata name="Column13.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>512, 17</value>
</metadata>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment