From fa43bc9d26c7b9ec2b07e2d3e1a7f07abe68da5b Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期四, 15 五月 2025 14:46:59 +0800 Subject: [PATCH] 导入 --- DevApp/Gs.DevApp/UserControl/ShowUp.cs | 80 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 78 insertions(+), 2 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/ShowUp.cs b/DevApp/Gs.DevApp/UserControl/ShowUp.cs index 3f9527e..a6fd13a 100644 --- a/DevApp/Gs.DevApp/UserControl/ShowUp.cs +++ b/DevApp/Gs.DevApp/UserControl/ShowUp.cs @@ -1,5 +1,13 @@ -锘縰sing Gs.DevApp.ToolBox; +锘縰sing CefSharp; +using DevExpress.XtraEditors; +using Gs.DevApp.ToolBox; using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Net; +using System.Windows.Documents; +using System.Windows.Forms; namespace Gs.DevApp.UserControl { @@ -12,12 +20,21 @@ public event EventHandler<UpdateParentEventArgs> UpdateParent; string parentGuid = ""; - public ShowUp(string _parentGuid) + + + /// <summary> + /// + /// </summary> + /// <param name="_parentGuid">鐖朵翰guid</param> + /// <param name="isXls">濡傛灉鏄痻ls锛屾樉绀虹浉搴旂殑璇存槑</param> + public ShowUp(string _parentGuid, bool isXls = false) { InitializeComponent(); this.parentGuid = _parentGuid; this.ucUpFile1.parentGuid = _parentGuid; ucUpFile1.UpChanged += UcUpFile1_UpChanged; + + getBtn(); } /// <summary> @@ -31,5 +48,64 @@ new UpdateParentEventArgs { FilterList = null }); Close(); } + + private void getBtn() + { + List<dynamic> lst = new List<dynamic>(); + lst.Add(new + { + btnTxt = "妫�楠屽伐鍏穃nXLS妯℃澘", + xls = "001妫�楠屽伐鍏�.xls" + }); + lst.Add(new + { + btnTxt = "妫�楠岄」鐩甛nXLS妯℃澘", + xls = "001妫�楠岄」鐩�.xls"//001 + }); + + lst.Add(new + { + btnTxt = "鐗╂枡妫�楠岄」鐩甛nXLS妯℃澘", + xls = "001鐗╂枡妫�楠岄」鐩�.xls" + }); + + foreach (var obj in lst) + { + SimpleButton btn = new DevExpress.XtraEditors.SimpleButton(); + btn.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.printarea_32x32; + btn.ImageOptions.ImageToTextAlignment = DevExpress.XtraEditors.ImageAlignToText.TopCenter; + btn.Name = Guid.NewGuid().ToString(); + btn.Size = new System.Drawing.Size(120, 120); + btn.TabIndex = 1; + btn.Text = obj.btnTxt; + btn.Margin = new System.Windows.Forms.Padding(10); + btn.Tag = obj.xls; + this.flowLayoutPanel1.Controls.Add(btn); + btn.Click += Btn_Click; + } + } + + private void Btn_Click(object sender, EventArgs e) + { + string _guid = Guid.NewGuid().ToString(); + SimpleButton btn = (SimpleButton)sender; + string urlPath = btn.Tag.ToString();//a697b909-5baa-4e74-8df4-87abb1f96240ico.png + using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) + { + folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�"; + DialogResult dialogResult = folderBrowserDialog.ShowDialog(); + if (dialogResult == DialogResult.OK) + { + string _folder = folderBrowserDialog.SelectedPath; + string _folderName = _folder + "\\" + urlPath; + string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + "upload/" + urlPath; + using (WebClient client = new WebClient()) + { + client.DownloadFile(_url, _folderName); + } + ToolBox.MsgHelper.ShowInformation("涓嬭浇鎴愬姛锛�"); + } + } + } } } \ No newline at end of file -- Gitblit v1.9.3